From 4879d3f38c6c105564eeb18fb2a4ceda759f3c82 Mon Sep 17 00:00:00 2001 From: sanchezvem Date: Mon, 23 Mar 2026 15:22:38 +0100 Subject: [PATCH] Updated dto and endpoint to manage vote --- BeReadyBackend/DTO/Groups/CreateGroupDto.cs | 1 + BeReadyBackend/Endpoints/Groups/StartVoteEndpoint.cs | 3 +++ 2 files changed, 4 insertions(+) diff --git a/BeReadyBackend/DTO/Groups/CreateGroupDto.cs b/BeReadyBackend/DTO/Groups/CreateGroupDto.cs index 1730c64..22e5efe 100644 --- a/BeReadyBackend/DTO/Groups/CreateGroupDto.cs +++ b/BeReadyBackend/DTO/Groups/CreateGroupDto.cs @@ -6,5 +6,6 @@ public class CreateGroupDto public string? Title { get; set; } public string? Description { get; set; } public int Duration { get; set; } + public int? VoteDuration { get; set; } public List? UserGroups { get; set; } } \ No newline at end of file diff --git a/BeReadyBackend/Endpoints/Groups/StartVoteEndpoint.cs b/BeReadyBackend/Endpoints/Groups/StartVoteEndpoint.cs index 758bf53..493fb42 100644 --- a/BeReadyBackend/Endpoints/Groups/StartVoteEndpoint.cs +++ b/BeReadyBackend/Endpoints/Groups/StartVoteEndpoint.cs @@ -43,6 +43,9 @@ public class StartVoteEndpoint(UserGroupsRepository userGroupsRepository, Groups await Send.StringAsync("Le défi n'est pas encore terminé", 400, cancellation: ct); return; } + + group.StartedVote = DateTime.Now; + await groupsRepository.SaveChangesAsync(ct); await hubContext.Clients.Group($"group-{req.Id}").SendAsync("StartVote", cancellationToken: ct); await Send.NoContentAsync(ct);