fixed errors and finish endpoints

This commit is contained in:
2026-03-09 23:24:01 +01:00
parent 679c552a3f
commit 756382a496
8 changed files with 124 additions and 12 deletions

View File

@@ -27,6 +27,12 @@ public class DeleteAuthorEndpoint(AuthorRepository authorRepository) : Endpoint<
await Send.NotFoundAsync(ct);
return;
}
if (author.Books?.Count > 0)
{
await Send.StringAsync("L'auteur possède encore des livres",409, cancellation: ct);
return;
}
await authorRepository.DeleteAsync(author, ct);
await Send.OkAsync(cancellation: ct);