Adding priority

This commit is contained in:
2021-11-21 20:40:41 +01:00
parent 09d71b71d8
commit 33f050085c
13 changed files with 116 additions and 26 deletions

View File

@@ -80,6 +80,9 @@ public class TodosController : ApiController
[JsonPropertyName("created")]
public long Created { get; init; } = 0;
[JsonPropertyName("priority")]
public string? Priority { get; init; }
internal ReplaceTodoCommand To(string id) => new(
id,
@@ -87,6 +90,7 @@ public class TodosController : ApiController
Project,
Description,
Status,
Created);
Created,
Priority);
}
}

View File

@@ -11,7 +11,8 @@ namespace Todo.Core.Application.Commands.Todo;
public record CreateTodoCommand(
[Required] string TodoTitle,
string? TodoProject,
string? TodoDescription) : IRequest<TodoViewModel>
string? TodoDescription,
string? Priority) : IRequest<TodoViewModel>
{
internal class Handler : IRequestHandler<CreateTodoCommand, TodoViewModel>
{
@@ -41,6 +42,7 @@ public record CreateTodoCommand(
request.TodoTitle,
request.TodoProject,
request.TodoDescription,
request.Priority
userId,
DateTimeOffset.UtcNow.ToUnixTimeMilliseconds());

View File

@@ -12,7 +12,8 @@ public record ReplaceTodoCommand(
string? Project,
string? Description,
bool Status,
long Created) : IRequest<Unit>
long Created,
string? Priority) : IRequest<Unit>
{
internal class Handler : IRequestHandler<ReplaceTodoCommand, Unit>
{
@@ -51,5 +52,6 @@ public record ReplaceTodoCommand(
Project,
authorId,
Description,
Created);
Created,
Priority);
}

View File

@@ -7,4 +7,5 @@ public record Todo(
string? Project,
string AuthorId,
string? Description,
long Created);
long Created,
string? Priority);

View File

@@ -8,6 +8,7 @@ public interface ITodoRepository
string title,
string? projectName,
string? description,
string? priority,
string userId,
long created);

View File

@@ -20,6 +20,7 @@ public record MongoTodo
public string? ProjectName { get; set; } = string.Empty;
public string AuthorId { get; set; }
public long Created { get; set; } = 0;
public string? Priority { get; set; } = string.Empty;
public Core.Entities.Todo To() => new(
Id,
@@ -28,5 +29,6 @@ public record MongoTodo
ProjectName,
AuthorId,
Description,
Created);
Created,
Priority);
}