Removed todos and added User endpoint combined with register. Id changed to guid
This commit is contained in:
@@ -6,7 +6,7 @@ public abstract class BaseEntity
|
||||
{
|
||||
// This can easily be modified to be BaseEntity<T> and public T Id to support different key types.
|
||||
// Using non-generic integer types for simplicity
|
||||
public int Id { get; set; }
|
||||
public Guid Id { get; set; }
|
||||
|
||||
private readonly List<BaseEvent> _domainEvents = [];
|
||||
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
namespace Hutopy.Domain.Entities;
|
||||
|
||||
public class TodoItem : BaseAuditableEntity
|
||||
{
|
||||
public int ListId { get; set; }
|
||||
|
||||
public string? Title { get; set; }
|
||||
|
||||
public string? Note { get; set; }
|
||||
|
||||
public PriorityLevel Priority { get; set; }
|
||||
|
||||
public DateTime? Reminder { get; set; }
|
||||
|
||||
private bool _done;
|
||||
public bool Done
|
||||
{
|
||||
get => _done;
|
||||
set
|
||||
{
|
||||
if (value && !_done)
|
||||
{
|
||||
AddDomainEvent(new TodoItemCompletedEvent(this));
|
||||
}
|
||||
|
||||
_done = value;
|
||||
}
|
||||
}
|
||||
|
||||
public TodoList List { get; set; } = null!;
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
namespace Hutopy.Domain.Entities;
|
||||
|
||||
public class TodoList : BaseAuditableEntity
|
||||
{
|
||||
public string? Title { get; set; }
|
||||
|
||||
public Colour Colour { get; set; } = Colour.White;
|
||||
|
||||
public IList<TodoItem> Items { get; private set; } = new List<TodoItem>();
|
||||
}
|
||||
10
src/Domain/Entities/User.cs
Normal file
10
src/Domain/Entities/User.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace Hutopy.Domain.Entities;
|
||||
|
||||
public class User : BaseAuditableEntity
|
||||
{
|
||||
public Guid IdentityUserId { get; set; }
|
||||
public required string FirstName { get; set; }
|
||||
public required string LastName { get; set; }
|
||||
public required string UserName { get; set; }
|
||||
public required string EmailAddress { get; set; }
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
namespace Hutopy.Domain.Events;
|
||||
|
||||
public class TodoItemCompletedEvent(
|
||||
TodoItem item)
|
||||
: BaseEvent
|
||||
{
|
||||
public TodoItem Item { get; } = item;
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
namespace Hutopy.Domain.Events;
|
||||
|
||||
public class TodoItemCreatedEvent(
|
||||
TodoItem item)
|
||||
: BaseEvent
|
||||
{
|
||||
public TodoItem Item { get; } = item;
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
namespace Hutopy.Domain.Events;
|
||||
|
||||
public class TodoItemDeletedEvent(
|
||||
TodoItem item)
|
||||
: BaseEvent
|
||||
{
|
||||
public TodoItem Item { get; } = item;
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
global using Hutopy.Domain.Common;
|
||||
global using Hutopy.Domain.Entities;
|
||||
global using Hutopy.Domain.Enums;
|
||||
global using Hutopy.Domain.Events;
|
||||
global using Hutopy.Domain.Exceptions;
|
||||
global using Hutopy.Domain.ValueObjects;
|
||||
7
src/Domain/Interfaces/IUserService.cs
Normal file
7
src/Domain/Interfaces/IUserService.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace Hutopy.Domain.Interfaces;
|
||||
|
||||
public interface IUserService
|
||||
{
|
||||
Task CreateUserAsync(string email, string userName, string password);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user