Skip to content

Commit

Permalink
🐛 add logic in liked service
Browse files Browse the repository at this point in the history
  • Loading branch information
KMUlee committed May 11, 2024
1 parent f720d47 commit 3ed6495
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/likes/likes.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@ export class LikesService {
}

async likeProfile(profileId: number, userId: number): Promise<Likes> {
const liked = await this.likesRepository.findOne({
where: {
profileId: profileId,
user: {
id: userId,
},
},
});
if (liked) {
return liked;
}
const user: User = await this.userService.findOneById(userId);
const newLike: Likes = this.likesRepository.create({
profileId,
Expand Down

0 comments on commit 3ed6495

Please sign in to comment.