Removed todos and added User endpoint combined with register. Id changed to guid

This commit is contained in:
Dominic Villemure
2024-04-03 23:57:01 -04:00
parent df8b42bdf1
commit 1f795c53bb
67 changed files with 1750 additions and 1895 deletions

View File

@@ -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 = [];

View File

@@ -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!;
}

View File

@@ -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>();
}

View 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; }
}

View File

@@ -1,8 +0,0 @@
namespace Hutopy.Domain.Events;
public class TodoItemCompletedEvent(
TodoItem item)
: BaseEvent
{
public TodoItem Item { get; } = item;
}

View File

@@ -1,8 +0,0 @@
namespace Hutopy.Domain.Events;
public class TodoItemCreatedEvent(
TodoItem item)
: BaseEvent
{
public TodoItem Item { get; } = item;
}

View File

@@ -1,8 +0,0 @@
namespace Hutopy.Domain.Events;
public class TodoItemDeletedEvent(
TodoItem item)
: BaseEvent
{
public TodoItem Item { get; } = item;
}

View File

@@ -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;

View File

@@ -0,0 +1,7 @@
namespace Hutopy.Domain.Interfaces;
public interface IUserService
{
Task CreateUserAsync(string email, string userName, string password);
}