SignupController getForEvent, delete -> deleteForEvent rename

This commit is contained in:
quentin 2024-10-29 19:14:11 -05:00
parent d48186d4d6
commit 4fc88d90ce

View File

@ -1,4 +1,3 @@
using API.Authentication;
using API.Authentication.Interfaces;
using API.DTO.Base.Update;
using API.Services;
@ -17,8 +16,31 @@ namespace API.Controllers
{
}
[HttpPost]
public override ActionResult<SignupDTO> add(SignupDTO createDTO)
[HttpGet("forEvent/{eventId}")]
public ActionResult<SignupDTO> getForEvent(ulong eventId)
{
MUser? user = getUser(User);
if (user == null)
return Unauthorized();
IEnumerable<Signup>? result = Service.get(user, e => e.eventId == eventId);
if (result == null)
return Forbid();
List<SignupDTO> dtos = [];
Parallel.ForEach(result, item =>
{
SignupDTO dto = new SignupDTO();
dto.adaptFromModel(item);
dtos.Add(dto);
});
return Ok(dtos);
}
[HttpPost("autoUser")]
public ActionResult<SignupDTO> add(SignupDTO createDTO)
{
MUser? user = getUser(User);
if (user == null)
@ -42,7 +64,7 @@ namespace API.Controllers
}
[HttpDelete("event/{eventId}")]
public virtual ActionResult delete(ulong eventId)
public ActionResult deleteForEvent(ulong eventId)
{
MUser? user = getUser(User);
if (user == null)