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: Sync helm templates #16870

Closed
wants to merge 6 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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 2 additions & 7 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
/apps/icelandic-names-registry*/ @island-is/juni
/apps/web/screens/PetitionView/ @island-is/juni
/libs/cms/ @island-is/juni @island-is/stefna
/libs/clients/cms/ @island-is/juni @island-is/aranja
/libs/residence-history @island-is/juni
/libs/api/domains/endorsement-system @island-is/juni
/libs/api/domains/icelandic-names-registry/ @island-is/juni
Expand Down Expand Up @@ -131,9 +130,6 @@ codemagic.yaml
/apps/portals/my-pages*/ @island-is/hugsmidjan
/apps/services/regulations-admin-backend/ @island-is/hugsmidjan
/apps/services/user-profile/ @island-is/hugsmidjan @island-is/juni @island-is/aranja
/apps/web/components/Grant/ @island-is/hugsmidjan
/apps/web/components/PlazaCard/ @island-is/hugsmidjan
/apps/web/screens/Grants/ @island-is/hugsmidjan
/apps/web/screens/Regulations/ @island-is/hugsmidjan
/apps/web/components/Regulations/ @island-is/hugsmidjan
/apps/web/screens/OfficialJournalOfIceland/ @island-is/hugsmidjan
Expand Down Expand Up @@ -198,8 +194,7 @@ codemagic.yaml
/libs/portals/admin/regulations-admin/ @island-is/hugsmidjan
/libs/portals/admin/document-provider/ @island-is/hugsmidjan @island-is/core
/libs/clients/icelandic-health-insurance/rights-portal/ @island-is/hugsmidjan
/libs/clients/health-directorate @island-is/hugsmidjan
/libs/clients/health-directorate/src/lib/clients/occupational-license @island-is/hugsmidjan @island-is/origo
/libs/clients/health-directorate @island-is/hugsmidjan @island-is/origo
/libs/clients/mms/grade @island-is/hugsmidjan
/libs/portals/admin/air-discount-scheme @island-is/hugsmidjan
/libs/application/templates/official-journal-of-iceland/ @island-is/hugsmidjan
Expand Down Expand Up @@ -393,7 +388,7 @@ codemagic.yaml

# QA
/apps/system-e2e/ @island-is/qa
/libs/testing/e2e @island-is/qa
/libs/testing/e2e @island-is/qa

# Islandis
/apps/system-e2e/src/tests/islandis/admin-portal/ @island-is/aranja
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Run on whenever you check out a branch:

```bash
yarn install
(cd infra/ && yarn install)
yarn infra install
yarn codegen
```

