-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(j-s): Send notifications when subpoena changes (#16329)
* Checkpoint * Refactor * Checkpoint * Add messages to queue * Checkpoint * Construct the emails * Fix build * Checkpoint * Implement failed notifications * Add failed and defenderchoice emails * Remove unused code * Remove unused code * Refactor * Refactor * Remove unused code * Refactor * Refactor * Refactor * Refactor * Refactor * Refactor * Refactor * Refactor * Refactor * Refactor * Refactor * Refactor * Merge * Cleanup * Remove console.log * Refactor * Refactor * Refactor * Remove unused code * Refactor * Fix tests --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
- Loading branch information
1 parent
af0f4ca
commit 75ba90b
Showing
17 changed files
with
447 additions
and
32 deletions.
There are no files selected for viewing
70 changes: 70 additions & 0 deletions
70
apps/judicial-system/backend/migrations/20241015105921-update-notification.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
'use strict' | ||
const replaceEnum = require('sequelize-replace-enum-postgres').default | ||
|
||
module.exports = { | ||
up: (queryInterface) => { | ||
// replaceEnum does not support transactions | ||
return replaceEnum({ | ||
queryInterface, | ||
tableName: 'notification', | ||
columnName: 'type', | ||
newValues: [ | ||
'HEADS_UP', | ||
'READY_FOR_COURT', | ||
'RECEIVED_BY_COURT', | ||
'COURT_DATE', | ||
'RULING', | ||
'MODIFIED', | ||
'REVOKED', | ||
'DEFENDER_ASSIGNED', | ||
'ADVOCATE_ASSIGNED', | ||
'DEFENDANTS_NOT_UPDATED_AT_COURT', | ||
'APPEAL_TO_COURT_OF_APPEALS', | ||
'APPEAL_RECEIVED_BY_COURT', | ||
'APPEAL_STATEMENT', | ||
'APPEAL_COMPLETED', | ||
'APPEAL_JUDGES_ASSIGNED', | ||
'APPEAL_CASE_FILES_UPDATED', | ||
'APPEAL_WITHDRAWN', | ||
'INDICTMENT_DENIED', | ||
'INDICTMENT_RETURNED', | ||
'INDICTMENTS_WAITING_FOR_CONFIRMATION', | ||
'SERVICE_SUCCESSFUL', // New value | ||
'SERVICE_FAILED', // New value | ||
'DEFENDANT_SELECTED_DEFENDER', // New value | ||
], | ||
enumName: 'enum_notification_type', | ||
}) | ||
}, | ||
|
||
down: (queryInterface) => { | ||
// replaceEnum does not support transactions | ||
return replaceEnum({ | ||
queryInterface, | ||
tableName: 'notification', | ||
columnName: 'type', | ||
newValues: [ | ||
'HEADS_UP', | ||
'READY_FOR_COURT', | ||
'RECEIVED_BY_COURT', | ||
'COURT_DATE', | ||
'RULING', | ||
'MODIFIED', | ||
'REVOKED', | ||
'DEFENDER_ASSIGNED', | ||
'DEFENDANTS_NOT_UPDATED_AT_COURT', | ||
'APPEAL_TO_COURT_OF_APPEALS', | ||
'APPEAL_RECEIVED_BY_COURT', | ||
'APPEAL_STATEMENT', | ||
'APPEAL_COMPLETED', | ||
'APPEAL_JUDGES_ASSIGNED', | ||
'APPEAL_CASE_FILES_UPDATED', | ||
'APPEAL_WITHDRAWN', | ||
'INDICTMENT_DENIED', | ||
'INDICTMENT_RETURNED', | ||
'INDICTMENTS_WAITING_FOR_CONFIRMATION', | ||
], | ||
enumName: 'enum_notification_type', | ||
}) | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
apps/judicial-system/backend/src/app/modules/notification/dto/subpoenaNotification.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { IsEnum, IsNotEmpty } from 'class-validator' | ||
|
||
import { ApiProperty } from '@nestjs/swagger' | ||
|
||
import { NotificationType } from '@island.is/judicial-system/types' | ||
|
||
import { Subpoena } from '../../subpoena' | ||
|
||
export class SubpoenaNotificationDto { | ||
@IsNotEmpty() | ||
@IsEnum(NotificationType) | ||
@ApiProperty({ enum: NotificationType }) | ||
readonly type!: NotificationType | ||
|
||
@IsNotEmpty() | ||
@ApiProperty({ type: Subpoena }) | ||
readonly subpoena!: Subpoena | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.