|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
using Asp.Versioning;
|
|
|
|
|
using Dto;
|
|
|
|
|
using Entities;
|
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using Shared;
|
|
|
|
@ -52,6 +53,7 @@ public class NotepadController(ILogger<NotepadController> logger, INotePadServic
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var existingNotePad = notePadService.GetNotePadByIdUserAndIdInquiry(notepadDto.UserId, notepadDto.InquiryId);
|
|
|
|
|
logger.LogError("[ERREUR] Le bloc note existe déjà impossible de le crée");
|
|
|
|
|
return StatusCode(409, existingNotePad);
|
|
|
|
|
}
|
|
|
|
|
catch (ArgumentException)
|
|
|
|
@ -59,4 +61,17 @@ public class NotepadController(ILogger<NotepadController> logger, INotePadServic
|
|
|
|
|
return Ok(notePadService.CreateNotePad(notepadDto.Id, notepadDto.UserId, notepadDto.InquiryId, notepadDto.Notes));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
[HttpDelete]
|
|
|
|
|
[ProducesResponseType(typeof(UserDto), 200)]
|
|
|
|
|
[ProducesResponseType(typeof(string), 404)]
|
|
|
|
|
public IActionResult DeleteNotePad(int id)
|
|
|
|
|
{
|
|
|
|
|
if (notePadService.DeleteNotePad(id))
|
|
|
|
|
{
|
|
|
|
|
logger.LogInformation("[INFORMATION] le bloc note avec l'id {id} a été supprimé.", id);
|
|
|
|
|
return Ok();
|
|
|
|
|
}
|
|
|
|
|
logger.LogError("[ERREUR] Aucun bloc note trouvé avec l'id {id}.", id);
|
|
|
|
|
return NotFound();
|
|
|
|
|
}
|
|
|
|
|
}
|