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

feat(j-s): Add subpoenaType to Defendant table #15198

Merged
merged 5 commits into from
Jun 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 @@ -7,6 +7,7 @@ import {
DefenderChoice,
Gender,
ServiceRequirement,
SubpoenaType,
} from '@island.is/judicial-system/types'

@InputType()
Expand Down Expand Up @@ -88,4 +89,9 @@ export class UpdateDefendantInput {
@IsOptional()
@Field(() => DefenderChoice, { nullable: true })
readonly defenderChoice?: DefenderChoice

@Allow()
@IsOptional()
@Field(() => SubpoenaType, { nullable: true })
readonly subpoenaType?: SubpoenaType
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ import {
DefenderChoice,
Gender,
ServiceRequirement,
SubpoenaType,
} from '@island.is/judicial-system/types'

registerEnumType(Gender, { name: 'Gender' })
registerEnumType(DefendantPlea, { name: 'DefendantPlea' })
registerEnumType(ServiceRequirement, { name: 'ServiceRequirement' })
registerEnumType(DefenderChoice, { name: 'DefenderChoice' })
registerEnumType(SubpoenaType, { name: 'SubpoenaType' })

@ObjectType()
export class Defendant {
Expand Down Expand Up @@ -73,4 +75,7 @@ export class Defendant {

@Field(() => Boolean, { nullable: true })
readonly acceptCompensationClaim?: boolean

@Field(() => SubpoenaType, { nullable: true })
readonly subpoenaType?: SubpoenaType
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.sequelize.transaction((t) =>
queryInterface.addColumn(
'defendant',
'subpoena_type',
{
type: Sequelize.STRING,
allowNull: true,
},
{ transaction: t },
),
)
},
oddsson marked this conversation as resolved.
Show resolved Hide resolved

down: (queryInterface) => {
return queryInterface.sequelize.transaction((t) =>
queryInterface.removeColumn('defendant', 'subpoena_type', {
transaction: t,
}),
)
},
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
DefenderChoice,
Gender,
ServiceRequirement,
SubpoenaType,
} from '@island.is/judicial-system/types'

export class UpdateDefendantDto {
Expand Down Expand Up @@ -84,4 +85,9 @@ export class UpdateDefendantDto {
@IsBoolean()
@ApiPropertyOptional({ type: Boolean })
readonly acceptCompensationClaim?: boolean

@IsOptional()
@IsEnum(SubpoenaType)
@ApiPropertyOptional({ enum: SubpoenaType })
readonly subpoenaType?: SubpoenaType
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
DefenderChoice,
Gender,
ServiceRequirement,
SubpoenaType,
} from '@island.is/judicial-system/types'

import { Case } from '../../case/models/case.model'
Expand Down Expand Up @@ -129,4 +130,12 @@ export class Defendant extends Model {
@Column({ type: DataType.BOOLEAN, allowNull: true })
@ApiPropertyOptional({ type: Boolean })
acceptCompensationClaim?: boolean

@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 @@ -25,6 +25,7 @@ query Case($input: CaseQueryInput!) {
serviceRequirement
verdictViewDate
verdictAppealDeadline
subpoenaType
}
defenderName
defenderNationalId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ mutation UpdateCase($input: UpdateCaseInput!) {
defenderPhoneNumber
defenderChoice
defendantPlea
subpoenaType
}
defenderName
defenderNationalId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import {
} from '@island.is/judicial-system-web/src/graphql/schema'
import { TempCase as Case } from '@island.is/judicial-system-web/src/types'

import { useCreateDefendantMutation } from './createDefendantt.generated'
import { useDeleteDefendantMutation } from './deleteDefendantt.generated'
import { useUpdateDefendantMutation } from './updateDefendantt.generated'
import { useCreateDefendantMutation } from './createDefendant.generated'
import { useDeleteDefendantMutation } from './deleteDefendant.generated'
import { useUpdateDefendantMutation } from './updateDefendant.generated'

const useDefendants = () => {
const { formatMessage } = useIntl()
Expand Down
2 changes: 1 addition & 1 deletion libs/judicial-system/types/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export { Feature } from './lib/feature'

export { Gender, DefenderChoice } from './lib/defendant'
export { Gender, DefenderChoice, SubpoenaType } from './lib/defendant'
export { InstitutionType } from './lib/institution'
export { NotificationType } from './lib/notification'
export type { Institution } from './lib/institution'
Expand Down
5 changes: 5 additions & 0 deletions libs/judicial-system/types/src/lib/defendant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,8 @@ export enum DefenderChoice {
DELAY = 'DELAY', // Delay choice
DELEGATE = 'DELEGATE', // Delegate choice to judge
}

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