diff --git a/BusinessLayer/Services/EventCommentService/IEventCommentService.cs b/BusinessLayer/Services/EventCommentService/IEventCommentService.cs new file mode 100644 index 0000000000000000000000000000000000000000..d0d8a564fbcdb4b83b75c9ec75ac445cf4a33bfc --- /dev/null +++ b/BusinessLayer/Services/EventCommentService/IEventCommentService.cs @@ -0,0 +1,75 @@ +using BusinessLayer.DTOs.EventComment; +using BusinessLayer.Utils.Filters; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace BusinessLayer.Services.EventCommentService +{ + /// <summary> + /// Provides methods for managing comments on events. + /// </summary> + public interface IEventCommentService + { + /// <summary> + /// Creates a new comment for a specified event. + /// </summary> + /// <param name="data">The data for creating the comment.</param> + /// <param name="save">Whether to immediately save changes to the database.</param> + /// <returns>The created comment as a <see cref="EventCommentDTO"/>, or null if creation failed.</returns> + Task<EventCommentDTO?> CreateCommentAsync(EventCommentCreateDTO data, bool save = true); + + /// <summary> + /// Marks a comment as deleted by setting its DeletedAt timestamp. + /// </summary> + /// <param name="id">The ID of the comment to delete.</param> + /// <param name="save">Whether to immediately save changes to the database.</param> + /// <returns>True if the comment was successfully marked as deleted; otherwise, false.</returns> + Task<bool> DeleteCommentAsync(Guid id, bool save = true); + + /// <summary> + /// Checks if specified comments exist and are not marked as deleted. + /// </summary> + /// <param name="ids">The IDs of the comments to check.</param> + /// <returns>True if any of the specified comments exist and are not deleted; otherwise, false.</returns> + Task<bool> DoesCommentExistAsync(params Guid[] ids); + + /// <summary> + /// Retrieves a specific comment by its ID. + /// </summary> + /// <param name="id">The ID of the comment.</param> + /// <param name="includeUser">Whether to include user details in the result.</param> + /// <param name="includeEvent">Whether to include event details in the result.</param> + /// <param name="includeChildren">Whether to include child comments in the result.</param> + /// <returns>The comment as a <see cref="EventCommentDTO"/>, or null if not found.</returns> + Task<EventCommentDTO?> GetByIdAsync(Guid id, bool includeUser = true, bool includeEvent = false, bool includeChildren = false); + + /// <summary> + /// Retrieves a list of comments based on filtering criteria. + /// </summary> + /// <param name="filter">The filter criteria for retrieving comments.</param> + /// <param name="limit">The maximum number of comments to retrieve.</param> + /// <param name="offset">The number of comments to skip before starting the retrieval.</param> + /// <param name="ids">Optional IDs to further filter the comments.</param> + /// <param name="includeUser">Whether to include user details in the result.</param> + /// <param name="includeEvent">Whether to include event details in the result.</param> + /// <param name="includeChildren">Whether to include child comments in the result.</param> + /// <returns>A list of comments as <see cref="EventCommentDTO"/> objects.</returns> + Task<List<EventCommentDTO>> GetCommentsAsync(EventCommentFilter filter, + int limit = 0, + int offset = 0, + Guid[]? ids = null, + bool includeUser = true, + bool includeEvent = false, + bool includeChildren = false); + + /// <summary> + /// Updates an existing comment with new content. + /// </summary> + /// <param name="id">The ID of the comment to update.</param> + /// <param name="data">The data for updating the comment.</param> + /// <param name="save">Whether to immediately save changes to the database.</param> + /// <returns>The updated comment as a <see cref="EventCommentDTO"/>, or null if the comment was not found.</returns> + Task<EventCommentDTO?> UpdateCommentAsync(Guid id, EventCommentUpdateDTO data, bool save = true); + } +} diff --git a/BusinessLayer/Services/EventParticipantService/IEventParticipantService.cs b/BusinessLayer/Services/EventParticipantService/IEventParticipantService.cs new file mode 100644 index 0000000000000000000000000000000000000000..48ca653263dc759fc359b69fc1158ddbe38c9b4c --- /dev/null +++ b/BusinessLayer/Services/EventParticipantService/IEventParticipantService.cs @@ -0,0 +1,56 @@ +using BusinessLayer.DTOs.EventParticipant; +using BusinessLayer.Utils.Filters; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace BusinessLayer.Services.EventParticipantService +{ + /// <summary> + /// Provides methods for managing participants in events. + /// </summary> + public interface IEventParticipantService + { + /// <summary> + /// Retrieves an event participant by user ID and event ID. + /// </summary> + /// <param name="userId">The ID of the user participating in the event.</param> + /// <param name="eventId">The ID of the event.</param> + /// <returns>An <see cref="EventParticipantDTO"/> if the participant exists; otherwise, null.</returns> + Task<EventParticipantDTO?> GetParticipantByIdAsync(Guid userId, Guid eventId); + + /// <summary> + /// Retrieves a list of event participants based on specified filter criteria. + /// </summary> + /// <param name="filter">Filter criteria to apply when retrieving participants.</param> + /// <param name="limit">The maximum number of participants to retrieve.</param> + /// <param name="offset">The number of participants to skip before starting the retrieval.</param> + /// <returns>A list of <see cref="EventParticipantDTO"/> objects matching the filter criteria.</returns> + Task<List<EventParticipantDTO>> GetParticipantsAsync(EventParticipantFilter filter, int limit = 0, int offset = 0); + + /// <summary> + /// Creates a new participant for a specific event. + /// </summary> + /// <param name="data">The details of the participant to create.</param> + /// <param name="save">Indicates whether to immediately save the participant to the database.</param> + /// <returns>The created participant as an <see cref="EventParticipantDTO"/>, or null if creation failed.</returns> + Task<EventParticipantDTO?> CreateParticipantAsync(EventParticipantCreateDTO data, bool save = true); + + /// <summary> + /// Updates an existing event participant's information. + /// </summary> + /// <param name="participantId">The ID of the participant to update.</param> + /// <param name="data">The new details for the participant.</param> + /// <param name="save">Indicates whether to immediately save changes to the database.</param> + /// <returns>The updated participant as an <see cref="EventParticipantDTO"/>, or null if the participant was not found.</returns> + Task<EventParticipantDTO?> UpdateParticipantAsync(Guid participantId, EventParticipantUpdateDTO data, bool save = true); + + /// <summary> + /// Marks an event participant as deleted by setting the DeletedAt timestamp. + /// </summary> + /// <param name="participantId">The ID of the participant to delete.</param> + /// <param name="save">Indicates whether to immediately save changes to the database.</param> + /// <returns>True if the participant was successfully marked as deleted; otherwise, false.</returns> + Task<bool> DeleteParticipantAsync(Guid participantId, bool save = true); + } +} diff --git a/BusinessLayer/Services/EventService/IEventService.cs b/BusinessLayer/Services/EventService/IEventService.cs new file mode 100644 index 0000000000000000000000000000000000000000..a4e5fb883885ae87735d45e08dfd81f62f87ad58 --- /dev/null +++ b/BusinessLayer/Services/EventService/IEventService.cs @@ -0,0 +1,53 @@ +using BusinessLayer.DTOs.Event; +using BusinessLayer.Utils.Filters; + +namespace BusinessLayer.Services.EventService +{ + /// <summary> + /// Provides methods for managing events. + /// </summary> + public interface IEventService + { + /// <summary> + /// Retrieves an event by its ID, with an option to include associated restaurant details. + /// </summary> + /// <param name="eventId">The ID of the event to retrieve.</param> + /// <param name="includeRestaurant">Indicates whether to include restaurant details in the result.</param> + /// <returns>An <see cref="EventDTO"/> representing the event, or null if the event was not found.</returns> + Task<EventDTO?> GetEventByIdAsync(Guid eventId, bool includeRestaurant = true); + + /// <summary> + /// Retrieves a list of events based on specified filter criteria. + /// </summary> + /// <param name="filter">The filter criteria for retrieving events.</param> + /// <param name="limit">The maximum number of events to retrieve.</param> + /// <param name="offset">The number of events to skip before starting the retrieval.</param> + /// <returns>A list of <see cref="EventDTO"/> objects matching the filter criteria.</returns> + Task<List<EventDTO>> GetEventsAsync(EventFilter filter, int limit = 0, int offset = 0); + + /// <summary> + /// Creates a new event and assigns the creator as a participant. + /// </summary> + /// <param name="data">The data for creating the event.</param> + /// <param name="save">Indicates whether to immediately save the event to the database.</param> + /// <returns>The created event as an <see cref="EventDTO"/>, or null if creation failed due to invalid user or restaurant.</returns> + Task<EventDTO?> CreateEventAsync(EventCreateDTO data, bool save = true); + + /// <summary> + /// Updates an existing event with new details. + /// </summary> + /// <param name="eventId">The ID of the event to update.</param> + /// <param name="data">The updated details for the event.</param> + /// <param name="save">Indicates whether to immediately save changes to the database.</param> + /// <returns>The updated event as an <see cref="EventDTO"/>, or null if the event was not found or was deleted.</returns> + Task<EventDTO?> UpdateEventAsync(Guid eventId, EventUpdateDTO data, bool save = true); + + /// <summary> + /// Marks an event as deleted by setting its DeletedAt timestamp. + /// </summary> + /// <param name="eventId">The ID of the event to delete.</param> + /// <param name="save">Indicates whether to immediately save changes to the database.</param> + /// <returns>True if the event was successfully marked as deleted; otherwise, false.</returns> + Task<bool> DeleteEventAsync(Guid eventId, bool save = true); + } +}