Skip to content

Commit

Permalink
Merge branch 'main' into j-s/subpoena-pdf-court
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Dec 19, 2024
2 parents bced407 + 68f32f0 commit df1a1aa
Show file tree
Hide file tree
Showing 499 changed files with 13,171 additions and 6,634 deletions.
779 changes: 393 additions & 386 deletions .github/CODEOWNERS

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions apps/contentful-apps/pages/fields/admin-only-boolean-field.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { FieldExtensionSDK } from '@contentful/app-sdk'
import { Paragraph } from '@contentful/f36-components'
import { BooleanEditor } from '@contentful/field-editor-boolean'
import { useSDK } from '@contentful/react-apps-toolkit'

const AdminOnlyBooleanField = () => {
const sdk = useSDK<FieldExtensionSDK>()

if (!sdk.user.spaceMembership.admin) {
return <Paragraph>(Only admins can edit this field)</Paragraph>
}

return <BooleanEditor field={sdk.field} isInitiallyDisabled={false} />
}

export default AdminOnlyBooleanField
2 changes: 0 additions & 2 deletions apps/download-service/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ import {
WorkMachinesClientConfig,
WorkMachinesClientModule,
} from '@island.is/clients/work-machines'
import { HealthPaymentsOverviewController } from './modules/health/payment-overview-documents.controller'
import {
RightsPortalClientConfig,
RightsPortalClientModule,
Expand All @@ -70,7 +69,6 @@ import {
RegulationDocumentsController,
WorkMachinesController,
OccupationalLicensesController,
HealthPaymentsOverviewController,
],
imports: [
AuditModule.forRoot(environment.audit),
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,17 @@ export class BackendService extends DataSource<{ req: Request }> {
)
}

limitedAccessUpdateDefendant(
caseId: string,
defendantId: string,
updateDefendant: unknown,
): Promise<Defendant> {
return this.patch(
`case/${caseId}/limitedAccess/defendant/${defendantId}`,
updateDefendant,
)
}

deleteDefendant(
caseId: string,
defendantId: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@ import { Module } from '@nestjs/common'

import { CivilClaimantResolver } from './civilClaimant.resolver'
import { DefendantResolver } from './defendant.resolver'
import { LimitedAccessDefendantResolver } from './limitedAccessDefendant.resolver'

@Module({
providers: [DefendantResolver, CivilClaimantResolver],
providers: [
DefendantResolver,
CivilClaimantResolver,
LimitedAccessDefendantResolver,
],
})
export class DefendantModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
DefendantPlea,
DefenderChoice,
Gender,
PunishmentType,
ServiceRequirement,
SubpoenaType,
} from '@island.is/judicial-system/types'
Expand Down Expand Up @@ -114,4 +115,9 @@ export class UpdateDefendantInput {
@IsOptional()
@Field(() => Boolean, { nullable: true })
readonly isSentToPrisonAdmin?: boolean

@Allow()
@IsOptional()
@Field(() => PunishmentType, { nullable: true })
readonly punishmentType?: PunishmentType
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { Inject, UseGuards } from '@nestjs/common'
import { Args, Context, Mutation, Resolver } from '@nestjs/graphql'

import type { Logger } from '@island.is/logging'
import { LOGGER_PROVIDER } from '@island.is/logging'

import {
AuditedAction,
AuditTrailService,
} from '@island.is/judicial-system/audit-trail'
import {
CurrentGraphQlUser,
JwtGraphQlAuthGuard,
} from '@island.is/judicial-system/auth'
import type { User } from '@island.is/judicial-system/types'

import { BackendService } from '../backend'
import { UpdateDefendantInput } from './dto/updateDefendant.input'
import { Defendant } from './models/defendant.model'

@UseGuards(JwtGraphQlAuthGuard)
@Resolver()
export class LimitedAccessDefendantResolver {
constructor(
private readonly auditTrailService: AuditTrailService,
@Inject(LOGGER_PROVIDER)
private readonly logger: Logger,
) {}

@Mutation(() => Defendant, { nullable: true })
limitedAccessUpdateDefendant(
@Args('input', { type: () => UpdateDefendantInput })
input: UpdateDefendantInput,
@CurrentGraphQlUser() user: User,
@Context('dataSources')
{ backendService }: { backendService: BackendService },
): Promise<Defendant> {
const { caseId, defendantId, ...updateDefendant } = input
this.logger.debug(
`Updating limitedAccess defendant ${defendantId} for case ${caseId}`,
)

return this.auditTrailService.audit(
user.id,
AuditedAction.UPDATE_DEFENDANT,
backendService.limitedAccessUpdateDefendant(
caseId,
defendantId,
updateDefendant,
),
defendantId,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
DefendantPlea,
DefenderChoice,
Gender,
PunishmentType,
ServiceRequirement,
SubpoenaType,
} from '@island.is/judicial-system/types'
Expand All @@ -15,6 +16,7 @@ registerEnumType(DefendantPlea, { name: 'DefendantPlea' })
registerEnumType(ServiceRequirement, { name: 'ServiceRequirement' })
registerEnumType(DefenderChoice, { name: 'DefenderChoice' })
registerEnumType(SubpoenaType, { name: 'SubpoenaType' })
registerEnumType(PunishmentType, { name: 'PunishmentType' })

@ObjectType()
export class Defendant {
Expand Down Expand Up @@ -107,4 +109,10 @@ export class Defendant {

@Field(() => String, { nullable: true })
readonly sentToPrisonAdminDate?: string

@Field(() => String, { nullable: true })
readonly openedByPrisonAdminDate?: string

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

module.exports = {
async up(queryInterface, Sequelize) {
return queryInterface.sequelize.transaction((t) =>
Promise.all([
queryInterface.addColumn(
'defendant',
'punishment_type',
{
type: Sequelize.STRING,
allowNull: true,
},
{ transaction: t },
),
]),
)
},
async down(queryInterface, Sequelize) {
return queryInterface.sequelize.transaction((t) =>
queryInterface.removeColumn('defendant', 'punishment_type', {
transaction: t,
}),
)
},
}
15 changes: 15 additions & 0 deletions apps/judicial-system/backend/src/app/messages/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -856,4 +856,19 @@ export const notifications = {
description: 'Texti í pósti til aðila máls þegar ný gögn eru send',
},
}),
courtOfficialAssignedEmail: defineMessages({
subject: {
id: 'judicial.system.backend:notifications.court_official_assigned_email.subject',
defaultMessage: 'Úthlutun máls {courtCaseNumber}',
description:
'Fyrirsögn í pósti til dómara og dómritara þegar máli er úthlutað á þau',
},
body: {
id: 'judicial.system.backend:notifications.court_official_assigned_email.body',
defaultMessage:
'Héraðsdómur hefur skráð þig sem {role, select, DISTRICT_COURT_JUDGE {dómara} DISTRICT_COURT_REGISTRAR {dómritara} other {óþekkt}} í máli {courtCaseNumber}. Hægt er að nálgast gögn málsins á {linkStart}yfirlitssíðu málsins í Réttarvörslugátt{linkEnd}',
description:
'Texti í pósti til dómara og dómritara þegar máli er úthlutað á þau',
},
}),
}
Loading

0 comments on commit df1a1aa

Please sign in to comment.