Skip to content

ILikeService

Namespace: SlottyMedia.Backend.Services.Interfaces

Interface for LikeService which handles operations related to likes on posts.

public interface ILikeService

Methods

InsertLike(Guid, Guid)

Inserts a like for a given post by a user.

Task<bool> InsertLike(Guid userId, Guid postId)

Parameters

userId Guid
The ID of the user who likes the post.

postId Guid
The ID of the post to be liked.

Returns

Task<Boolean>
A task that represents the asynchronous operation. The task result contains a boolean indicating whether the like was successfully inserted.

Exceptions

LikeIudException
Thrown when an error occurs during Insert, Update, or Delete operations.

LikeGeneralException
Thrown when a general error occurs.

DeleteLike(Guid, Guid)

Deletes a like for a given post by a user.

Task<bool> DeleteLike(Guid userId, Guid postId)

Parameters

userId Guid
The ID of the user who unlikes the post.

postId Guid
The ID of the post to be unliked.

Returns

Task<Boolean>
A task that represents the asynchronous operation. The task result contains a boolean indicating whether the like was successfully deleted.

Exceptions

LikeNotFoundException
Thrown when the like is not found.

LikeIudException
Thrown when an error occurs during Insert, Update, or Delete operations.

LikeGeneralException
Thrown when a general error occurs.

GetLikesForPost(Guid)

Retrieves a list of user IDs who liked a given post.

Task<List<Guid>> GetLikesForPost(Guid postId)

Parameters

postId Guid
The ID of the post for which to retrieve likes.

Returns

Task<List<Guid>>
A task that represents the asynchronous operation. The task result contains a list of user IDs who liked the post.

Exceptions

LikeNotFoundException
Thrown when the likes are not found.

LikeGeneralException
Thrown when a general error occurs.