Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(j-s): Add more info to new indictment robot emails #17184

Merged
merged 4 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,7 @@ export class InternalCaseService {
? {
name: theCase.prosecutor.name,
nationalId: theCase.prosecutor.nationalId,
email: theCase.prosecutor.email,
}
: undefined,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ describe('InternalCaseController - Deliver indictment info to court', () => {
{ eventType: EventType.INDICTMENT_CONFIRMED, created: indictmentDate },
],
defendants: [{ name: 'Test Ákærði', nationalId: '1234567890' }],
prosecutor: { name: 'Test Sækjandi', nationalId: '0101010101' },
prosecutor: {
name: 'Test Sækjandi',
nationalId: '0101010101',
email: '[email protected]',
},
} as Case

let mockCourtService: CourtService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,9 @@ export class CourtService {
)

const isIndictment = isIndictmentCase(type)
const policeCaseNumber = policeCaseNumbers[0]
? policeCaseNumbers[0].replace(/-/g, '')
: ''

return await this.courtClientService.createCase(courtId, {
caseType: isIndictment ? 'S - Ákærumál' : 'R - Rannsóknarmál',
Expand All @@ -344,7 +347,7 @@ export class CourtService {
receivalDate: formatISO(receivalDate, { representation: 'date' }),
basedOn: isIndictment ? 'Sakamál' : 'Rannsóknarhagsmunir',
// TODO: pass in all policeCaseNumbers when CourtService supports it
sourceNumber: policeCaseNumbers[0] ? policeCaseNumbers[0] : '',
sourceNumber: policeCaseNumber,
})
} catch (reason) {
if (reason instanceof ServiceUnavailableException) {
Expand Down Expand Up @@ -569,14 +572,17 @@ export class CourtService {
policeCaseNumber?: string,
subtypes?: string[],
defendants?: { name?: string; nationalId?: string }[],
prosecutor?: { name?: string; nationalId?: string },
prosecutor?: { name?: string; nationalId?: string; email?: string },
): Promise<unknown> {
try {
const subject = `${courtName} - ${courtCaseNumber} - upplýsingar`

const sanitizedPoliceCaseNumber = policeCaseNumber?.replace(/-/g, '')

const content = JSON.stringify({
receivedByCourtDate,
indictmentDate,
policeCaseNumber,
sanitizedPoliceCaseNumber,
subtypes,
defendants,
prosecutor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ describe('CourtService - Create court case', () => {
status: 'Skráð',
receivalDate: formatISO(receivalDate, { representation: 'date' }),
basedOn: 'Rannsóknarhagsmunir',
sourceNumber: policeCaseNumbers[0],
sourceNumber: policeCaseNumbers[0].replace(/-/g, ''),
},
)
})
Expand Down Expand Up @@ -146,7 +146,7 @@ describe('CourtService - Create court case', () => {
status: 'Skráð',
receivalDate: formatISO(receivalDate, { representation: 'date' }),
basedOn: 'Sakamál',
sourceNumber: policeCaseNumbers[0],
sourceNumber: policeCaseNumbers[0].replace(/-/g, ''),
},
)
})
Expand Down Expand Up @@ -183,7 +183,7 @@ describe('CourtService - Create court case', () => {
status: 'Skráð',
receivalDate: formatISO(receivalDate, { representation: 'date' }),
basedOn: 'Rannsóknarhagsmunir',
sourceNumber: policeCaseNumbers[0],
sourceNumber: policeCaseNumbers[0].replace(/-/g, ''),
})
})
})
Expand Down Expand Up @@ -218,7 +218,7 @@ describe('CourtService - Create court case', () => {
status: 'Skráð',
receivalDate: formatISO(receivalDate, { representation: 'date' }),
basedOn: 'Rannsóknarhagsmunir',
sourceNumber: policeCaseNumbers[0],
sourceNumber: policeCaseNumbers[0].replace(/-/g, ''),
})
})
})
Expand Down
Loading