Enforce unique catalog titles on creation
Added a uniqueness check for catalog titles in the creation flow. The service now prevents creating catalogs with duplicate titles by checking for existing entries before insertion. If a duplicate is detected, the API returns a 409 Conflict response. Updated interfaces and repository to support title-based lookups.
This commit is contained in:
@@ -36,6 +36,10 @@ public class CatalogsController : ControllerBase
|
||||
public async Task<ActionResult<CatalogReadDto>> Create(CatalogWriteDto dto, CancellationToken cancellationToken)
|
||||
{
|
||||
var created = await _service.CreateAsync(dto, cancellationToken);
|
||||
if (created == null)
|
||||
{
|
||||
return Conflict();
|
||||
}
|
||||
return CreatedAtAction(nameof(GetById), new { id = created.Guid }, created);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user