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:
OlgunR
2026-01-16 13:42:46 +01:00
parent 215e526230
commit 904e6e20f0
5 changed files with 19 additions and 2 deletions

View File

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