Allow updates
Some checks failed
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is failing

This commit is contained in:
Kasper Juul Hermansen 2021-11-17 22:18:29 +01:00
parent 9c5eaf2644
commit afb3bfd681
Signed by: kjuulh
GPG Key ID: DCD9397082D97069
3 changed files with 9 additions and 3 deletions

View File

@ -115,12 +115,15 @@ public class TodoHub : Hub
if (updateTodo is null) if (updateTodo is null)
throw new InvalidOperationException("Could not parse invalid updateTodo"); throw new InvalidOperationException("Could not parse invalid updateTodo");
var userId = GetUserId();
var updatedTodo = await _todoRepository.UpdateTodoAsync(new Core.Entities.Todo() var updatedTodo = await _todoRepository.UpdateTodoAsync(new Core.Entities.Todo()
{ {
Id = updateTodo.Id, Id = updateTodo.Id,
Project = updateTodo.Project, Project = updateTodo.Project,
Status = updateTodo.Status, Status = updateTodo.Status,
Title = updateTodo.Title Title = updateTodo.Title,
AuthorId = userId
}); });
var serializedTodo = JsonSerializer.Serialize(new TodoResponse() var serializedTodo = JsonSerializer.Serialize(new TodoResponse()

View File

@ -6,4 +6,5 @@ public record Todo
public string Title { get; init; } public string Title { get; init; }
public bool Status { get; init; } public bool Status { get; init; }
public string Project { get; init; } public string Project { get; init; }
public string AuthorId { get; init; }
} }

View File

@ -66,7 +66,8 @@ public class TodoRepository : ITodoRepository
Id = todo.Id, Id = todo.Id,
Status = todo.Status, Status = todo.Status,
Title = todo.Title, Title = todo.Title,
ProjectName = todo.Project ProjectName = todo.Project,
AuthorId = todo.AuthorId
}); });
return new Core.Entities.Todo() return new Core.Entities.Todo()
@ -74,7 +75,8 @@ public class TodoRepository : ITodoRepository
Id = updatedTodo.Id, Id = updatedTodo.Id,
Project = updatedTodo.ProjectName, Project = updatedTodo.ProjectName,
Status = updatedTodo.Status, Status = updatedTodo.Status,
Title = updatedTodo.Title Title = updatedTodo.Title,
AuthorId = updatedTodo.AuthorId
}; };
} }
} }