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 subpoena type to case table #15167

Closed
wants to merge 2 commits into from
Closed
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 @@ -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,
oddsson marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -228,6 +228,11 @@ export enum IndictmentDecision {
REDISTRIBUTING = 'REDISTRIBUTING',
}

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

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