Expand Down
8 changes: 4 additions & 4 deletions apps/application-system/api/infra/application-system-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,11 +346,11 @@ export const serviceSetup = (services: {
})
.db()
.migrations()
.liveness({ path: '/liveness', initialDelaySeconds: 20 })
.readiness({ path: '/liveness', initialDelaySeconds: 20 })
.liveness('/liveness')
.readiness('/liveness')
.resources({
limits: { cpu: '600m', memory: '1024Mi' },
requests: { cpu: '200m', memory: '512Mi' },
limits: { cpu: '400m', memory: '1024Mi' },
requests: { cpu: '75m', memory: '512Mi' },
})
.replicaCount({
default: 2,
Expand Down
12 changes: 12 additions & 0 deletions apps/judicial-system/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,18 @@ You can serve this service locally by running:
yarn start judicial-system-xrd-api
```

## Robot API

This service is for access through xRoad.

### Running locally

You can serve this service locally by running:

```bash
yarn start judicial-system-robot-api
```

## Digital Mailbox API

This service is for access through xRoad.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
} from '@island.is/judicial-system/types'

import {
filterWhitelistEmails,
formatCourtHeadsUpSmsNotification,
formatCourtReadyForCourtSmsNotification,
formatCourtResubmittedToCourtSmsNotification,
Expand Down Expand Up @@ -1983,38 +1982,3 @@ describe('formatDefenderResubmittedToCourtEmailNotification', () => {
expect(result.subject).toEqual('Krafa í máli R-2022/999')
})
})

describe('filterWhitelistEmails', () => {
const emails = [
'test@rvg.is',
'test2@rvg.is',
'test3@rvg.is',
'test4@example.com',
]

it('should return only whitelisted emails', () => {
const whitelist = `${emails[0]}, ${emails[2]}`
const domainWhitelist = 'example.com'

const result = filterWhitelistEmails(emails, domainWhitelist, whitelist)

expect(result).toEqual([emails[0], emails[2], emails[3]])
})

it('should return empty array if no emails are whitelisted', () => {
const whitelist = ''
const domainWhitelist = ''

const result = filterWhitelistEmails(emails, domainWhitelist, whitelist)

expect(result).toEqual([])
})
it('should return domain whitelisted emails', () => {
const whitelist = ''
const domainWhitelist = 'rvg.is'

const result = filterWhitelistEmails(emails, domainWhitelist, whitelist)

expect(result).toEqual([emails[0], emails[1], emails[2]])
})
})
71 changes: 43 additions & 28 deletions apps/judicial-system/backend/src/app/formatters/formatters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,49 @@ export const formatCustodyRestrictions = (
})
}

export const formatAdvocateAssignedEmailNotification = (
formatMessage: FormatMessage,
theCase: Case,
advocateType: AdvocateType,
overviewUrl?: string,
): SubjectAndBody => {
const subject =
advocateType === AdvocateType.DEFENDER
? formatMessage(
notifications.advocateAssignedEmail.subjectAccessToCaseFiles,
{
court: capitalize(theCase.court?.name ?? ''),
},
)
: formatMessage(notifications.advocateAssignedEmail.subjectAccess, {
courtCaseNumber: theCase.courtCaseNumber,
})

const body =
advocateType === AdvocateType.DEFENDER
? formatMessage(
notifications.advocateAssignedEmail.bodyAccessToCaseFiles,
{
defenderHasAccessToRVG: Boolean(overviewUrl),
courtCaseNumber: capitalize(theCase.courtCaseNumber ?? ''),
court: theCase.court?.name ?? '',
courtName: theCase.court?.name.replace('dómur', 'dómi') ?? '',
linkStart: `<a href="${overviewUrl}">`,
linkEnd: '</a>',
},
)
: formatMessage(notifications.advocateAssignedEmail.bodyAccess, {
defenderHasAccessToRVG: Boolean(overviewUrl),
court: theCase.court?.name,
advocateType,
courtCaseNumber: capitalize(theCase.courtCaseNumber ?? ''),
linkStart: `<a href="${overviewUrl}">`,
linkEnd: '</a>',
})

return { body, subject }
}

export const formatCourtOfAppealJudgeAssignedEmailNotification = (
formatMessage: FormatMessage,
caseNumber: string,
Expand Down Expand Up @@ -759,31 +802,3 @@ export const formatDefenderRoute = (

export const formatConfirmedIndictmentKey = (key?: string) =>
key?.replace(/\/([^/]*)$/, '/confirmed/$1') ?? ''

export const filterWhitelistEmails = (
emails: string[],
domainWhitelist: string,
emailWhitelist: string,
) => {
if (!emails || emails.length === 0) return []

const allowedDomains = new Set(
domainWhitelist
.split(',')
.map((d) => d.trim())
.filter(Boolean),
)
const allowedEmails = new Set(
emailWhitelist
.split(',')
.map((e) => e.trim())
.filter(Boolean),
)

return emails.filter((email) => {
const domain = email.split('@')[1]
return (
domain && (allowedDomains.has(domain) || allowedEmails.has(email.trim()))
)
})
}
2 changes: 1 addition & 1 deletion apps/judicial-system/backend/src/app/formatters/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ export {
formatProsecutorReceivedByCourtSmsNotification,
formatDefenderCourtDateLinkEmailNotification,
formatDefenderResubmittedToCourtEmailNotification,
formatAdvocateAssignedEmailNotification,
formatCourtIndictmentReadyForCourtEmailNotification,
formatDefenderRoute,
formatDefenderReadyForCourtEmailNotification,
formatCourtOfAppealJudgeAssignedEmailNotification,
formatPostponedCourtDateEmailNotification,
stripHtmlTags,
filterWhitelistEmails,
} from './formatters'
export { Confirmation } from './pdfHelpers'
export { getRequestPdfAsBuffer, getRequestPdfAsString } from './requestPdf'
Expand Down
36 changes: 26 additions & 10 deletions apps/judicial-system/backend/src/app/messages/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,6 @@ export const notifications = {
'Hægt er að nálgast yfirlitssíðu málsins á <a href="https://rettarvorslugatt.island.is">rettarvorslugatt.island.is</a>.',
description: 'Notaður sem texti í email til þess að tilgreina slóð á RVG',
}),
emailWhitelist: defineMessage({
id: 'judicial.system.backend:notifications.email_whitelist',
defaultMessage: '',
description: 'Notað til að tilgreina hvort póstfang sé í hvítlista',
}),
emailWhitelistDomains: defineMessage({
id: 'judicial.system.backend:notifications.email_whitelist_domains',
defaultMessage: 'omnitrix.is,kolibri.is',
description: 'Notað til að tilgreina hvort póstfang sé í hvítlista',
}),
readyForCourt: defineMessages({
subject: {
id: 'judicial.system.backend:notifications.ready_for_court.subjectV2',
Expand Down Expand Up @@ -617,6 +607,32 @@ export const notifications = {
'Notaður sem texti í tölvupósti til verjanda vegna breytingar á lengd gæslu/einangrunar/vistunar þar sem úrskurðað var í einangrun.',
},
}),
advocateAssignedEmail: defineMessages({
subjectAccessToCaseFiles: {
id: 'judicial.system.backend:notifications.defender_assigned_email.subject_access_to_case_files',
defaultMessage: '{court} - aðgangur að málsgögnum',
description:
'Fyrirsögn í pósti til verjanda þegar hann er skráður á mál.',
},
subjectAccess: {
id: 'judicial.system.backend:notifications.defender_assigned_email.subject_access',
defaultMessage: 'Skráning í máli {courtCaseNumber}',
description:
'Fyrirsögn í pósti til verjanda þegar hann er skráður á mál.',
},
bodyAccessToCaseFiles: {
id: 'judicial.system.backend:notifications.defender_assigned_email.body_access_to_case_files',
defaultMessage:
'{court} hefur skráð þig verjanda í máli {courtCaseNumber}.<br /><br />{defenderHasAccessToRVG, select, true {Gögn málsins eru aðgengileg á {linkStart}yfirlitssíðu málsins í Réttarvörslugátt{linkEnd}} other {Þú getur nálgast gögn málsins hjá {courtName} ef þau hafa ekki þegar verið afhent}}.',
description: 'Texti í pósti til verjanda þegar hann er skráður á mál.',
},
bodyAccess: {
id: 'judicial.system.backend:notifications.defender_assigned_email.body_access',
defaultMessage:
'{court} hefur skráð þig {advocateType, select, LAWYER {lögmann einkaréttarkröfuhafa} LEGAL_RIGHTS_PROTECTOR {réttargæslumann einkaréttarkröfuhafa} other {verjanda}} í máli {courtCaseNumber}.<br /><br />{defenderHasAccessToRVG, select, true {Sjá nánar á {linkStart}yfirlitssíðu málsins í Réttarvörslugátt{linkEnd}} other {Þú getur nálgast málið hjá {courtName}.}}.',
description: 'Texti í pósti til verjanda þegar hann er skráður á mál.',
},
}),
defendantsNotUpdatedAtCourt: defineMessages({
subject: {
id: 'judicial.system.backend:notifications.defendants_not_updated_at_court.subject',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,14 @@ import {
} from '@island.is/judicial-system/formatters'
import type { User } from '@island.is/judicial-system/types'
import {
CaseAppealRulingDecision,
CaseDecision,
CaseState,
CaseTransition,
CaseType,
indictmentCases,
investigationCases,
isRestrictionCase,
restrictionCases,
UserRole,
} from '@island.is/judicial-system/types'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -784,9 +784,10 @@ export class CaseService {
elementId: caseFile.id,
})) ?? []

const messages: Message[] = deliverCaseFilesRecordToCourtMessages.concat(
deliverCaseFileToCourtMessages,
)
const messages = this.getDeliverProsecutorToCourtMessages(theCase, user)
.concat(this.getDeliverDefendantToCourtMessages(theCase, user))
.concat(deliverCaseFilesRecordToCourtMessages)
.concat(deliverCaseFileToCourtMessages)

if (isTrafficViolationCase(theCase)) {
messages.push({
Expand Down Expand Up @@ -2034,23 +2035,11 @@ export class CaseService {
}

async createCourtCase(theCase: Case, user: TUser): Promise<Case> {
let receivalDate: Date

if (isIndictmentCase(theCase.type)) {
receivalDate =
theCase.eventLogs?.find(
(eventLog) => eventLog.eventType === EventType.INDICTMENT_CONFIRMED,
)?.created ?? nowFactory()
} else {
receivalDate = nowFactory()
}

const courtCaseNumber = await this.courtService.createCourtCase(
user,
theCase.id,
theCase.courtId,
theCase.type,
receivalDate,
theCase.policeCaseNumbers,
Boolean(theCase.parentCaseId),
theCase.indictmentSubtypes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
IsObject,
IsOptional,
IsString,
MaxLength,
} from 'class-validator'

import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'
Expand All @@ -32,39 +31,33 @@ export class CreateCaseDto {
readonly indictmentSubtypes?: IndictmentSubtypeMap

@IsOptional()
@MaxLength(255)
@IsString()
@ApiPropertyOptional({ type: String })
readonly description?: string

@IsNotEmpty()
@IsArray()
@ArrayMinSize(1)
@MaxLength(255, { each: true })
@IsString({ each: true })
@ApiProperty({ type: String, isArray: true })
readonly policeCaseNumbers!: string[]

@IsOptional()
@MaxLength(255)
@IsString()
@ApiPropertyOptional({ type: String })
readonly defenderName?: string

@IsOptional()
@MaxLength(255)
@IsString()
@ApiPropertyOptional({ type: String })
readonly defenderNationalId?: string

@IsOptional()
@MaxLength(255)
@IsString()
@ApiPropertyOptional({ type: String })
readonly defenderEmail?: string

@IsOptional()
@MaxLength(255)
@IsString()
@ApiPropertyOptional({ type: String })
readonly defenderPhoneNumber?: string
Expand All @@ -75,7 +68,6 @@ export class CreateCaseDto {
readonly requestSharedWithDefender?: RequestSharedWithDefender

@IsOptional()
@MaxLength(255)
@IsString()
@ApiPropertyOptional({ type: String })
readonly leadInvestigator?: string
Expand Down
Loading
Loading