-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(j-s): Connect case files to defendant or civil claimants (#17043)
* Add a send to fmst button that routes to a page * Remove unused code * Add UI * Create event log when indictment is sent to FMSt * Create event log when indictment is sent to FMSt * Create event log when indictment is sent to FMSt * Refactor * Refactor * Refactor * Updates FMST queries * Refactor * Refactor * Refactor * Refactor * Add DefendantEventLog table * Refactor * Send sentToPrisonAdminDate to client * Show sent to prison admin date on info cards * Refactor * Refactor * Refactor * Refactor * Refactor * Refactor * Refactor * Refactor * Refactor * Refactor * Refactor * Refactor * Frontend: Upload file to prison admin * Frontend: Upload file to prison admin * Add SentToPrisonAdmin tag in cases list for PP * Merge * Refactor * Refactor * Refactor * Refactor * Refactor * Refactor * Refactor * Refactor * chore(j-s): Notifications to prison when indictment sent or withdrawn * fix(j-s): Test fix * chore: charts update dirty files * fix(j-s): Tests * chore: nx format:write update dirty files * Refactor * Remove caseId from defendant event log table * Remove caseId from defendant event log table * Revert * Remove unused code * Refactor * Removes unused event type * Removes the defendant event log from the api * Moves defendant event log to defendant model * Fixes backend case retrieval * test(j-s): add missing test * fix(j-s): Tests * Update civilClaimantNotification.service.ts * feat(j-s): Connect case files to defendant or civil claimant * Fixes backend endpoints * Changes wording * Removes duplicate notification types * Blocks limited acces create civil claimant file for now * Adds back category restiction guards when creating files for defendants and civil claimants * Removes redundant arguments * Removes unused imports * Rewrites create case file api * Rewrites use S3 upload * Fixes argument declarations --------- Co-authored-by: Ívar Oddsson <[email protected]> Co-authored-by: Guðjón Guðjónsson <[email protected]> Co-authored-by: andes-it <[email protected]>
- Loading branch information
1 parent
8140945
commit 5815544
Showing
22 changed files
with
556 additions
and
58 deletions.
There are no files selected for viewing
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
12 changes: 12 additions & 0 deletions
12
apps/judicial-system/api/src/app/modules/file/dto/createCivilClaimantFile.input.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,12 @@ | ||
import { Allow } from 'class-validator' | ||
|
||
import { Field, ID, InputType } from '@nestjs/graphql' | ||
|
||
import { CreateFileInput } from './createFile.input' | ||
|
||
@InputType() | ||
export class CreateCivilClaimantFileInput extends CreateFileInput { | ||
@Allow() | ||
@Field(() => ID) | ||
readonly civilClaimantId!: string | ||
} |
12 changes: 12 additions & 0 deletions
12
apps/judicial-system/api/src/app/modules/file/dto/createDefendantFile.input.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,12 @@ | ||
import { Allow } from 'class-validator' | ||
|
||
import { Field, ID, InputType } from '@nestjs/graphql' | ||
|
||
import { CreateFileInput } from './createFile.input' | ||
|
||
@InputType() | ||
export class CreateDefendantFileInput extends CreateFileInput { | ||
@Allow() | ||
@Field(() => ID) | ||
readonly defendantId!: string | ||
} |
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
44 changes: 44 additions & 0 deletions
44
apps/judicial-system/backend/migrations/20241122091513-update-case-file.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,44 @@ | ||
'use strict' | ||
|
||
module.exports = { | ||
up: (queryInterface, Sequelize) => { | ||
return queryInterface.sequelize.transaction(async (t) => { | ||
await queryInterface.addColumn( | ||
'case_file', | ||
'defendant_id', | ||
{ | ||
type: Sequelize.UUID, | ||
references: { | ||
model: 'defendant', | ||
key: 'id', | ||
}, | ||
allowNull: true, | ||
}, | ||
{ transaction: t }, | ||
) | ||
await queryInterface.addColumn( | ||
'case_file', | ||
'civil_claimant_id', | ||
{ | ||
type: Sequelize.UUID, | ||
references: { | ||
model: 'civil_claimant', | ||
key: 'id', | ||
}, | ||
allowNull: true, | ||
}, | ||
{ transaction: t }, | ||
) | ||
}) | ||
}, | ||
down: (queryInterface) => { | ||
return queryInterface.sequelize.transaction(async (t) => { | ||
await queryInterface.removeColumn('case_file', 'civil_claimant_id', { | ||
transaction: t, | ||
}) | ||
await queryInterface.removeColumn('case_file', 'defendant_id', { | ||
transaction: t, | ||
}) | ||
}) | ||
}, | ||
} |
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
25 changes: 25 additions & 0 deletions
25
.../judicial-system/backend/src/app/modules/file/guards/createCivilClaimantCaseFile.guard.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,25 @@ | ||
import { | ||
CanActivate, | ||
ExecutionContext, | ||
ForbiddenException, | ||
Injectable, | ||
} from '@nestjs/common' | ||
|
||
import { CaseFileCategory } from '@island.is/judicial-system/types' | ||
|
||
@Injectable() | ||
export class CreateCivilClaimantCaseFileGuard implements CanActivate { | ||
canActivate(context: ExecutionContext): boolean { | ||
const request = context.switchToHttp().getRequest() | ||
|
||
const caseFileCategory: CaseFileCategory = request.body?.category | ||
|
||
if (caseFileCategory !== CaseFileCategory.CIVIL_CLAIM) { | ||
throw new ForbiddenException( | ||
`Forbidden for case file category ${caseFileCategory}`, | ||
) | ||
} | ||
|
||
return true | ||
} | ||
} |
Oops, something went wrong.