Skip to content

Commit

Permalink
remove id on entity inherited class and tidy code
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Brereton authored and Tom Brereton committed Sep 6, 2024
1 parent bf6dd92 commit 0dd57b2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
5 changes: 2 additions & 3 deletions src/Web.Api/Domain/Accounts/UserAccount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ private UserAccount()
{
}

public Guid Id { get; private set; }
public string FullName { get; private set; }
public List<Calendar> Calendars { get; private set; } = new List<Calendar>();
public List<Calendar> Calendars { get; private set; } = [];
public bool IsActive { get; private set; }
public bool IsDeleted { get; private set; }

Expand All @@ -31,4 +30,4 @@ public static UserAccount Create(string fullName)

return userAccount;
}
}
}
1 change: 0 additions & 1 deletion src/Web.Api/Domain/Calendars/Calendar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ private Calendar()
{
}

public Guid Id { get; private set; }
public string Name { get; private set; }
public Guid UserAccountId { get; private set; }
public UserAccount UserAccount { get; private set; } = null!;
Expand Down
8 changes: 5 additions & 3 deletions src/Web.Api/Features/Accounts/CreateAccount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ public class CreateAccountEndpoint : ICarterModule
{
public void AddRoutes(IEndpointRouteBuilder app)
{
app.MapPost("api/accounts", async (CreateAccount.Command request, ISender sender, CancellationToken cancellationToken) =>
app.MapPost("api/accounts", async (
CreateAccount.Command request,
ISender sender,
CancellationToken cancellationToken) =>
{
var result = await sender.Send(request, cancellationToken);

if (result.IsFailure)
{
return Results.BadRequest(result.Error);
Expand Down Expand Up @@ -67,4 +69,4 @@ public async Task<Result<CreateAccountResponse>> Handle(Command request, Cancell
return new CreateAccountResponse(userAccount.Id, userAccount.FullName);
}
}
}
}
3 changes: 1 addition & 2 deletions src/Web.Api/Features/Accounts/GetAccount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,4 @@ public async Task<Result<GetAccountResponse>> Handle(Query request, Cancellation
return new GetAccountResponse(account.Id, account.FullName);
}
}
}

}

0 comments on commit 0dd57b2

Please sign in to comment.