diff --git a/Controllers/TodoItemsController.cs b/Controllers/TodoItemsController.cs deleted file mode 100644 index 0ef138e7..00000000 --- a/Controllers/TodoItemsController.cs +++ /dev/null @@ -1,116 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using Microsoft.EntityFrameworkCore; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using TodoApi.Models; - -namespace TodoApi.Controllers -{ - [Route("api/[controller]")] - [ApiController] - public class TodoItemsController : ControllerBase - { - private readonly TodoContext _context; - - public TodoItemsController(TodoContext context) - { - _context = context; - } - - [HttpGet] - public async Task>> GetTodoItems() - { - return await _context.TodoItems - .Select(x => ItemToDTO(x)) - .ToListAsync(); - } - - [HttpGet("{id}")] - public async Task> GetTodoItem(long id) - { - var todoItem = await _context.TodoItems.FindAsync(id); - - if (todoItem == null) - { - return NotFound(); - } - - return ItemToDTO(todoItem); - } - - [HttpPut("{id}")] - public async Task UpdateTodoItem(long id, TodoItemDTO todoItemDTO) - { - if (id != todoItemDTO.Id) - { - return BadRequest(); - } - - var todoItem = await _context.TodoItems.FindAsync(id); - if (todoItem == null) - { - return NotFound(); - } - - todoItem.Name = todoItemDTO.Name; - todoItem.IsComplete = todoItemDTO.IsComplete; - - try - { - await _context.SaveChangesAsync(); - } - catch (DbUpdateConcurrencyException) when (!TodoItemExists(id)) - { - return NotFound(); - } - - return NoContent(); - } - - [HttpPost] - public async Task> CreateTodoItem(TodoItemDTO todoItemDTO) - { - var todoItem = new TodoItem - { - IsComplete = todoItemDTO.IsComplete, - Name = todoItemDTO.Name - }; - - _context.TodoItems.Add(todoItem); - await _context.SaveChangesAsync(); - - return CreatedAtAction( - nameof(GetTodoItem), - new { id = todoItem.Id }, - ItemToDTO(todoItem)); - } - - [HttpDelete("{id}")] - public async Task DeleteTodoItem(long id) - { - var todoItem = await _context.TodoItems.FindAsync(id); - - if (todoItem == null) - { - return NotFound(); - } - - _context.TodoItems.Remove(todoItem); - await _context.SaveChangesAsync(); - - return NoContent(); - } - - private bool TodoItemExists(long id) => - _context.TodoItems.Any(e => e.Id == id); - - private static TodoItemDTO ItemToDTO(TodoItem todoItem) => - new TodoItemDTO - { - Id = todoItem.Id, - Name = todoItem.Name, - IsComplete = todoItem.IsComplete - }; - } -} diff --git a/Models/TodoContext.cs b/Models/TodoContext.cs deleted file mode 100644 index 6e59e363..00000000 --- a/Models/TodoContext.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Microsoft.EntityFrameworkCore; - -namespace TodoApi.Models -{ - public class TodoContext : DbContext - { - public TodoContext(DbContextOptions options) - : base(options) - { - } - - public DbSet TodoItems { get; set; } - } -} \ No newline at end of file diff --git a/Models/TodoItem.cs b/Models/TodoItem.cs deleted file mode 100644 index 1f6e5465..00000000 --- a/Models/TodoItem.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace TodoApi.Models -{ - #region snippet - public class TodoItem - { - public long Id { get; set; } - public string Name { get; set; } - public bool IsComplete { get; set; } - public string Secret { get; set; } - } - #endregion -} \ No newline at end of file diff --git a/Models/TodoItemDTO.cs b/Models/TodoItemDTO.cs deleted file mode 100644 index e66a500a..00000000 --- a/Models/TodoItemDTO.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace TodoApi.Models -{ - #region snippet - public class TodoItemDTO - { - public long Id { get; set; } - public string Name { get; set; } - public bool IsComplete { get; set; } - } - #endregion -} diff --git a/Startup.cs b/Startup.cs deleted file mode 100644 index bbfbc83d..00000000 --- a/Startup.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.HttpsPolicy; -using Microsoft.AspNetCore.Mvc; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; -using TodoApi.Models; - -namespace TodoApi -{ - public class Startup - { - public Startup(IConfiguration configuration) - { - Configuration = configuration; - } - - public IConfiguration Configuration { get; } - - // This method gets called by the runtime. Use this method to add services to the container. - public void ConfigureServices(IServiceCollection services) - { - services.AddDbContext(opt => - opt.UseInMemoryDatabase("TodoList")); - services.AddControllers(); - } - - // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IWebHostEnvironment env) - { - if (env.IsDevelopment()) - { - app.UseDeveloperExceptionPage(); - } - - app.UseHttpsRedirection(); - - app.UseRouting(); - - app.UseAuthorization(); - - app.UseEndpoints(endpoints => - { - endpoints.MapControllers(); - }); - } - } -} diff --git a/TodoApiDTO.csproj b/TodoApiDTO.csproj deleted file mode 100644 index bba6f6af..00000000 --- a/TodoApiDTO.csproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - netcoreapp3.1 - - - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - - - - - - diff --git a/TodoApiDTO.sln b/TodoApiDTO.sln index e49c182b..509674c8 100644 --- a/TodoApiDTO.sln +++ b/TodoApiDTO.sln @@ -1,9 +1,25 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30002.166 +# Visual Studio Version 17 +VisualStudioVersion = 17.4.33213.308 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TodoApiDTO", "TodoApiDTO.csproj", "{623124F9-F5BA-42DD-BC26-A1720774229C}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Presentation", "Presentation", "{5F0AEB46-A852-4C75-8765-3E5D36045F0C}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Infrastructure", "Infrastructure", "{7E8A8B9C-B0CB-4E28-B97E-54DB6FB40495}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{9333A81E-2389-45B4-8A05-29B9CECC5CD4}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TodoApiDto.Application", "TodoApiDto.Application\TodoApiDto.Application.csproj", "{6D9A364C-C043-4A1E-A7BF-D58B09548FF0}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TodoApiDto.Domain", "TodoApiDto.Domain\TodoApiDto.Domain.csproj", "{8544BF36-DA7C-4983-89F8-51284F26B6A5}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TodoApiDto.Persistance", "TodoApiDto.Persistance\TodoApiDto.Persistance.csproj", "{AEB8086C-BEDF-4305-A3E0-FC4C49FF09EF}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TodoApiDTO", "VelvetechTestTask\TodoApiDTO.csproj", "{F6AD0A7D-D9A5-496A-892F-9E2BDDCECE8F}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Seeds", "Seeds", "{3B0F7B62-35CA-413B-8199-C2BA068458D9}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TodoApiDTO.DbSeeds", "..\work\projects\myvbc-api\MyVBC\TodoApiDTO.DbSeeds\TodoApiDTO.DbSeeds.csproj", "{82E35239-4204-40F5-A325-666E8BB0A0EE}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -11,14 +27,37 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {623124F9-F5BA-42DD-BC26-A1720774229C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {623124F9-F5BA-42DD-BC26-A1720774229C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {623124F9-F5BA-42DD-BC26-A1720774229C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {623124F9-F5BA-42DD-BC26-A1720774229C}.Release|Any CPU.Build.0 = Release|Any CPU + {6D9A364C-C043-4A1E-A7BF-D58B09548FF0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6D9A364C-C043-4A1E-A7BF-D58B09548FF0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6D9A364C-C043-4A1E-A7BF-D58B09548FF0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6D9A364C-C043-4A1E-A7BF-D58B09548FF0}.Release|Any CPU.Build.0 = Release|Any CPU + {8544BF36-DA7C-4983-89F8-51284F26B6A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8544BF36-DA7C-4983-89F8-51284F26B6A5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8544BF36-DA7C-4983-89F8-51284F26B6A5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8544BF36-DA7C-4983-89F8-51284F26B6A5}.Release|Any CPU.Build.0 = Release|Any CPU + {AEB8086C-BEDF-4305-A3E0-FC4C49FF09EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AEB8086C-BEDF-4305-A3E0-FC4C49FF09EF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AEB8086C-BEDF-4305-A3E0-FC4C49FF09EF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AEB8086C-BEDF-4305-A3E0-FC4C49FF09EF}.Release|Any CPU.Build.0 = Release|Any CPU + {F6AD0A7D-D9A5-496A-892F-9E2BDDCECE8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F6AD0A7D-D9A5-496A-892F-9E2BDDCECE8F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F6AD0A7D-D9A5-496A-892F-9E2BDDCECE8F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F6AD0A7D-D9A5-496A-892F-9E2BDDCECE8F}.Release|Any CPU.Build.0 = Release|Any CPU + {82E35239-4204-40F5-A325-666E8BB0A0EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {82E35239-4204-40F5-A325-666E8BB0A0EE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {82E35239-4204-40F5-A325-666E8BB0A0EE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {82E35239-4204-40F5-A325-666E8BB0A0EE}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {6D9A364C-C043-4A1E-A7BF-D58B09548FF0} = {9333A81E-2389-45B4-8A05-29B9CECC5CD4} + {8544BF36-DA7C-4983-89F8-51284F26B6A5} = {9333A81E-2389-45B4-8A05-29B9CECC5CD4} + {AEB8086C-BEDF-4305-A3E0-FC4C49FF09EF} = {7E8A8B9C-B0CB-4E28-B97E-54DB6FB40495} + {F6AD0A7D-D9A5-496A-892F-9E2BDDCECE8F} = {5F0AEB46-A852-4C75-8765-3E5D36045F0C} + {82E35239-4204-40F5-A325-666E8BB0A0EE} = {3B0F7B62-35CA-413B-8199-C2BA068458D9} + EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {60984BC9-01D1-4B40-9733-E459B1231F96} EndGlobalSection diff --git a/TodoApiDto.Application/Common/MappingProfile.cs b/TodoApiDto.Application/Common/MappingProfile.cs new file mode 100644 index 00000000..ad0f3873 --- /dev/null +++ b/TodoApiDto.Application/Common/MappingProfile.cs @@ -0,0 +1,16 @@ +using AutoMapper; +using TodoApiDto.Application.Implementations.Command.CreateToDoItem; +using TodoApiDto.Application.Implementations.Command.UpdateToDoItem; +using TodoApiDto.Domain.Entities; + +namespace TodoApiDto.Application.Common +{ + public class MappingProfile : Profile + { + public MappingProfile() + { + CreateMap(); + CreateMap(); + } + } +} diff --git a/TodoApiDto.Application/Implementations/Command/CreateToDoItem/CreateTodoItemCommand.cs b/TodoApiDto.Application/Implementations/Command/CreateToDoItem/CreateTodoItemCommand.cs new file mode 100644 index 00000000..81e0ef4b --- /dev/null +++ b/TodoApiDto.Application/Implementations/Command/CreateToDoItem/CreateTodoItemCommand.cs @@ -0,0 +1,27 @@ +using AutoMapper; +using MediatR; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Runtime; +using System.Text; +using TodoApiDto.Application.Common; +using TodoApiDto.Domain.Entities; + +namespace TodoApiDto.Application.Implementations.Command.CreateToDoItem +{ + public class CreateTodoItemCommand: IRequest + { + [JsonProperty("id")] + public Guid Id { get; set; } + + [JsonProperty("name")] + public string Name { get; set; } + + [JsonProperty("isComplete")] + public bool IsComplete { get; set; } + + [JsonProperty("secret")] + public string Secret { get; set; } + } +} diff --git a/TodoApiDto.Application/Implementations/Command/CreateToDoItem/CreateTodoItemCommandHandler.cs b/TodoApiDto.Application/Implementations/Command/CreateToDoItem/CreateTodoItemCommandHandler.cs new file mode 100644 index 00000000..062ba2af --- /dev/null +++ b/TodoApiDto.Application/Implementations/Command/CreateToDoItem/CreateTodoItemCommandHandler.cs @@ -0,0 +1,40 @@ +using AutoMapper; +using MediatR; +using Microsoft.Extensions.Logging; +using System; +using System.Threading; +using System.Threading.Tasks; +using TodoApiDto.Application.Interfaces; +using TodoApiDto.Domain.Entities; + +namespace TodoApiDto.Application.Implementations.Command.CreateToDoItem +{ + public class CreateTodoItemCommandHandler: IRequestHandler + { + private readonly IMapper _mapper; + private readonly ITodoApiDtoDbContext _context; + private readonly ILogger _logger; + public CreateTodoItemCommandHandler(IMapper mapper, ITodoApiDtoDbContext context, + ILogger logger) + { + _mapper = mapper; + _context = context; + _logger = logger; + } + public async Task Handle(CreateTodoItemCommand request, CancellationToken cancellationToken) + { + var item = _mapper.Map(request); + try + { + await _context.Items.AddAsync(item); + await _context.SaveChangesAsync(cancellationToken); + _logger.LogInformation($"Item added to database."); + } + catch(Exception ex) + { + _logger.LogError($"Error creating element: {ex.Message}"); + } + return item.Id; + } + } +} \ No newline at end of file diff --git a/TodoApiDto.Application/Implementations/Command/DeleteTodoItem/DeleteTodoItemCommand.cs b/TodoApiDto.Application/Implementations/Command/DeleteTodoItem/DeleteTodoItemCommand.cs new file mode 100644 index 00000000..c42e17a2 --- /dev/null +++ b/TodoApiDto.Application/Implementations/Command/DeleteTodoItem/DeleteTodoItemCommand.cs @@ -0,0 +1,17 @@ +using MediatR; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Text; + +namespace TodoApiDto.Application.Implementations.Command.DeleteTodoItem +{ + public class DeleteTodoItemCommand: IRequest + { + public Guid Id { get; set; } + public DeleteTodoItemCommand(Guid id) + { + this.Id = id; + } + } +} diff --git a/TodoApiDto.Application/Implementations/Command/DeleteTodoItem/DeleteTodoItemCommandHandler.cs b/TodoApiDto.Application/Implementations/Command/DeleteTodoItem/DeleteTodoItemCommandHandler.cs new file mode 100644 index 00000000..bb398db2 --- /dev/null +++ b/TodoApiDto.Application/Implementations/Command/DeleteTodoItem/DeleteTodoItemCommandHandler.cs @@ -0,0 +1,50 @@ +using MediatR; +using System.Threading.Tasks; +using System.Threading; +using TodoApiDto.Application.Interfaces; +using System.Linq; +using System.Net.Http; +using System.Net; +using System.Web.Http; +using Microsoft.Extensions.Logging; +using System; + +namespace TodoApiDto.Application.Implementations.Command.DeleteTodoItem +{ + public class DeleteTodoItemCommandHandler: IRequestHandler + { + private readonly ITodoApiDtoDbContext _context; + private readonly ILogger _logger; + + public DeleteTodoItemCommandHandler(ITodoApiDtoDbContext context, ILogger logger) + { + _context = context; + _logger = logger; + } + public async Task Handle(DeleteTodoItemCommand request, CancellationToken cancellationToken) + { + var item = _context.Items.Where(x => x.Id == request.Id); + if(item == null) + { + _logger.LogWarning($"Element with this id: {request.Id} does not exist"); + var responseContent = new HttpResponseMessage(HttpStatusCode.BadRequest) + { + Content = new StringContent($"There is no item with this {request.Id}") + }; + throw new HttpResponseException(responseContent); + } + try + { + _context.Items.RemoveRange(item); + await _context.SaveChangesAsync(cancellationToken); + _logger.LogInformation($"element with id : {request.Id} was removed"); + } + catch(Exception ex) + { + _logger.LogInformation($"Error when deleting element with id : {request.Id} : {ex.Message}"); + } + + return Unit.Value; + } + } +} \ No newline at end of file diff --git a/TodoApiDto.Application/Implementations/Command/UpdateToDoItem/UpdateToDoItemCommand.cs b/TodoApiDto.Application/Implementations/Command/UpdateToDoItem/UpdateToDoItemCommand.cs new file mode 100644 index 00000000..2e7887c9 --- /dev/null +++ b/TodoApiDto.Application/Implementations/Command/UpdateToDoItem/UpdateToDoItemCommand.cs @@ -0,0 +1,21 @@ +using MediatR; +using Newtonsoft.Json; +using System; + +namespace TodoApiDto.Application.Implementations.Command.UpdateToDoItem +{ + public class UpdateToDoItemCommand: IRequest + { + [JsonIgnore] + public Guid Id { get; set; } + + [JsonProperty("name")] + public string Name { get; set; } + + [JsonProperty("isComplete")] + public bool IsComplete { get; set; } + + [JsonProperty("secret")] + public string Secret { get; set; } + } +} diff --git a/TodoApiDto.Application/Implementations/Command/UpdateToDoItem/UpdateToDoItemCommandHandler.cs b/TodoApiDto.Application/Implementations/Command/UpdateToDoItem/UpdateToDoItemCommandHandler.cs new file mode 100644 index 00000000..6b67d227 --- /dev/null +++ b/TodoApiDto.Application/Implementations/Command/UpdateToDoItem/UpdateToDoItemCommandHandler.cs @@ -0,0 +1,45 @@ +using AutoMapper; +using MediatR; +using System.Threading.Tasks; +using System.Threading; +using TodoApiDto.Application.Interfaces; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; +using System; + +namespace TodoApiDto.Application.Implementations.Command.UpdateToDoItem +{ + public class UpdateToDoItemCommandHandler : IRequestHandler + { + private readonly IMapper _mapper; + private readonly ITodoApiDtoDbContext _context; + private readonly ILogger _logger; + + public UpdateToDoItemCommandHandler(IMapper mapper, ITodoApiDtoDbContext context, + ILogger logger) + { + _mapper = mapper; + _context = context; + _logger = logger; + } + public async Task Handle(UpdateToDoItemCommand request, CancellationToken cancellationToken) + { + var item = await _context.Items.FirstOrDefaultAsync(x => x.Id == request.Id); + if(item != null) + { + try + { + _mapper.Map(request, item); + await _context.SaveChangesAsync(cancellationToken); + + _logger.LogInformation($"Element with id : {request.Id} updated"); + } + catch(Exception ex) + { + _logger.LogError($"Error updating element with id:{request.Id}: {ex.Message}"); + } + } + return Unit.Value; + } + } +} \ No newline at end of file diff --git a/TodoApiDto.Application/Implementations/Queries/GetToDoItem/GetToDoItemQuery.cs b/TodoApiDto.Application/Implementations/Queries/GetToDoItem/GetToDoItemQuery.cs new file mode 100644 index 00000000..ac3a29f9 --- /dev/null +++ b/TodoApiDto.Application/Implementations/Queries/GetToDoItem/GetToDoItemQuery.cs @@ -0,0 +1,17 @@ +using MediatR; +using System; +using System.Collections.Generic; +using System.Text; +using TodoApiDto.Domain.Entities; + +namespace TodoApiDto.Application.Implementations.Queries.GetToItem +{ + public class GetToDoItemQuery: IRequest + { + public Guid Id { get; set; } + public GetToDoItemQuery(Guid id) + { + this.Id = id; + } + } +} diff --git a/TodoApiDto.Application/Implementations/Queries/GetToDoItem/GetToDoItemQueryHandler.cs b/TodoApiDto.Application/Implementations/Queries/GetToDoItem/GetToDoItemQueryHandler.cs new file mode 100644 index 00000000..8d6ef8c6 --- /dev/null +++ b/TodoApiDto.Application/Implementations/Queries/GetToDoItem/GetToDoItemQueryHandler.cs @@ -0,0 +1,40 @@ +using MediatR; +using System.Threading.Tasks; +using System.Threading; +using TodoApiDto.Application.Interfaces; +using Microsoft.EntityFrameworkCore; +using System.Net; +using System.Web.Http; +using System.Net.Http; +using TodoApiDto.Domain.Entities; +using Microsoft.Extensions.Logging; + +namespace TodoApiDto.Application.Implementations.Queries.GetToItem +{ + public class GetToDoItemQueryHandler: IRequestHandler + { + private readonly ITodoApiDtoDbContext _context; + private readonly ILogger _logger; + public GetToDoItemQueryHandler(ITodoApiDtoDbContext context, ILogger logger) + { + _context = context; + _logger = logger; + } + + public async Task Handle(GetToDoItemQuery request, CancellationToken cancellationToken) + { + var item = await _context.Items.FirstOrDefaultAsync(x => x.Id == request.Id); + if (item == null) + { + _logger.LogWarning($"Element with this id: {request.Id} does not exist"); + + var responseContent = new HttpResponseMessage(HttpStatusCode.BadRequest) + { + Content = new StringContent($"There is no item with this {request.Id}") + }; + throw new HttpResponseException(responseContent); + } + return item; + } + } +} diff --git a/TodoApiDto.Application/Implementations/Queries/GetToDoItems/GetToDoItemsQuery.cs b/TodoApiDto.Application/Implementations/Queries/GetToDoItems/GetToDoItemsQuery.cs new file mode 100644 index 00000000..19a38758 --- /dev/null +++ b/TodoApiDto.Application/Implementations/Queries/GetToDoItems/GetToDoItemsQuery.cs @@ -0,0 +1,10 @@ +using MediatR; +using System.Collections.Generic; +using TodoApiDto.Domain.Entities; + +namespace TodoApiDto.Application.Implementations.Queries.GetItems +{ + public class GetToDoItemsQuery : IRequest> + { + } +} \ No newline at end of file diff --git a/TodoApiDto.Application/Implementations/Queries/GetToDoItems/GetToDoItemsQueryHandler.cs b/TodoApiDto.Application/Implementations/Queries/GetToDoItems/GetToDoItemsQueryHandler.cs new file mode 100644 index 00000000..624a9732 --- /dev/null +++ b/TodoApiDto.Application/Implementations/Queries/GetToDoItems/GetToDoItemsQueryHandler.cs @@ -0,0 +1,27 @@ +using AutoMapper; +using MediatR; +using System.Collections.Generic; +using System.Threading.Tasks; +using System.Threading; +using TodoApiDto.Application.Interfaces; +using AutoMapper.QueryableExtensions; +using Microsoft.EntityFrameworkCore; +using TodoApiDto.Domain.Entities; + +namespace TodoApiDto.Application.Implementations.Queries.GetItems +{ + public class GetToDoItemsQueryHandler: IRequestHandler> + { + private readonly ITodoApiDtoDbContext _context; + public GetToDoItemsQueryHandler(IMapper mapper, ITodoApiDtoDbContext context) + { + _context = context; + } + + public async Task> Handle(GetToDoItemsQuery request, CancellationToken cancellationToken) + { + var items = await _context.Items.ToListAsync(); + return items; + } + } +} diff --git a/TodoApiDto.Application/Interfaces/ITodoApiDtoDbContext.cs b/TodoApiDto.Application/Interfaces/ITodoApiDtoDbContext.cs new file mode 100644 index 00000000..c9de9bd2 --- /dev/null +++ b/TodoApiDto.Application/Interfaces/ITodoApiDtoDbContext.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using System.Threading; +using TodoApiDto.Domain.Entities; +using Microsoft.EntityFrameworkCore; + +namespace TodoApiDto.Application.Interfaces +{ + public interface ITodoApiDtoDbContext + { + DbSet Items { get; set; } + Task SaveChangesAsync(CancellationToken cancellationToken = default); + } +} diff --git a/TodoApiDto.Application/TodoApiDto.Application.csproj b/TodoApiDto.Application/TodoApiDto.Application.csproj new file mode 100644 index 00000000..211e5746 --- /dev/null +++ b/TodoApiDto.Application/TodoApiDto.Application.csproj @@ -0,0 +1,20 @@ + + + + netcoreapp3.1 + + + + + + + + + + + + + + + + diff --git a/TodoApiDto.Domain/Entities/TodoItem.cs b/TodoApiDto.Domain/Entities/TodoItem.cs new file mode 100644 index 00000000..0ff42ea9 --- /dev/null +++ b/TodoApiDto.Domain/Entities/TodoItem.cs @@ -0,0 +1,13 @@ +using System; +using TodoApiDto.Domain.Interfaces; + +namespace TodoApiDto.Domain.Entities +{ + public class TodoItem: IEntity + { + public Guid Id { get; set; } + public string Name { get; set; } + public bool IsComplete { get; set; } + public string Secret { get; set; } + } +} diff --git a/TodoApiDto.Domain/Interfaces/IEntity.cs b/TodoApiDto.Domain/Interfaces/IEntity.cs new file mode 100644 index 00000000..5fc3bee5 --- /dev/null +++ b/TodoApiDto.Domain/Interfaces/IEntity.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace TodoApiDto.Domain.Interfaces +{ + public interface IEntity + { + Guid Id + { + get; set; + } + } +} diff --git a/TodoApiDto.Domain/TodoApiDto.Domain.csproj b/TodoApiDto.Domain/TodoApiDto.Domain.csproj new file mode 100644 index 00000000..c531b6cf --- /dev/null +++ b/TodoApiDto.Domain/TodoApiDto.Domain.csproj @@ -0,0 +1,12 @@ + + + + netcoreapp3.1 + + + + + + + + diff --git a/TodoApiDto.Persistance/EntityTypeBuilderExtensions.cs b/TodoApiDto.Persistance/EntityTypeBuilderExtensions.cs new file mode 100644 index 00000000..cd5fb80e --- /dev/null +++ b/TodoApiDto.Persistance/EntityTypeBuilderExtensions.cs @@ -0,0 +1,22 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using TodoApiDto.Domain.Interfaces; + +namespace TodoApiDto.Persistance +{ + internal static class EntityTypeBuilderExtensions + { + public static EntityTypeBuilder MapBase(this EntityTypeBuilder builder, string tableName, string? schemaName = null) + where TEntity : class, IEntity + { + builder.ToTable(tableName, schemaName); + + builder.HasKey(x => x.Id); + builder.Property(x => x.Id) + .ValueGeneratedOnAdd() + .HasDefaultValueSql("newsequentialid()"); + + return builder; + } + } +} diff --git a/TodoApiDto.Persistance/ItemConfiguration.cs b/TodoApiDto.Persistance/ItemConfiguration.cs new file mode 100644 index 00000000..48102d04 --- /dev/null +++ b/TodoApiDto.Persistance/ItemConfiguration.cs @@ -0,0 +1,14 @@ +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Microsoft.EntityFrameworkCore; +using TodoApiDto.Domain.Entities; + +namespace TodoApiDto.Persistance +{ + public class ItemConfiguration : IEntityTypeConfiguration + { + public void Configure(EntityTypeBuilder builder) + { + builder.MapBase("Items"); + } + } +} diff --git a/TodoApiDto.Persistance/Migrations/20230529224305_initDb.Designer.cs b/TodoApiDto.Persistance/Migrations/20230529224305_initDb.Designer.cs new file mode 100644 index 00000000..feed48fd --- /dev/null +++ b/TodoApiDto.Persistance/Migrations/20230529224305_initDb.Designer.cs @@ -0,0 +1,46 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using TodoApiDto.Persistance; + +namespace TodoApiDto.Persistance.Migrations +{ + [DbContext(typeof(TodoApiDtoDbContext))] + [Migration("20230529224305_initDb")] + partial class initDb + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "3.1.0") + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("TodoApiDto.Domain.Entities.TodoItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("IsComplete") + .HasColumnType("bit"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("Secret") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Items"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/TodoApiDto.Persistance/Migrations/20230529224305_initDb.cs b/TodoApiDto.Persistance/Migrations/20230529224305_initDb.cs new file mode 100644 index 00000000..af34a32f --- /dev/null +++ b/TodoApiDto.Persistance/Migrations/20230529224305_initDb.cs @@ -0,0 +1,31 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace TodoApiDto.Persistance.Migrations +{ + public partial class initDb : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Items", + columns: table => new + { + Id = table.Column(nullable: false), + Name = table.Column(nullable: true), + IsComplete = table.Column(nullable: false), + Secret = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Items", x => x.Id); + }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Items"); + } + } +} diff --git a/TodoApiDto.Persistance/Migrations/TodoApiDtoDbContextModelSnapshot.cs b/TodoApiDto.Persistance/Migrations/TodoApiDtoDbContextModelSnapshot.cs new file mode 100644 index 00000000..293f00d1 --- /dev/null +++ b/TodoApiDto.Persistance/Migrations/TodoApiDtoDbContextModelSnapshot.cs @@ -0,0 +1,44 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using TodoApiDto.Persistance; + +namespace TodoApiDto.Persistance.Migrations +{ + [DbContext(typeof(TodoApiDtoDbContext))] + partial class TodoApiDtoDbContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "3.1.0") + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("TodoApiDto.Domain.Entities.TodoItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("IsComplete") + .HasColumnType("bit"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("Secret") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Items"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/TodoApiDto.Persistance/TodoApiDto.Persistance.csproj b/TodoApiDto.Persistance/TodoApiDto.Persistance.csproj new file mode 100644 index 00000000..8e291aaa --- /dev/null +++ b/TodoApiDto.Persistance/TodoApiDto.Persistance.csproj @@ -0,0 +1,19 @@ + + + + netcoreapp3.1 + + + + + + + + + + + + + + + diff --git a/TodoApiDto.Persistance/TodoApiDtoDbContext.cs b/TodoApiDto.Persistance/TodoApiDtoDbContext.cs new file mode 100644 index 00000000..6404bd1e --- /dev/null +++ b/TodoApiDto.Persistance/TodoApiDtoDbContext.cs @@ -0,0 +1,22 @@ +using Microsoft.EntityFrameworkCore; +using System.Threading.Tasks; +using System.Threading; +using TodoApiDto.Application.Interfaces; +using TodoApiDto.Domain.Entities; + +namespace TodoApiDto.Persistance +{ + public class TodoApiDtoDbContext: DbContext, ITodoApiDtoDbContext + { + public TodoApiDtoDbContext(DbContextOptions options) : base(options) + { + } + + public DbSet Items { get; set; } + + public Task SaveChangesAsync(CancellationToken cancellationToken = default) + { + return base.SaveChangesAsync(cancellationToken); + } + } +} diff --git a/TodoItem.Domain/TodoItem.Domain.csproj b/TodoItem.Domain/TodoItem.Domain.csproj new file mode 100644 index 00000000..cb631906 --- /dev/null +++ b/TodoItem.Domain/TodoItem.Domain.csproj @@ -0,0 +1,7 @@ + + + + netcoreapp3.1 + + + diff --git a/VelvetechTestTask/Controllers/TodoItemsController.cs b/VelvetechTestTask/Controllers/TodoItemsController.cs new file mode 100644 index 00000000..c1dedcf8 --- /dev/null +++ b/VelvetechTestTask/Controllers/TodoItemsController.cs @@ -0,0 +1,92 @@ +using MediatR; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using System; +using System.Threading.Tasks; +using TodoApiDto.Application.Implementations.Command.CreateToDoItem; +using TodoApiDto.Application.Implementations.Command.DeleteTodoItem; +using TodoApiDto.Application.Implementations.Command.UpdateToDoItem; +using TodoApiDto.Application.Implementations.Queries.GetItems; +using TodoApiDto.Application.Implementations.Queries.GetToItem; + +namespace TodoApi.Controllers +{ + [Route("testapi")] + public class TodoItemsController : ControllerBase + { + private readonly ILogger _logger; + private readonly IMediator _mediator; + + public TodoItemsController(ILogger logger, IMediator mediator) + { + _logger = logger; + _mediator = mediator; + } + + /// + /// Gets item list + /// + /// Items + + [HttpGet("items")] + public async Task GetTodoItems() + { + var result = await _mediator.Send(new GetToDoItemsQuery()); + return Ok(result); + } + + /// + /// Gets item + /// + /// Item id + /// Item details + + [HttpGet("{id}")] + public async Task GetTodoItem([FromRoute] Guid id) + { + var result = await _mediator.Send(new GetToDoItemQuery(id)); + return Ok(result); + } + + /// + /// Updates item + /// + /// Item id + /// + /// + + [HttpPut("{id}")] + public async Task UpdateTodoItem([FromRoute] Guid id,[FromBody] UpdateToDoItemCommand command) + { + command.Id = id; + await _mediator.Send(command); + return Ok(); + } + + /// + /// Creates item + /// + /// + /// + + [HttpPost] + public async Task CreateTodoItem([FromBody] CreateTodoItemCommand command) + { + var result = await _mediator.Send(command); + return Ok(new { id = result}); + } + + /// + /// Deletes item + /// + /// + /// Empty result + + [HttpDelete("{id}")] + public async Task DeleteTodoItem([FromRoute] Guid id) + { + await _mediator.Send(new DeleteTodoItemCommand(id)); + return Ok(); + } + } +} diff --git a/VelvetechTestTask/Extensions/SeedDataBaseApp.cs b/VelvetechTestTask/Extensions/SeedDataBaseApp.cs new file mode 100644 index 00000000..19be362e --- /dev/null +++ b/VelvetechTestTask/Extensions/SeedDataBaseApp.cs @@ -0,0 +1,33 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using TodoApiDto.Application.Interfaces; +using TodoApiDto.Persistance; +using TodoApiDTO.DbSeeds; + +namespace TodoApiDTO.Extensions +{ + public static class SeedDataBaseApp + { + internal static IHost SeedDataBase(this IHost host) + { + using var scope = host.Services.CreateScope(); + + var services = scope.ServiceProvider; + + var context = services.GetRequiredService() as TodoApiDtoDbContext; + + if (context.Database.IsSqlServer()) + { + context.Database.Migrate(); + } + + var configuration = services.GetRequiredService(); + + TodoApiDbContextSeeds.SeedSampleDataAsync(context, configuration).Wait(); + + return host; + } + } +} diff --git a/Program.cs b/VelvetechTestTask/Program.cs similarity index 67% rename from Program.cs rename to VelvetechTestTask/Program.cs index b27ac16a..6684c0aa 100644 --- a/Program.cs +++ b/VelvetechTestTask/Program.cs @@ -1,11 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; +using TodoApiDTO.Extensions; namespace TodoApi { @@ -13,7 +8,8 @@ public class Program { public static void Main(string[] args) { - CreateHostBuilder(args).Build().Run(); + var host = CreateHostBuilder(args).Build().SeedDataBase(); + host.Run(); } public static IHostBuilder CreateHostBuilder(string[] args) => diff --git a/Properties/launchSettings.json b/VelvetechTestTask/Properties/launchSettings.json similarity index 55% rename from Properties/launchSettings.json rename to VelvetechTestTask/Properties/launchSettings.json index 6766196a..bce706cc 100644 --- a/Properties/launchSettings.json +++ b/VelvetechTestTask/Properties/launchSettings.json @@ -3,11 +3,21 @@ "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { - "applicationUrl": "http://localhost:56416/", + "applicationUrl": "http://localhost:56416", "sslPort": 44331 } }, "profiles": { + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "https://localhost:5000", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, "IIS Express": { "commandName": "IISExpress", "launchBrowser": true, @@ -21,7 +31,8 @@ "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" }, - "applicationUrl": "https://localhost:5001;http://localhost:5000" + "applicationUrl": "https://localhost:5001", + "launchUrl": "swagger" } } } \ No newline at end of file diff --git a/VelvetechTestTask/Startup.cs b/VelvetechTestTask/Startup.cs new file mode 100644 index 00000000..2401831e --- /dev/null +++ b/VelvetechTestTask/Startup.cs @@ -0,0 +1,97 @@ +using System; +using System.Collections.Generic; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; +using MediatR; +using TodoApiDto.Application.Interfaces; +using TodoApiDto.Persistance; +using TodoApiDto.Application.Implementations.Command.CreateToDoItem; +using TodoApiDto.Application.Implementations.Queries.GetToItem; +using AutoMapper; +using TodoApiDto.Application.Common; +using TodoApiDto.Application.Implementations.Command.UpdateToDoItem; +using TodoApiDto.Application.Implementations.Command.DeleteTodoItem; +using TodoApiDto.Domain.Entities; +using TodoApiDto.Application.Implementations.Queries.GetItems; + +namespace TodoApi +{ + public class Startup + { + public Startup(IConfiguration configuration) + { + Configuration = configuration; + } + + public IConfiguration Configuration { get; } + + public void ConfigureServices(IServiceCollection services) + { + services.AddAutoMapper(typeof(Startup)); + MapperConfiguration mapperConfig = new MapperConfiguration(mc => + { + mc.AddProfile(new MappingProfile()); + }); + IMapper mapper = mapperConfig.CreateMapper(); + services.AddSingleton(mapper); + + services.AddMediatR(typeof(Startup).Assembly); + + services.AddEntityFrameworkSqlServer(); + services.AddDbContextPool(builder => + { + builder.EnableDetailedErrors(true); + + builder.UseSqlServer(Configuration.GetConnectionString("DbConnectionString"), b => + { + b.MigrationsAssembly(typeof(TodoApiDtoDbContext).Assembly.FullName); + b.EnableRetryOnFailure(5, TimeSpan.FromSeconds(10), null); + }); + }, int.TryParse(Configuration["DbContextPoolSize"], out var poolSize) ? poolSize : 128); + + services.AddLogging(loggingBuilder => + { + loggingBuilder.AddFile(Configuration["FilePath"]); + }); + + services.AddTransient, CreateTodoItemCommandHandler>(); + services.AddTransient, GetToDoItemQueryHandler>(); + services.AddTransient, UpdateToDoItemCommandHandler>(); + services.AddTransient, DeleteTodoItemCommandHandler>(); + services.AddTransient, GetToDoItemQueryHandler>(); + services.AddTransient>, GetToDoItemsQueryHandler>(); + + services.AddSwaggerGen(); + services.AddControllers(); + } + + public void Configure(IApplicationBuilder app, IWebHostEnvironment env) + { + if (env.IsDevelopment()) + { + app.UseDeveloperExceptionPage(); + } + app.UseSwagger(); + app.UseSwaggerUI(); + + app.UseHttpsRedirection(); + + app.UseRouting(); + + app.UseAuthentication(); + app.UseAuthorization(); + + app.UseRouting(); + + app.UseEndpoints(endpoints => + { + endpoints.MapControllers(); + }); + } + } +} diff --git a/VelvetechTestTask/TodoApiDTO.csproj b/VelvetechTestTask/TodoApiDTO.csproj new file mode 100644 index 00000000..53f33d1b --- /dev/null +++ b/VelvetechTestTask/TodoApiDTO.csproj @@ -0,0 +1,36 @@ + + + + netcoreapp3.1 + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + + + + + + diff --git a/appsettings.Development.json b/VelvetechTestTask/appsettings.Development.json similarity index 100% rename from appsettings.Development.json rename to VelvetechTestTask/appsettings.Development.json diff --git a/appsettings.json b/VelvetechTestTask/appsettings.json similarity index 51% rename from appsettings.json rename to VelvetechTestTask/appsettings.json index d9d9a9bf..9a2c6431 100644 --- a/appsettings.json +++ b/VelvetechTestTask/appsettings.json @@ -6,5 +6,9 @@ "Microsoft.Hosting.Lifetime": "Information" } }, + "ConnectionStrings": { + "DbConnectionString": "Data Source=(local);Initial Catalog=TodoApiDto;Integrated Security=True; Encrypt=False" + }, + "FilePath": "..//log.txt", "AllowedHosts": "*" } diff --git a/log-20230530.txt b/log-20230530.txt new file mode 100644 index 00000000..3e12e133 --- /dev/null +++ b/log-20230530.txt @@ -0,0 +1,196 @@ +2023-05-30T00:39:24.2383680+02:00 [INF] Entity Framework Core "3.1.0" initialized '"TodoApiDtoDbContext"' using provider '"Microsoft.EntityFrameworkCore.SqlServer"' with options: "DetailedErrorsEnabled MaxPoolSize=128 MigrationsAssembly=TodoApiDto.Persistance, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null " (9958f5bb) +2023-05-30T00:39:35.1056103+02:00 [INF] Executed DbCommand ("144"ms) [Parameters=[""], CommandType='Text', CommandTimeout='60']" +""CREATE DATABASE [TodoApiDto];" (0723d8ff) +2023-05-30T00:39:35.1606278+02:00 [INF] Executed DbCommand ("53"ms) [Parameters=[""], CommandType='Text', CommandTimeout='60']" +""IF SERVERPROPERTY('EngineEdition') <> 5 +BEGIN + ALTER DATABASE [TodoApiDto] SET READ_COMMITTED_SNAPSHOT ON; +END;" (0723d8ff) +2023-05-30T00:39:35.1755819+02:00 [INF] Executed DbCommand ("6"ms) [Parameters=[""], CommandType='Text', CommandTimeout='30']" +""SELECT 1" (0723d8ff) +2023-05-30T00:39:35.2830544+02:00 [INF] Executed DbCommand ("7"ms) [Parameters=[""], CommandType='Text', CommandTimeout='30']" +""CREATE TABLE [__EFMigrationsHistory] ( + [MigrationId] nvarchar(150) NOT NULL, + [ProductVersion] nvarchar(32) NOT NULL, + CONSTRAINT [PK___EFMigrationsHistory] PRIMARY KEY ([MigrationId]) +);" (0723d8ff) +2023-05-30T00:39:35.2853294+02:00 [INF] Executed DbCommand ("0"ms) [Parameters=[""], CommandType='Text', CommandTimeout='30']" +""SELECT 1" (0723d8ff) +2023-05-30T00:39:35.3056832+02:00 [INF] Executed DbCommand ("18"ms) [Parameters=[""], CommandType='Text', CommandTimeout='30']" +""SELECT OBJECT_ID(N'[__EFMigrationsHistory]');" (0723d8ff) +2023-05-30T00:39:35.3105335+02:00 [INF] Executed DbCommand ("2"ms) [Parameters=[""], CommandType='Text', CommandTimeout='30']" +""SELECT [MigrationId], [ProductVersion] +FROM [__EFMigrationsHistory] +ORDER BY [MigrationId];" (0723d8ff) +2023-05-30T00:39:35.3269191+02:00 [INF] No migrations were applied. The database is already up to date. (503cba9d) +2023-05-30T00:39:35.5028824+02:00 [ERR] Failed executing DbCommand ("5"ms) [Parameters=[""], CommandType='Text', CommandTimeout='30']" +""SELECT CASE + WHEN EXISTS ( + SELECT 1 + FROM [Items] AS [i]) THEN CAST(1 AS bit) + ELSE CAST(0 AS bit) +END" (627a98df) +2023-05-30T00:43:05.5244457+02:00 [INF] Entity Framework Core "3.1.0" initialized '"TodoApiDtoDbContext"' using provider '"Microsoft.EntityFrameworkCore.SqlServer"' with options: "DetailedErrorsEnabled MaxPoolSize=128 MigrationsAssembly=TodoApiDto.Persistance, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null " (9958f5bb) +2023-05-30T00:43:17.3848680+02:00 [INF] Entity Framework Core "3.1.0" initialized '"TodoApiDtoDbContext"' using provider '"Microsoft.EntityFrameworkCore.SqlServer"' with options: "DetailedErrorsEnabled MaxPoolSize=128 MigrationsAssembly=TodoApiDto.Persistance, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null " (9958f5bb) +2023-05-30T00:43:17.6480209+02:00 [INF] Executed DbCommand ("17"ms) [Parameters=[""], CommandType='Text', CommandTimeout='30']" +""SELECT 1" (0723d8ff) +2023-05-30T00:43:17.6708776+02:00 [INF] Executed DbCommand ("15"ms) [Parameters=[""], CommandType='Text', CommandTimeout='30']" +""SELECT OBJECT_ID(N'[__EFMigrationsHistory]');" (0723d8ff) +2023-05-30T00:43:17.6740822+02:00 [INF] Executed DbCommand ("1"ms) [Parameters=[""], CommandType='Text', CommandTimeout='30']" +""SELECT 1" (0723d8ff) +2023-05-30T00:43:17.6744961+02:00 [INF] Executed DbCommand ("0"ms) [Parameters=[""], CommandType='Text', CommandTimeout='30']" +""SELECT OBJECT_ID(N'[__EFMigrationsHistory]');" (0723d8ff) +2023-05-30T00:43:17.6919183+02:00 [INF] Executed DbCommand ("1"ms) [Parameters=[""], CommandType='Text', CommandTimeout='30']" +""SELECT [MigrationId], [ProductVersion] +FROM [__EFMigrationsHistory] +ORDER BY [MigrationId];" (0723d8ff) +2023-05-30T00:43:17.7095674+02:00 [INF] Applying migration '"20230529224305_initDb"'. (0e2ac64d) +2023-05-30T00:43:17.7424334+02:00 [INF] Executed DbCommand ("4"ms) [Parameters=[""], CommandType='Text', CommandTimeout='30']" +""CREATE TABLE [Items] ( + [Id] uniqueidentifier NOT NULL, + [Name] nvarchar(max) NULL, + [IsComplete] bit NOT NULL, + [Secret] nvarchar(max) NULL, + CONSTRAINT [PK_Items] PRIMARY KEY ([Id]) +);" (0723d8ff) +2023-05-30T00:43:17.7452213+02:00 [INF] Executed DbCommand ("3"ms) [Parameters=[""], CommandType='Text', CommandTimeout='30']" +""INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion]) +VALUES (N'20230529224305_initDb', N'3.1.0');" (0723d8ff) +2023-05-30T00:43:26.1674216+02:00 [INF] Entity Framework Core "3.1.0" initialized '"TodoApiDtoDbContext"' using provider '"Microsoft.EntityFrameworkCore.SqlServer"' with options: "DetailedErrorsEnabled MaxPoolSize=128 MigrationsAssembly=TodoApiDto.Persistance, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null " (9958f5bb) +2023-05-30T00:43:26.8850394+02:00 [INF] Executed DbCommand ("28"ms) [Parameters=[""], CommandType='Text', CommandTimeout='30']" +""SELECT 1" (0723d8ff) +2023-05-30T00:43:26.9194783+02:00 [INF] Executed DbCommand ("23"ms) [Parameters=[""], CommandType='Text', CommandTimeout='30']" +""SELECT OBJECT_ID(N'[__EFMigrationsHistory]');" (0723d8ff) +2023-05-30T00:43:26.9240078+02:00 [INF] Executed DbCommand ("2"ms) [Parameters=[""], CommandType='Text', CommandTimeout='30']" +""SELECT 1" (0723d8ff) +2023-05-30T00:43:26.9246077+02:00 [INF] Executed DbCommand ("0"ms) [Parameters=[""], CommandType='Text', CommandTimeout='30']" +""SELECT OBJECT_ID(N'[__EFMigrationsHistory]');" (0723d8ff) +2023-05-30T00:43:26.9481353+02:00 [INF] Executed DbCommand ("1"ms) [Parameters=[""], CommandType='Text', CommandTimeout='30']" +""SELECT [MigrationId], [ProductVersion] +FROM [__EFMigrationsHistory] +ORDER BY [MigrationId];" (0723d8ff) +2023-05-30T00:43:26.9742828+02:00 [INF] No migrations were applied. The database is already up to date. (503cba9d) +2023-05-30T00:43:27.1825024+02:00 [INF] Executed DbCommand ("1"ms) [Parameters=[""], CommandType='Text', CommandTimeout='30']" +""SELECT CASE + WHEN EXISTS ( + SELECT 1 + FROM [Items] AS [i]) THEN CAST(1 AS bit) + ELSE CAST(0 AS bit) +END" (0723d8ff) +2023-05-30T00:43:27.4394557+02:00 [INF] Executed DbCommand ("53"ms) [Parameters=["@p0='?' (DbType = Guid), @p1='?' (DbType = Boolean), @p2='?' (Size = 4000), @p3='?' (Size = 4000)"], CommandType='Text', CommandTimeout='30']" +""SET NOCOUNT ON; +INSERT INTO [Items] ([Id], [IsComplete], [Name], [Secret]) +VALUES (@p0, @p1, @p2, @p3);" (0723d8ff) +2023-05-30T00:43:27.4529869+02:00 [INF] Executed DbCommand ("3"ms) [Parameters=["@p0='?' (DbType = Guid), @p1='?' (DbType = Boolean), @p2='?' (Size = 4000), @p3='?' (Size = 4000)"], CommandType='Text', CommandTimeout='30']" +""SET NOCOUNT ON; +INSERT INTO [Items] ([Id], [IsComplete], [Name], [Secret]) +VALUES (@p0, @p1, @p2, @p3);" (0723d8ff) +2023-05-30T00:43:27.7850297+02:00 [INF] Now listening on: "https://localhost:5000" (d826f4b8) +2023-05-30T00:43:27.7873992+02:00 [INF] Application started. Press Ctrl+C to shut down. (dcaefe54) +2023-05-30T00:43:27.7890821+02:00 [INF] Hosting environment: "Development" (c3307c92) +2023-05-30T00:43:27.7911960+02:00 [INF] Content root path: "C:\testVelvetech\VelvetechTestTask" (b5d60022) +2023-05-30T00:43:28.6889586+02:00 0HMR0IOFCJO58:00000001 [INF] Request starting HTTP/2 GET https://localhost:5000/swagger/index.html (ca22a1cb) +2023-05-30T00:43:28.9259679+02:00 0HMR0IOFCJO58:00000003 [INF] Request starting HTTP/2 GET https://localhost:5000/_framework/aspnetcore-browser-refresh.js (ca22a1cb) +2023-05-30T00:43:28.9259685+02:00 0HMR0IOFCJO58:00000005 [INF] Request starting HTTP/2 GET https://localhost:5000/_vs/browserLink (ca22a1cb) +2023-05-30T00:43:28.9300262+02:00 0HMR0IOFCJO58:00000001 [INF] Request finished in 245.9979ms 200 text/html;charset=utf-8 (791a596a) +2023-05-30T00:43:28.9326586+02:00 0HMR0IOFCJO58:00000003 [INF] Request finished in 6.5893ms 200 application/javascript; charset=utf-8 (791a596a) +2023-05-30T00:43:28.9846407+02:00 0HMR0IOFCJO58:00000005 [INF] Request finished in 58.6516ms 200 text/javascript; charset=UTF-8 (791a596a) +2023-05-30T00:43:29.1396844+02:00 0HMR0IOFCJO58:00000007 [INF] Request starting HTTP/2 GET https://localhost:5000/swagger/v1/swagger.json (ca22a1cb) +2023-05-30T00:43:29.3438336+02:00 0HMR0IOFCJO58:00000007 [INF] Request finished in 204.2505ms 200 application/json;charset=utf-8 (791a596a) +2023-05-30T00:43:41.8734530+02:00 0HMR0IOFCJO5A:00000001 [INF] Request starting HTTP/1.1 GET https://localhost:5000/testapi/items (ca22a1cb) +2023-05-30T00:43:41.9067824+02:00 0HMR0IOFCJO5A:00000001 [INF] Executing endpoint '"TodoApi.Controllers.TodoItemsController.GetTodoItems (TodoApiDTO)"' (500cc934) +2023-05-30T00:43:41.9313316+02:00 0HMR0IOFCJO5A:00000001 [INF] Route matched with "{action = \"GetTodoItems\", controller = \"TodoItems\"}". Executing controller action with signature "System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.ActionResult] GetTodoItems()" on controller "TodoApi.Controllers.TodoItemsController" ("TodoApiDTO"). (122b2fdf) +2023-05-30T00:43:41.9953343+02:00 0HMR0IOFCJO5A:00000001 [INF] Executed DbCommand ("2"ms) [Parameters=[""], CommandType='Text', CommandTimeout='30']" +""SELECT [i].[Id], [i].[IsComplete], [i].[Name], [i].[Secret] +FROM [Items] AS [i]" (0723d8ff) +2023-05-30T00:43:42.0250104+02:00 0HMR0IOFCJO5A:00000001 [INF] Executing ObjectResult, writing value of type '"System.Collections.Generic.List`1[[TodoApiDto.Domain.Entities.TodoItem, TodoApiDto.Domain, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]"'. (8a1b66c8) +2023-05-30T00:43:42.0446571+02:00 0HMR0IOFCJO5A:00000001 [INF] Executed action "TodoApi.Controllers.TodoItemsController.GetTodoItems (TodoApiDTO)" in 107.1149ms (afa2e885) +2023-05-30T00:43:42.0453067+02:00 0HMR0IOFCJO5A:00000001 [INF] Executed endpoint '"TodoApi.Controllers.TodoItemsController.GetTodoItems (TodoApiDTO)"' (99874f2b) +2023-05-30T00:43:42.0483924+02:00 0HMR0IOFCJO5A:00000001 [INF] Request finished in 174.9384ms 200 application/json; charset=utf-8 (791a596a) +2023-05-30T00:43:56.8322602+02:00 0HMR0IOFCJO5A:00000002 [INF] Request starting HTTP/1.1 PUT https://localhost:5000/testapi/9ada75bf-d7bd-4324-bd37-08db6033f7b7 application/json 81 (ca22a1cb) +2023-05-30T00:43:56.8333170+02:00 0HMR0IOFCJO5A:00000002 [INF] Executing endpoint '"TodoApi.Controllers.TodoItemsController.UpdateTodoItem (TodoApiDTO)"' (500cc934) +2023-05-30T00:43:56.8508720+02:00 0HMR0IOFCJO5A:00000002 [INF] Route matched with "{action = \"UpdateTodoItem\", controller = \"TodoItems\"}". Executing controller action with signature "System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.IActionResult] UpdateTodoItem(System.Guid, TodoApiDto.Application.Implementations.Command.UpdateToDoItem.UpdateToDoItemCommand)" on controller "TodoApi.Controllers.TodoItemsController" ("TodoApiDTO"). (122b2fdf) +2023-05-30T00:43:56.9389835+02:00 0HMR0IOFCJO5A:00000002 [INF] Executed DbCommand ("6"ms) [Parameters=["@__request_Id_0='?' (DbType = Guid)"], CommandType='Text', CommandTimeout='30']" +""SELECT TOP(1) [i].[Id], [i].[IsComplete], [i].[Name], [i].[Secret] +FROM [Items] AS [i] +WHERE [i].[Id] = @__request_Id_0" (0723d8ff) +2023-05-30T00:43:56.9597803+02:00 0HMR0IOFCJO5A:00000002 [INF] Executed DbCommand ("4"ms) [Parameters=["@p3='?' (DbType = Guid), @p0='?' (DbType = Boolean), @p1='?' (Size = 4000), @p2='?' (Size = 4000)"], CommandType='Text', CommandTimeout='30']" +""SET NOCOUNT ON; +UPDATE [Items] SET [IsComplete] = @p0, [Name] = @p1, [Secret] = @p2 +WHERE [Id] = @p3; +SELECT @@ROWCOUNT;" (0723d8ff) +2023-05-30T00:43:56.9654333+02:00 0HMR0IOFCJO5A:00000002 [INF] Element with id : 9ada75bf-d7bd-4324-bd37-08db6033f7b7 updated (611301d9) +2023-05-30T00:43:56.9742870+02:00 0HMR0IOFCJO5A:00000002 [INF] Executing HttpStatusCodeResult, setting HTTP status code 200 (e28ccfae) +2023-05-30T00:43:56.9744478+02:00 0HMR0IOFCJO5A:00000002 [INF] Executed action "TodoApi.Controllers.TodoItemsController.UpdateTodoItem (TodoApiDTO)" in 123.4071ms (afa2e885) +2023-05-30T00:43:56.9745234+02:00 0HMR0IOFCJO5A:00000002 [INF] Executed endpoint '"TodoApi.Controllers.TodoItemsController.UpdateTodoItem (TodoApiDTO)"' (99874f2b) +2023-05-30T00:43:56.9758271+02:00 0HMR0IOFCJO5A:00000002 [INF] Request finished in 143.7827ms 200 (791a596a) +2023-05-30T00:44:00.2488187+02:00 0HMR0IOFCJO5A:00000003 [INF] Request starting HTTP/1.1 GET https://localhost:5000/testapi/items (ca22a1cb) +2023-05-30T00:44:00.2501498+02:00 0HMR0IOFCJO5A:00000003 [INF] Executing endpoint '"TodoApi.Controllers.TodoItemsController.GetTodoItems (TodoApiDTO)"' (500cc934) +2023-05-30T00:44:00.2505207+02:00 0HMR0IOFCJO5A:00000003 [INF] Route matched with "{action = \"GetTodoItems\", controller = \"TodoItems\"}". Executing controller action with signature "System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.ActionResult] GetTodoItems()" on controller "TodoApi.Controllers.TodoItemsController" ("TodoApiDTO"). (122b2fdf) +2023-05-30T00:44:00.2537562+02:00 0HMR0IOFCJO5A:00000003 [INF] Executed DbCommand ("2"ms) [Parameters=[""], CommandType='Text', CommandTimeout='30']" +""SELECT [i].[Id], [i].[IsComplete], [i].[Name], [i].[Secret] +FROM [Items] AS [i]" (0723d8ff) +2023-05-30T00:44:00.2556009+02:00 0HMR0IOFCJO5A:00000003 [INF] Executing ObjectResult, writing value of type '"System.Collections.Generic.List`1[[TodoApiDto.Domain.Entities.TodoItem, TodoApiDto.Domain, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]"'. (8a1b66c8) +2023-05-30T00:44:00.2560934+02:00 0HMR0IOFCJO5A:00000003 [INF] Executed action "TodoApi.Controllers.TodoItemsController.GetTodoItems (TodoApiDTO)" in 5.4926ms (afa2e885) +2023-05-30T00:44:00.2561502+02:00 0HMR0IOFCJO5A:00000003 [INF] Executed endpoint '"TodoApi.Controllers.TodoItemsController.GetTodoItems (TodoApiDTO)"' (99874f2b) +2023-05-30T00:44:00.2564106+02:00 0HMR0IOFCJO5A:00000003 [INF] Request finished in 7.7206ms 200 application/json; charset=utf-8 (791a596a) +2023-05-30T00:44:07.8497502+02:00 0HMR0IOFCJO5A:00000004 [INF] Request starting HTTP/1.1 GET https://localhost:5000/testapi/9ada75bf-d7bd-4324-bd37-08db6033f7b7 (ca22a1cb) +2023-05-30T00:44:07.8520090+02:00 0HMR0IOFCJO5A:00000004 [INF] Executing endpoint '"TodoApi.Controllers.TodoItemsController.GetTodoItem (TodoApiDTO)"' (500cc934) +2023-05-30T00:44:07.8608066+02:00 0HMR0IOFCJO5A:00000004 [INF] Route matched with "{action = \"GetTodoItem\", controller = \"TodoItems\"}". Executing controller action with signature "System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.ActionResult] GetTodoItem(System.Guid)" on controller "TodoApi.Controllers.TodoItemsController" ("TodoApiDTO"). (122b2fdf) +2023-05-30T00:44:07.8981560+02:00 0HMR0IOFCJO5A:00000004 [INF] Executed DbCommand ("2"ms) [Parameters=["@__request_Id_0='?' (DbType = Guid)"], CommandType='Text', CommandTimeout='30']" +""SELECT TOP(1) [i].[Id], [i].[IsComplete], [i].[Name], [i].[Secret] +FROM [Items] AS [i] +WHERE [i].[Id] = @__request_Id_0" (0723d8ff) +2023-05-30T00:44:07.9013920+02:00 0HMR0IOFCJO5A:00000004 [INF] Executing ObjectResult, writing value of type '"TodoApiDto.Domain.Entities.TodoItem"'. (8a1b66c8) +2023-05-30T00:44:07.9022011+02:00 0HMR0IOFCJO5A:00000004 [INF] Executed action "TodoApi.Controllers.TodoItemsController.GetTodoItem (TodoApiDTO)" in 41.0627ms (afa2e885) +2023-05-30T00:44:07.9022962+02:00 0HMR0IOFCJO5A:00000004 [INF] Executed endpoint '"TodoApi.Controllers.TodoItemsController.GetTodoItem (TodoApiDTO)"' (99874f2b) +2023-05-30T00:44:07.9027462+02:00 0HMR0IOFCJO5A:00000004 [INF] Request finished in 53.3468ms 200 application/json; charset=utf-8 (791a596a) +2023-05-30T00:44:12.3642991+02:00 0HMR0IOFCJO5A:00000005 [INF] Request starting HTTP/1.1 POST https://localhost:5000/testapi application/json 77 (ca22a1cb) +2023-05-30T00:44:12.3654285+02:00 0HMR0IOFCJO5A:00000005 [INF] Executing endpoint '"TodoApi.Controllers.TodoItemsController.CreateTodoItem (TodoApiDTO)"' (500cc934) +2023-05-30T00:44:12.3692412+02:00 0HMR0IOFCJO5A:00000005 [INF] Route matched with "{action = \"CreateTodoItem\", controller = \"TodoItems\"}". Executing controller action with signature "System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.ActionResult] CreateTodoItem(TodoApiDto.Application.Implementations.Command.CreateToDoItem.CreateTodoItemCommand)" on controller "TodoApi.Controllers.TodoItemsController" ("TodoApiDTO"). (122b2fdf) +2023-05-30T00:44:12.4219366+02:00 0HMR0IOFCJO5A:00000005 [INF] Executed DbCommand ("2"ms) [Parameters=["@p0='?' (DbType = Guid), @p1='?' (DbType = Boolean), @p2='?' (Size = 4000), @p3='?' (Size = 4000)"], CommandType='Text', CommandTimeout='30']" +""SET NOCOUNT ON; +INSERT INTO [Items] ([Id], [IsComplete], [Name], [Secret]) +VALUES (@p0, @p1, @p2, @p3);" (0723d8ff) +2023-05-30T00:44:12.4271079+02:00 0HMR0IOFCJO5A:00000005 [INF] Item added to database. (45da158a) +2023-05-30T00:44:12.4322419+02:00 0HMR0IOFCJO5A:00000005 [INF] Executing ObjectResult, writing value of type '"<>f__AnonymousType0`1[[System.Guid, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]"'. (8a1b66c8) +2023-05-30T00:44:12.4336761+02:00 0HMR0IOFCJO5A:00000005 [INF] Executed action "TodoApi.Controllers.TodoItemsController.CreateTodoItem (TodoApiDTO)" in 64.2988ms (afa2e885) +2023-05-30T00:44:12.4338404+02:00 0HMR0IOFCJO5A:00000005 [INF] Executed endpoint '"TodoApi.Controllers.TodoItemsController.CreateTodoItem (TodoApiDTO)"' (99874f2b) +2023-05-30T00:44:12.4343735+02:00 0HMR0IOFCJO5A:00000005 [INF] Request finished in 70.2942ms 200 application/json; charset=utf-8 (791a596a) +2023-05-30T00:44:15.2839607+02:00 0HMR0IOFCJO5A:00000006 [INF] Request starting HTTP/1.1 GET https://localhost:5000/testapi/items (ca22a1cb) +2023-05-30T00:44:15.2849238+02:00 0HMR0IOFCJO5A:00000006 [INF] Executing endpoint '"TodoApi.Controllers.TodoItemsController.GetTodoItems (TodoApiDTO)"' (500cc934) +2023-05-30T00:44:15.2854341+02:00 0HMR0IOFCJO5A:00000006 [INF] Route matched with "{action = \"GetTodoItems\", controller = \"TodoItems\"}". Executing controller action with signature "System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.ActionResult] GetTodoItems()" on controller "TodoApi.Controllers.TodoItemsController" ("TodoApiDTO"). (122b2fdf) +2023-05-30T00:44:15.2900081+02:00 0HMR0IOFCJO5A:00000006 [INF] Executed DbCommand ("2"ms) [Parameters=[""], CommandType='Text', CommandTimeout='30']" +""SELECT [i].[Id], [i].[IsComplete], [i].[Name], [i].[Secret] +FROM [Items] AS [i]" (0723d8ff) +2023-05-30T00:44:15.2924936+02:00 0HMR0IOFCJO5A:00000006 [INF] Executing ObjectResult, writing value of type '"System.Collections.Generic.List`1[[TodoApiDto.Domain.Entities.TodoItem, TodoApiDto.Domain, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]"'. (8a1b66c8) +2023-05-30T00:44:15.2933598+02:00 0HMR0IOFCJO5A:00000006 [INF] Executed action "TodoApi.Controllers.TodoItemsController.GetTodoItems (TodoApiDTO)" in 7.7355ms (afa2e885) +2023-05-30T00:44:15.2935924+02:00 0HMR0IOFCJO5A:00000006 [INF] Executed endpoint '"TodoApi.Controllers.TodoItemsController.GetTodoItems (TodoApiDTO)"' (99874f2b) +2023-05-30T00:44:15.2942968+02:00 0HMR0IOFCJO5A:00000006 [INF] Request finished in 10.4116ms 200 application/json; charset=utf-8 (791a596a) +2023-05-30T00:44:21.1717405+02:00 0HMR0IOFCJO5A:00000007 [INF] Request starting HTTP/1.1 DELETE https://localhost:5000/testapi/9ada75bf-d7bd-4324-bd37-08db6033f7b7 (ca22a1cb) +2023-05-30T00:44:21.1726129+02:00 0HMR0IOFCJO5A:00000007 [INF] Executing endpoint '"TodoApi.Controllers.TodoItemsController.DeleteTodoItem (TodoApiDTO)"' (500cc934) +2023-05-30T00:44:21.1788222+02:00 0HMR0IOFCJO5A:00000007 [INF] Route matched with "{action = \"DeleteTodoItem\", controller = \"TodoItems\"}". Executing controller action with signature "System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.IActionResult] DeleteTodoItem(System.Guid)" on controller "TodoApi.Controllers.TodoItemsController" ("TodoApiDTO"). (122b2fdf) +2023-05-30T00:44:24.0962552+02:00 0HMR0IOFCJO5A:00000007 [INF] Executed DbCommand ("2"ms) [Parameters=["@__request_Id_0='?' (DbType = Guid)"], CommandType='Text', CommandTimeout='30']" +""SELECT [i].[Id], [i].[IsComplete], [i].[Name], [i].[Secret] +FROM [Items] AS [i] +WHERE [i].[Id] = @__request_Id_0" (0723d8ff) +2023-05-30T00:44:24.1044081+02:00 0HMR0IOFCJO5A:00000007 [INF] Executed DbCommand ("2"ms) [Parameters=["@p0='?' (DbType = Guid)"], CommandType='Text', CommandTimeout='30']" +""SET NOCOUNT ON; +DELETE FROM [Items] +WHERE [Id] = @p0; +SELECT @@ROWCOUNT;" (0723d8ff) +2023-05-30T00:44:24.1118935+02:00 0HMR0IOFCJO5A:00000007 [INF] element with id : 9ada75bf-d7bd-4324-bd37-08db6033f7b7 was removed (576e2b26) +2023-05-30T00:44:24.1128870+02:00 0HMR0IOFCJO5A:00000007 [INF] Executing HttpStatusCodeResult, setting HTTP status code 200 (e28ccfae) +2023-05-30T00:44:24.1130803+02:00 0HMR0IOFCJO5A:00000007 [INF] Executed action "TodoApi.Controllers.TodoItemsController.DeleteTodoItem (TodoApiDTO)" in 2934.0934ms (afa2e885) +2023-05-30T00:44:24.1131906+02:00 0HMR0IOFCJO5A:00000007 [INF] Executed endpoint '"TodoApi.Controllers.TodoItemsController.DeleteTodoItem (TodoApiDTO)"' (99874f2b) +2023-05-30T00:44:24.1141971+02:00 0HMR0IOFCJO5A:00000007 [INF] Request finished in 2942.5113ms 200 (791a596a) +2023-05-30T00:44:29.0719610+02:00 0HMR0IOFCJO5A:00000008 [INF] Request starting HTTP/1.1 GET https://localhost:5000/testapi/items (ca22a1cb) +2023-05-30T00:44:29.0725038+02:00 0HMR0IOFCJO5A:00000008 [INF] Executing endpoint '"TodoApi.Controllers.TodoItemsController.GetTodoItems (TodoApiDTO)"' (500cc934) +2023-05-30T00:44:29.0727597+02:00 0HMR0IOFCJO5A:00000008 [INF] Route matched with "{action = \"GetTodoItems\", controller = \"TodoItems\"}". Executing controller action with signature "System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.ActionResult] GetTodoItems()" on controller "TodoApi.Controllers.TodoItemsController" ("TodoApiDTO"). (122b2fdf) +2023-05-30T00:44:29.0754042+02:00 0HMR0IOFCJO5A:00000008 [INF] Executed DbCommand ("1"ms) [Parameters=[""], CommandType='Text', CommandTimeout='30']" +""SELECT [i].[Id], [i].[IsComplete], [i].[Name], [i].[Secret] +FROM [Items] AS [i]" (0723d8ff) +2023-05-30T00:44:29.0772379+02:00 0HMR0IOFCJO5A:00000008 [INF] Executing ObjectResult, writing value of type '"System.Collections.Generic.List`1[[TodoApiDto.Domain.Entities.TodoItem, TodoApiDto.Domain, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]"'. (8a1b66c8) +2023-05-30T00:44:29.0777936+02:00 0HMR0IOFCJO5A:00000008 [INF] Executed action "TodoApi.Controllers.TodoItemsController.GetTodoItems (TodoApiDTO)" in 4.9528ms (afa2e885) +2023-05-30T00:44:29.0778486+02:00 0HMR0IOFCJO5A:00000008 [INF] Executed endpoint '"TodoApi.Controllers.TodoItemsController.GetTodoItems (TodoApiDTO)"' (99874f2b) +2023-05-30T00:44:29.0781379+02:00 0HMR0IOFCJO5A:00000008 [INF] Request finished in 6.2218ms 200 application/json; charset=utf-8 (791a596a)