ITripService.cs
1,806 bytes
| 1 | using SplitApp.WebApp.Application.DTO; |
|---|---|
| 2 | |
| 3 | namespace SplitApp.WebApp.Application.Services; |
| 4 | |
| 5 | public interface ITripService |
| 6 | { |
| 7 | Task<TripBllDto> CreateTripAsync(TripBllDto trip, Guid userId); |
| 8 | |
| 9 | // Queries |
| 10 | Task<List<TripBllDto>> GetUserTripsAsync(Guid userId); |
| 11 | Task<TripBllDto?> GetByIdAsync(Guid tripId, Guid userId); // IDOR: must be participant |
| 12 | Task<TripBllDto?> GetByIdWithDetailsAsync(Guid tripId, Guid userId); // IDOR: must be participant |
| 13 | Task<TripBllDto?> GetByIdForOrganizerAsync(Guid tripId, Guid userId); // IDOR: must be organizer |
| 14 | Task<TripBllDto?> GetRawByIdAsync(Guid tripId); // no IDOR (used when invitation is valid) |
| 15 | |
| 16 | // Authorization helpers |
| 17 | Task<bool> IsParticipantAsync(Guid tripId, Guid userId); |
| 18 | Task<bool> IsOrganizerAsync(Guid tripId, Guid userId); |
| 19 | |
| 20 | // Mutations |
| 21 | Task<TripBllDto?> UpdateAsync(TripBllDto trip, Guid userId); // null if not organizer |
| 22 | Task<bool> DeleteAsync(Guid tripId, Guid userId); // false if not organizer |
| 23 | |
| 24 | // Participant queries/actions |
| 25 | Task<List<TripParticipantBllDto>> GetParticipantsAsync(Guid tripId, Guid userId); // participant-only |
| 26 | Task<List<TripParticipantBllDto>> GetParticipantsForIndexAsync(Guid tripId, Guid userId); |
| 27 | Task<TripParticipantBllDto?> GetParticipantByIdAsync(Guid participantId); |
| 28 | |
| 29 | Task<(bool success, string? errorCode)> RemoveParticipantAsync(Guid tripId, Guid participantUserId, Guid currentUserId); |
| 30 | Task<bool> RemoveParticipantByIdAsync(Guid tripId, Guid participantId, Guid currentUserId); |
| 31 | |
| 32 | // Trip lifecycle |
| 33 | Task<(bool success, string? errorCode)> FinalizeTripAsync(Guid tripId, Guid userId); |
| 34 | Task<(bool success, string? errorCode)> ReopenTripAsync(Guid tripId, Guid userId); |
| 35 | |
| 36 | // Dropdown data |
| 37 | Task<List<CurrencyBllDto>> GetAllCurrenciesAsync(); |
| 38 | } |
| 39 | |