Skip to content

Commit

Permalink
Fix missing field notifyDasyBefore
Browse files Browse the repository at this point in the history
  • Loading branch information
WalissonPires committed Mar 5, 2024
1 parent 5ea85d5 commit db18ece
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/domains/message-templates/mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export class MessageTemplateMapper {
id: templateDb.id,
name: templateDb.name,
content: templateDb.content,
notifyDaysBefore: templateDb.notifyDaysBefore,
params: templateDb.params ? JSON.parse(templateDb.params) : []
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ export class GetNotificationTriggers implements UseCase<GetNotificationTriggersI
templateMessage: {
select: {
id: true,
name: true
name: true,
notifyDaysBefore: true
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class RegisterNotificationTrigger implements UseCase<RegisterNotification
throw new AppError('Notificação já registrada');
}

const triggerDb = await db.notificationTrigger.create({
const { id: triggerId } = await db.notificationTrigger.create({
data: {
id: idGen.new(),
templateMessageId: input.templateMessageId,
Expand All @@ -47,7 +47,16 @@ export class RegisterNotificationTrigger implements UseCase<RegisterNotification
}
});

return triggerMapper.map(triggerDb);
const triggerDb = await db.notificationTrigger.findFirst({
where: {
id: triggerId
},
include: {
templateMessage: true
}
});

return triggerMapper.map(triggerDb!);
}

private validate(input: RegisterNotificationTriggerInput) {
Expand Down

0 comments on commit db18ece

Please sign in to comment.