Skip to content

Commit

Permalink
Merge pull request #102 from depromeet/dev
Browse files Browse the repository at this point in the history
🔨 fix(alarm): 댓글 알림시에 방 정보 id 딥링크 정보 추가
  • Loading branch information
ImNM authored Jun 19, 2022
2 parents 7e04a76 + 4e21176 commit 6958ce7
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 6 deletions.
3 changes: 3 additions & 0 deletions src/apis/alarm/alarm.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,18 @@ export class AlarmService {
user: receiver.userId.toString(),
content: comment,
roomName: room.name,
roomId: room._id.toString(),
alarmType: ALARM_STORE_TYPE.COMMENT,
questionId: questionIdDto.questionId.toString(),
};
// console.log(saveAlarmDto);
await this.saveAlarmQueue.add(ALARM_STORE_TYPE.COMMENT, saveAlarmDto);

const sendPushAlarmObj: SendPushAlarmPubDto = {
nickname: sender.nickname,
content: comment,
receivers: [receiver.userId],
roomId: room._id.toString(),
pushAlarmType: PUSH_ALARM_TYPE.COMMENT,
questionId: questionIdDto.questionId.toString(),
};
Expand Down
14 changes: 11 additions & 3 deletions src/apis/alarm/dto/alarmShow.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ export class AlarmShowDto {
@Expose({ toClassOnly: true })
roomName?: string;

@Exclude({ toPlainOnly: true })
@Expose({ toClassOnly: true })
roomId?: string;

@Exclude({ toPlainOnly: true })
@Expose({ toClassOnly: true })
nickname: string;
Expand All @@ -44,9 +48,13 @@ export class AlarmShowDto {
case ALARM_STORE_TYPE.LIGHTNING:
return DEEPLINK_BASEURL + 'screen-type?mypage';
case ALARM_STORE_TYPE.COMMENT:
return (
DEEPLINK_BASEURL + 'question-detail?question_id=' + this.questionId
);
const link =
DEEPLINK_BASEURL + 'question-detail?question_id=' + this.questionId;
if (this.roomId) {
return link + '&chat-room_id=' + this.roomId;
} else {
return link;
}
default:
return '';
}
Expand Down
3 changes: 3 additions & 0 deletions src/apis/alarm/dto/saveAlarm.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ export class SaveAlarmDto {
@Expose()
questionId?: string;

@Expose()
roomId?: string;

//need to be updated 딥링크 양식 정의 필요 ( 클라와 함께)
// @Expose()
// get deepLink(): string {
Expand Down
6 changes: 5 additions & 1 deletion src/apis/alarm/dto/sendPushAlarm.sub.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ export class SendPushAlarmSubDto {
);
case PUSH_ALARM_TYPE.COMMENT:
return (
DEEPLINK_BASEURL + 'question-detail?question_id=' + this.questionId
DEEPLINK_BASEURL +
'question-detail?question_id=' +
this.questionId +
'&chat-room_id=' +
this.roomId
);
case PUSH_ALARM_TYPE.LETTER:
return (
Expand Down
1 change: 0 additions & 1 deletion src/apis/alarm/pushAlarm.processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ export class PushAlarmProcessor {
@Process(PUSH_ALARM_TYPE.CHAT)
async handleChatAlarm(job: Job) {
// job.data
// TODO : 서로 차단된 유저는 알림에서 빼야함.
console.log('processor ALARM Comment ', job.data);

const chatAlarmSubDto = plainToInstance(ChatAlarmSubDto, job.data);
Expand Down
1 change: 0 additions & 1 deletion src/apis/letter/letter.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ export class LetterService {
throw new BadRequestException('탈퇴한 유저');
}

//TODO : 400 번대
// 보낼 수 없는 사용자 추가

const letterRoom = await this.upsertUserListToLetterRoom(twoUserList);
Expand Down
5 changes: 5 additions & 0 deletions src/models/alarm.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ export class Alarm {
})
roomName: string;

@Prop({
type: String,
})
roomId: string;

@Prop({
default: '',
type: String,
Expand Down

0 comments on commit 6958ce7

Please sign in to comment.