IPollService.cs
1,057 bytes
| 1 | using App.BLL.DTO; |
|---|---|
| 2 | |
| 3 | namespace App.BLL.Services; |
| 4 | |
| 5 | public interface IPollService |
| 6 | { |
| 7 | Task<TripPollBllDto> CreatePollWithOptionsAsync(TripPollBllDto poll, List<string> optionTexts); |
| 8 | Task ToggleVoteAsync(Guid pollId, Guid optionId, Guid userId); |
| 9 | Task DeletePollCascadeAsync(Guid pollId); |
| 10 | |
| 11 | // Queries |
| 12 | Task<List<TripPollBllDto>> GetByTripIdAsync(Guid tripId, Guid userId); |
| 13 | Task<TripPollBllDto?> GetByIdAsync(Guid pollId, Guid userId); |
| 14 | Task<TripPollBllDto?> GetByIdWithDetailsAsync(Guid pollId, Guid userId); |
| 15 | |
| 16 | // Guarded create (participant required) |
| 17 | Task<(TripPollBllDto? poll, string? errorCode)> CreatePollGuardedAsync(TripPollBllDto poll, List<string> optionTexts, Guid userId); |
| 18 | |
| 19 | // Vote |
| 20 | Task<(bool success, string? errorCode)> CastVoteAsync(Guid pollId, Guid optionId, Guid userId); |
| 21 | |
| 22 | // Close |
| 23 | Task<(bool success, string? errorCode)> ClosePollAsync(Guid pollId, Guid userId, bool organizerAllowed); |
| 24 | |
| 25 | // Delete |
| 26 | Task<(bool success, string? errorCode)> DeletePollGuardedAsync(Guid pollId, Guid userId); |
| 27 | } |
| 28 | |