Skip to content
Snippets Groups Projects
Commit a287ac6b authored by snemeckayova's avatar snemeckayova
Browse files

Add event related interfaces

parent 57ef8c60
No related branches found
No related tags found
2 merge requests!46Milestone-2,!29IssueEventService, EventCommentService, EventParticipantService Implementation
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);
}
}
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);
}
}
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);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment