diff --git a/apps/judicial-system/backend/src/app/modules/defendant/defendant.service.ts b/apps/judicial-system/backend/src/app/modules/defendant/defendant.service.ts index 59ca01645a40..fca293e95ffe 100644 --- a/apps/judicial-system/backend/src/app/modules/defendant/defendant.service.ts +++ b/apps/judicial-system/backend/src/app/modules/defendant/defendant.service.ts @@ -76,6 +76,7 @@ export class DefendantService { private getMessagesForIndictmentToPrisonAdminChanges( defendant: Defendant, + caseId: string, ): Message { const messageType = defendant.isSentToPrisonAdmin === true @@ -84,7 +85,7 @@ export class DefendantService { const message = { type: MessageType.DEFENDANT_NOTIFICATION, - caseId: defendant.caseId, + caseId, elementId: defendant.id, body: { type: messageType, @@ -196,7 +197,10 @@ export class DefendantService { updatedDefendant.isSentToPrisonAdmin !== oldDefendant.isSentToPrisonAdmin ) { messages.push( - this.getMessagesForIndictmentToPrisonAdminChanges(updatedDefendant), + this.getMessagesForIndictmentToPrisonAdminChanges( + updatedDefendant, + theCase.id, + ), ) } diff --git a/apps/judicial-system/backend/src/app/modules/defendant/models/defendant.model.ts b/apps/judicial-system/backend/src/app/modules/defendant/models/defendant.model.ts index bc31334d6bdd..f795a4980c13 100644 --- a/apps/judicial-system/backend/src/app/modules/defendant/models/defendant.model.ts +++ b/apps/judicial-system/backend/src/app/modules/defendant/models/defendant.model.ts @@ -81,7 +81,7 @@ export class Defendant extends Model { @ApiProperty({ type: String }) caseId!: string - @BelongsTo(() => Case, 'case_id') + @BelongsTo(() => Case, 'caseId') @ApiPropertyOptional({ type: () => Case }) case?: Case