last agent to api rename

master
Tudor Stanciu 2021-04-24 20:50:56 +03:00
parent 57e066f0a0
commit 4a1831452b
7 changed files with 13 additions and 13 deletions

View File

@ -26,10 +26,10 @@ namespace NetworkResurrector.Api.Application.Queries
public class QueryHandler : IRequestHandler<Query, Model[]> public class QueryHandler : IRequestHandler<Query, Model[]>
{ {
private readonly IAgentRepository _repository; private readonly INetworkRepository _repository;
private readonly IMapper _mapper; private readonly IMapper _mapper;
public QueryHandler(IAgentRepository repository, IMapper mapper) public QueryHandler(INetworkRepository repository, IMapper mapper)
{ {
_repository = repository; _repository = repository;
_mapper = mapper; _mapper = mapper;

View File

@ -4,11 +4,11 @@ using NetworkResurrector.Api.Domain.Entities;
namespace NetworkResurrector.Api.Domain.Data.DbContexts namespace NetworkResurrector.Api.Domain.Data.DbContexts
{ {
public class AgentDbContext : DbContext public class NetworkDbContext : DbContext
{ {
public DbSet<Machine> Machines { get; set; } public DbSet<Machine> Machines { get; set; }
public AgentDbContext(DbContextOptions<AgentDbContext> options) public NetworkDbContext(DbContextOptions<NetworkDbContext> options)
: base(options) : base(options)
{ {
base.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.TrackAll; base.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.TrackAll;

View File

@ -11,10 +11,10 @@ namespace NetworkResurrector.Api.Domain.Data
{ {
public static void AddDataAccess(this IServiceCollection services) public static void AddDataAccess(this IServiceCollection services)
{ {
services.AddScoped<IAgentRepository, AgentRepository>(); services.AddScoped<INetworkRepository, NetworkRepository>();
services services
.AddDbContextPool<AgentDbContext>( .AddDbContextPool<NetworkDbContext>(
(serviceProvider, options) => (serviceProvider, options) =>
{ {
var configuration = serviceProvider.GetService<IConfiguration>(); var configuration = serviceProvider.GetService<IConfiguration>();

View File

@ -6,11 +6,11 @@ using System.Threading.Tasks;
namespace NetworkResurrector.Api.Domain.Data.Repositories namespace NetworkResurrector.Api.Domain.Data.Repositories
{ {
class AgentRepository : IAgentRepository class NetworkRepository : INetworkRepository
{ {
private readonly AgentDbContext _dbContext; private readonly NetworkDbContext _dbContext;
public AgentRepository(AgentDbContext dbContext) public NetworkRepository(NetworkDbContext dbContext)
{ {
_dbContext = dbContext; _dbContext = dbContext;
} }

View File

@ -3,7 +3,7 @@ using System.Threading.Tasks;
namespace NetworkResurrector.Api.Domain.Repositories namespace NetworkResurrector.Api.Domain.Repositories
{ {
public interface IAgentRepository public interface INetworkRepository
{ {
Task<Machine[]> GetMachines(); Task<Machine[]> GetMachines();
} }

View File

@ -6,7 +6,7 @@ Create image:
docker image build -t "network-resurrector-api:1.0.0" -f "src/api/NetworkResurrector.Api/Dockerfile" . docker image build -t "network-resurrector-api:1.0.0" -f "src/api/NetworkResurrector.Api/Dockerfile" .
Run image: Run image:
docker run -p 5053:80 -it network-resurrector-agent:1.0.0 docker run -p 5053:80 -it network-resurrector-api:1.0.0
Push image to registry: Push image to registry:
--tag image --tag image

View File

@ -43,7 +43,7 @@ namespace NetworkResurrector.Api
typeof(Application.Mappings.MappingProfile).Assembly); typeof(Application.Mappings.MappingProfile).Assembly);
// Swagger // Swagger
services.AddSwagger("NetworkResurrectorAgent API"); services.AddSwagger("NetworkResurrector API");
// Data access // Data access
services.AddDataAccess(); services.AddDataAccess();
@ -79,7 +79,7 @@ namespace NetworkResurrector.Api
{ {
endpoints.MapControllers(); endpoints.MapControllers();
}); });
app.ConfigureSwagger("NetworkResurrectorAgent API"); app.ConfigureSwagger("NetworkResurrector API");
} }
} }
} }