Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

Commit

Permalink
Merge branch 'develop' of github.com:Here-You/here-you-backend into f…
Browse files Browse the repository at this point in the history
…eature/#248
  • Loading branch information
moonyaeyoon committed Feb 18, 2024
2 parents 0908bd0 + d87b583 commit 56ab980
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/comment/comment.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export class CommentService {
notification.notificationSender = user;
notification.notificationTargetType = 'RULE';
notification.notificationTargetId = rule.id;
notification.notificationTargetDesc = rule.mainTitle;
notification.notificationAction = 'COMMENT';
await notification.save();
}
Expand Down
3 changes: 3 additions & 0 deletions src/notification/notification.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ export class NotificationEntity extends BaseEntity {
@Column()
notificationTargetId: number;

@Column({ type: 'text' })
notificationTargetDesc: string;

@Column({ type: 'enum', enum: ['LIKE', 'COMMENT'] })
notificationAction: 'LIKE' | 'COMMENT';

Expand Down
1 change: 1 addition & 0 deletions src/notification/notification.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export class NotificationService {
action: notification.notificationAction,
},
itemId: notification.notificationTargetId,
itemDesc: notification.notificationTargetDesc,
isRead: notification.notificationRead,
created: notification.created,
})),
Expand Down
4 changes: 4 additions & 0 deletions src/signature/signature.comment.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export class SignatureCommentService {
const user = await UserEntity.findOneOrFail({ where: { id: userId } });
const signature = await SignatureEntity.findOneOrFail({
where: { id: signatureId },
relations: { user: true },
});

if (!user || !signature) {
Expand All @@ -58,6 +59,7 @@ export class SignatureCommentService {

const parentComment = await SignatureCommentEntity.findOneOrFail({
where: { id: parentCommentId },
relations: { user: true },
});

if (!parentComment) throw new NotFoundException('404 Not Found');
Expand All @@ -67,13 +69,15 @@ export class SignatureCommentService {
}

notification.notificationReceiver = parentComment.user;
notification.notificationTargetDesc = parentComment.content;
} else {
// 댓글: parentId는 본인으로 설정
const savedComment = await comment.save();
savedComment.parentComment = savedComment;
await savedComment.save();

notification.notificationReceiver = signature.user;
notification.notificationTargetDesc = signature.title;
}

notification.notificationSender = user;
Expand Down
1 change: 1 addition & 0 deletions src/signature/signature.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ export class SignatureService {
notification.notificationSender = loginUser;
notification.notificationTargetType = 'SIGNATURE';
notification.notificationTargetId = signature.id;
notification.notificationTargetDesc = signature.title;
notification.notificationAction = 'LIKE';
await notification.save();

Expand Down

0 comments on commit 56ab980

Please sign in to comment.