Skip to content

Commit

Permalink
Add subpoena type to case table
Browse files Browse the repository at this point in the history
  • Loading branch information
oddsson committed Jun 10, 2024
1 parent 0c9cbae commit d78dc83
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
IndictmentDecision,
RequestSharedWithDefender,
SessionArrangements,
SubpoenaType,
UserRole,
} from '@island.is/judicial-system/types'

Expand Down Expand Up @@ -495,4 +496,9 @@ export class UpdateCaseInput {
@IsOptional()
@Field(() => IndictmentDecision, { nullable: true })
readonly indictmentDecision?: IndictmentDecision

@Allow()
@IsOptional()
@Field(() => SubpoenaType, { nullable: true })
readonly subpoenaType?: SubpoenaType
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
IndictmentDecision,
RequestSharedWithDefender,
SessionArrangements,
SubpoenaType,
UserRole,
} from '@island.is/judicial-system/types'

Expand Down Expand Up @@ -53,6 +54,7 @@ registerEnumType(IndictmentCaseReviewDecision, {
name: 'IndictmentCaseReviewDecision',
})
registerEnumType(IndictmentDecision, { name: 'IndictmentDecision' })
registerEnumType(SubpoenaType, { name: 'SubpoenaType' })

@ObjectType()
class DateLog {
Expand Down Expand Up @@ -439,4 +441,7 @@ export class Case {

@Field(() => IndictmentDecision, { nullable: true })
readonly indictmentDecision?: IndictmentDecision

@Field(() => SubpoenaType, { nullable: true })
readonly subpoenaType?: SubpoenaType
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
'use strict'

module.exports = {
async up(queryInterface, Sequelize) {
return queryInterface.sequelize.transaction((t) =>
queryInterface.addColumn(
'case',
'subpoena_type',
{
type: Sequelize.STRING,
allowNull: true,
},
{ transaction: t },
),
)
},

async down(queryInterface) {
return queryInterface.sequelize.transaction((t) =>
queryInterface.removeColumn('case', 'subpoena_type', {
transaction: t,
}),
)
},
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
IndictmentDecision,
RequestSharedWithDefender,
SessionArrangements,
SubpoenaType,
UserRole,
} from '@island.is/judicial-system/types'

Expand Down Expand Up @@ -502,4 +503,9 @@ export class UpdateCaseDto {
@IsEnum(IndictmentDecision)
@ApiPropertyOptional({ enum: IndictmentDecision })
readonly indictmentDecision?: IndictmentDecision

@IsOptional()
@IsEnum(SubpoenaType)
@ApiPropertyOptional({ enum: SubpoenaType })
readonly subpoenaType?: SubpoenaType
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ const districtCourtFields: (keyof UpdateCaseDto)[] = [
'postponedIndefinitelyExplanation',
'indictmentRulingDecision',
'indictmentDecision',
'subpoenaType',
]

const courtOfAppealsFields: (keyof UpdateCaseDto)[] = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {
IndictmentDecision,
RequestSharedWithDefender,
SessionArrangements,
SubpoenaType,
UserRole,
} from '@island.is/judicial-system/types'

Expand Down Expand Up @@ -1033,4 +1034,15 @@ export class Case extends Model {
@Column({ type: DataType.STRING, allowNull: true })
@ApiPropertyOptional({ type: String })
indictmentHash?: string

/**********
* The type of subpoena in indictment cases
**********/
@Column({
type: DataType.ENUM,
allowNull: true,
values: Object.values(SubpoenaType),
})
@ApiPropertyOptional({ enum: SubpoenaType })
subpoenaType?: SubpoenaType
}
Original file line number Diff line number Diff line change
Expand Up @@ -264,5 +264,6 @@ query Case($input: CaseQueryInput!) {
indictmentVerdictViewedByAll
indictmentVerdictAppealDeadline
indictmentDecision
subpoenaType
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -220,5 +220,6 @@ mutation UpdateCase($input: UpdateCaseInput!) {
indictmentDeniedExplanation
indictmentReturnedExplanation
indictmentDecision
subpoenaType
}
}
1 change: 1 addition & 0 deletions libs/judicial-system/types/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export {
isRequestCaseState,
isIndictmentCaseTransition,
isRequestCaseTransition,
SubpoenaType,
} from './lib/case'
export type {
CrimeScene,
Expand Down
5 changes: 5 additions & 0 deletions libs/judicial-system/types/src/lib/case.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,11 @@ export enum IndictmentDecision {
REDISTRIBUTING = 'REDISTRIBUTING',
}

export enum SubpoenaType {
ABSENCE = 'ABSENCE',
ARREST = 'ARREST',
}

export enum CaseAppealRulingDecision {
ACCEPTING = 'ACCEPTING',
REPEAL = 'REPEAL',
Expand Down

0 comments on commit d78dc83

Please sign in to comment.