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

Commit

Permalink
feat: 알림에 원 게시글 제목을 추가하라
Browse files Browse the repository at this point in the history
  • Loading branch information
kaaang committed Feb 18, 2024
1 parent bac2212 commit d87b583
Show file tree
Hide file tree
Showing 5 changed files with 8 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
2 changes: 2 additions & 0 deletions src/signature/signature.comment.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,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 d87b583

Please sign in to comment.