Skip to content

Commit

Permalink
Merge branch 'main' into feat/application-system-config
Browse files Browse the repository at this point in the history
  • Loading branch information
norda-gunni authored Sep 4, 2024
2 parents 5f6d8ef + 9279407 commit 4639d51
Show file tree
Hide file tree
Showing 91 changed files with 1,264 additions and 1,333 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

/* @island-is/core
/libs/api/domains/identity/ @island-is/core
# Edge case escaping the /infra/ and **/infra/ devops patterns below
/libs/infra-nest-server/src/lib/infra/ @island-is/core
/libs/testing/ @island-is/core
/libs/nest/swagger/ @island-is/core

Expand Down
6 changes: 3 additions & 3 deletions apps/application-system/api/infra/application-system-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const workerSetup =
},
XROAD_CHARGE_FJS_V2_PATH: {
dev: 'IS-DEV/GOV/10021/FJS-Public/chargeFJS_v2',
staging: 'IS-DEV/GOV/10021/FJS-Public/chargeFJS_v2',
staging: 'IS-TEST/GOV/10021/FJS-Public/chargeFJS_v2',
prod: 'IS/GOV/5402697509/FJS-Public/chargeFJS_v2',
},
APPLICATION_ATTACHMENT_BUCKET: {
Expand Down Expand Up @@ -221,12 +221,12 @@ export const serviceSetup = (services: {
),
XROAD_COURT_BANKRUPTCY_CERT_PATH: {
dev: 'IS-DEV/GOV/10019/Domstolasyslan/JusticePortal-v1',
staging: 'IS-DEV/GOV/10019/Domstolasyslan/JusticePortal-v1',
staging: 'IS-TEST/GOV/10019/Domstolasyslan/JusticePortal-v1',
prod: 'IS/GOV/4707171140/Domstolasyslan/JusticePortal-v1',
},
XROAD_ALTHINGI_OMBUDSMAN_SERVICE_PATH: {
dev: 'IS-DEV/GOV/10047/UA-Protected/kvortun-v1/',
staging: 'IS-DEV/GOV/10047/UA-Protected/kvortun-v1/',
staging: 'IS-TEST/GOV/10047/UA-Protected/kvortun-v1/',
prod: 'IS/GOV/5605882089/UA-Protected/kvortun-v1',
},
NOVA_ACCEPT_UNAUTHORIZED: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export class CaseController {

const createdCase = await this.caseService.create(caseToCreate, user)

this.eventService.postEvent(CaseEvent.CREATE, createdCase as Case)
this.eventService.postEvent('CREATE', createdCase)

return createdCase
}
Expand Down Expand Up @@ -419,10 +419,7 @@ export class CaseController {
)

// No need to wait
this.eventService.postEvent(
transition.transition as unknown as CaseEvent,
updatedCase ?? theCase,
)
this.eventService.postEvent(transition.transition, updatedCase ?? theCase)

return updatedCase ?? theCase
}
Expand Down Expand Up @@ -891,7 +888,7 @@ export class CaseController {

const extendedCase = await this.caseService.extend(theCase, user)

this.eventService.postEvent(CaseEvent.EXTEND, extendedCase as Case)
this.eventService.postEvent('EXTEND', extendedCase as Case)

return extendedCase
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1671,7 +1671,7 @@ export class CaseService {
await this.addMessagesForUpdatedCaseToQueue(theCase, updatedCase, user)

if (receivingCase) {
this.eventService.postEvent(CaseEvent.RECEIVE, updatedCase)
this.eventService.postEvent(CaseTransition.RECEIVE, updatedCase)
}

if (returnUpdatedCase) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class InternalCaseController {

const createdCase = await this.internalCaseService.create(caseToCreate)

this.eventService.postEvent(CaseEvent.CREATE_XRD, createdCase as Case)
this.eventService.postEvent('CREATE_XRD', createdCase as Case)

return createdCase
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ export class InternalCaseService {
)
})

this.eventService.postEvent(CaseEvent.ARCHIVE, theCase)
this.eventService.postEvent('ARCHIVE', theCase)

return { caseArchived: true }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,7 @@ export class LimitedAccessCaseController {
user,
)

this.eventService.postEvent(
transition.transition as unknown as CaseEvent,
updatedCase,
)
this.eventService.postEvent(transition.transition, updatedCase)

return updatedCase
}
Expand Down
73 changes: 34 additions & 39 deletions apps/judicial-system/backend/src/app/modules/event/event.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ import {
formatDate,
readableIndictmentSubtypes,
} from '@island.is/judicial-system/formatters'
import { isIndictmentCase } from '@island.is/judicial-system/types'
import {
CaseTransition,
isIndictmentCase,
} from '@island.is/judicial-system/types'

import { type Case } from '../case'
import { DateLog } from '../case/models/dateLog.model'
Expand All @@ -37,50 +40,42 @@ const errorEmojis = [
':x:',
]

const caseEvent = {
const caseEvent: Record<CaseEvent, string> = {
[CaseTransition.ACCEPT]: ':white_check_mark: Samþykkt',
[CaseTransition.APPEAL]: ':judge: Kæra',
ARCHIVE: ':file_cabinet: Sett í geymslu',
[CaseTransition.ASK_FOR_CANCELLATION]: ':interrobang: Beðið um aftuköllun',
[CaseTransition.ASK_FOR_CONFIRMATION]: ':question: Beðið um staðfestingu',
[CaseTransition.COMPLETE]: ':white_check_mark: Lokið',
[CaseTransition.COMPLETE_APPEAL]: ':white_check_mark: Kæru lokið',
[CaseTransition.DELETE]: ':fire: Afturkallað',
[CaseTransition.DENY_INDICTMENT]: ':no_entry_sign: Ákæru hafnað',
[CaseTransition.DISMISS]: ':woman-shrugging: Vísað frá',
CREATE: ':new: Mál stofnað',
CREATE_XRD: ':new: Mál stofnað í gegnum Strauminn',
EXTEND: ':recycle: Mál framlengt',
OPEN: ':unlock: Opnað fyrir dómstól',
ASK_FOR_CONFIRMATION: ':question: Beðið um staðfestingu',
SUBMIT: ':mailbox_with_mail: Sent',
[CaseTransition.OPEN]: ':unlock: Opnað fyrir dómstól',
[CaseTransition.RECEIVE]: ':eyes: Móttekið',
[CaseTransition.RECEIVE_APPEAL]: ':eyes: Kæra móttekin',
[CaseTransition.REJECT]: ':negative_squared_cross_mark: Hafnað',
[CaseTransition.REOPEN]: ':construction: Opnað aftur',
[CaseTransition.REOPEN_APPEAL]: ':building_construction: Kæra opnuð aftur',
RESUBMIT: ':mailbox_with_mail: Sent aftur',
RECEIVE: ':eyes: Móttekið',
ACCEPT: ':white_check_mark: Samþykkt',
REJECT: ':negative_squared_cross_mark: Hafnað',
DISMISS: ':woman-shrugging: Vísað frá',
COMPLETE: ':white_check_mark: Lokið',
DELETE: ':fire: Afturkallað',
[CaseTransition.RETURN_INDICTMENT]: ':woman-gesturing-no: Ákæru afturkallað',
SCHEDULE_COURT_DATE: ':timer_clock: Fyrirtökutíma úthlutað',
ARCHIVE: ':file_cabinet: Sett í geymslu',
REOPEN: ':construction: Opnað aftur',
APPEAL: ':judge: Kæra',
RECEIVE_APPEAL: ':eyes: Kæra móttekin',
COMPLETE_APPEAL: ':white_check_mark: Kæru lokið',
REOPEN_APPEAL: ':building_construction: Kæra opnuð aftur',
[CaseTransition.SUBMIT]: ':mailbox_with_mail: Sent',
[CaseTransition.WITHDRAW_APPEAL]:
':leftwards_arrow_with_hook: Kæru afturkallað',
}

export enum CaseEvent {
CREATE = 'CREATE',
CREATE_XRD = 'CREATE_XRD',
EXTEND = 'EXTEND',
OPEN = 'OPEN',
ASK_FOR_CONFIRMATION = 'ASK_FOR_CONFIRMATION',
SUBMIT = 'SUBMIT',
RESUBMIT = 'RESUBMIT',
RECEIVE = 'RECEIVE',
ACCEPT = 'ACCEPT',
REJECT = 'REJECT',
DELETE = 'DELETE',
SCHEDULE_COURT_DATE = 'SCHEDULE_COURT_DATE',
DISMISS = 'DISMISS',
ARCHIVE = 'ARCHIVE',
REOPEN = 'REOPEN',
APPEAL = 'APPEAL',
RECEIVE_APPEAL = 'RECEIVE_APPEAL',
COMPLETE_APPEAL = 'COMPLETE_APPEAL',
REOPEN_APPEAL = 'REOPEN_APPEAL',
}
export type CaseEvent =
| CaseTransition
| 'ARCHIVE'
| 'CREATE'
| 'CREATE_XRD'
| 'EXTEND'
| 'RESUBMIT'
| 'SCHEDULE_COURT_DATE'

@Injectable()
export class EventService {
Expand Down Expand Up @@ -120,7 +115,7 @@ export class EventService {
? `\n>Landsréttur *${theCase.appealCaseNumber}*`
: ''
const extraText =
event === CaseEvent.SCHEDULE_COURT_DATE
event === 'SCHEDULE_COURT_DATE'
? `\n>Dómari ${
theCase.judge?.name ?? 'er ekki skráður'
}\n>Dómritari ${
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ export class InternalNotificationService extends BaseNotificationService {
} else if (theCase.state === CaseState.RECEIVED) {
promises.push(this.sendResubmittedToCourtSmsNotificationToCourt(theCase))

this.eventService.postEvent(CaseEvent.RESUBMIT, theCase)
this.eventService.postEvent('RESUBMIT', theCase)
}

if (
Expand Down Expand Up @@ -768,7 +768,7 @@ export class InternalNotificationService extends BaseNotificationService {
theCase: Case,
user: User,
): Promise<DeliverResponse> {
this.eventService.postEvent(CaseEvent.SCHEDULE_COURT_DATE, theCase)
this.eventService.postEvent('SCHEDULE_COURT_DATE', theCase)

const promises: Promise<Recipient>[] = []

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,7 @@ export class NotificationService {
break
case NotificationType.COURT_DATE:
if (eventOnly) {
this.eventService.postEvent(
CaseEvent.SCHEDULE_COURT_DATE,
theCase,
true,
)
this.eventService.postEvent('SCHEDULE_COURT_DATE', theCase, true)

// We still want to send the defender a link to the case even if
// the judge chooses not to send a calendar invitation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ class IndictmentCaseData {
@ApiProperty({ type: String })
caseNumber!: string

@ApiProperty({ type: Boolean })
acknowledged?: boolean

@ApiProperty({ type: [Groups] })
groups!: Groups[]
}
Expand All @@ -37,6 +40,7 @@ export class CaseResponse {
caseId: res.id,
data: {
caseNumber: `${t.caseNumber} ${res.courtCaseNumber}`,
acknowledged: false, // TODO: Connect to real data
groups: [
{
label: t.defendant,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ class SubpoenaData {
@ApiProperty({ type: () => String })
title!: string

@ApiProperty({ type: Boolean })
acknowledged?: boolean

@ApiProperty({ type: () => [Groups] })
groups!: Groups[]
}
Expand Down Expand Up @@ -60,12 +63,13 @@ export class SubpoenaResponse {
(dateLog) => dateLog.dateType === DateType.ARRAIGNMENT_DATE,
)
const arraignmentDate = subpoenaDateLog?.date ?? ''
const subpoenaCreatedDate = subpoenaDateLog?.created ?? ''
const subpoenaCreatedDate = subpoenaDateLog?.created ?? '' //TODO: Change to subpoena created in RLS

return {
caseId: internalCase.id,
data: {
title: t.subpoena,
acknowledged: false, // TODO: Connect to real data
groups: [
{
label: `${t.caseNumber} ${internalCase.courtCaseNumber}`,
Expand Down
12 changes: 0 additions & 12 deletions apps/judicial-system/web/messages/Core/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,16 +127,4 @@ export const errors = defineMessages({
defaultMessage: 'Upp kom villa við að opna skjal',
description: 'Notaður sem villuskilaboð þegar ekki gengur að opna skjal',
},
invalidDateErrorMessage: {
id: 'judicial.system.core:errors.invalid_date_error_message',
defaultMessage:
'Ekki tókst að uppfæra skjal, dagsetning er ekki á réttu formi',
description:
'Notaður sem villuboð þegar tekst ekki að uppfæra dagsetningu á skjali.',
},
renameFailedErrorMessage: {
id: 'judicial.system.core:errors.rename_failed_error_message',
defaultMessage: 'Ekki tókst að endurnefna skjal',
description: 'Notaður sem villuboð þegar endurnefning á skjali mistókst.',
},
})
Loading

0 comments on commit 4639d51

Please sign in to comment.