Skip to content

Commit

Permalink
Merge branch 'main' into feat/native-app-add-optional-scopes
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored May 21, 2024
2 parents cd739ab + 6175885 commit 8cbe952
Show file tree
Hide file tree
Showing 51 changed files with 1,339 additions and 504 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Allow } from 'class-validator'

import { Field, InputType } from '@nestjs/graphql'
import type { Aid } from '@island.is/financial-aid/shared/lib'
import type { Aid, ChildrenAid } from '@island.is/financial-aid/shared/lib'
import { AidInput } from '../../aid'

@InputType()
Expand Down Expand Up @@ -42,6 +42,10 @@ export class UpdateMunicipalityInput {
@Field({ nullable: true })
readonly navPassword?: string

@Allow()
@Field(() => String, { nullable: true })
readonly childrenAid?: ChildrenAid

@Allow()
@Field()
readonly municipalityId!: string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Field, ObjectType, ID } from '@nestjs/graphql'

import { Municipality } from '@island.is/financial-aid/shared/lib'
import { ChildrenAid, Municipality } from '@island.is/financial-aid/shared/lib'

import { AidModel } from '../../aid'
import { StaffModel } from '../../staff/models'
Expand Down Expand Up @@ -54,4 +54,7 @@ export class MunicipalityModel implements Municipality {

@Field({ nullable: true })
readonly navPassword?: string

@Field(() => String)
readonly childrenAid!: ChildrenAid
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
'use strict'

module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.sequelize.transaction((t) =>
Promise.all([
queryInterface.addColumn(
'municipality',
'children_aid',
{
type: Sequelize.ENUM('NotDefined', 'Institution', 'Applicant'),
allowNull: false,
defaultValue: 'NotDefined',
},
{ transaction: t },
),
]),
)
},

down: (queryInterface, Sequelize) => {
return queryInterface.sequelize.transaction((t) =>
Promise.all([
queryInterface.removeColumn('municipality', 'children_aid', {
transaction: t,
}),
]),
)
},
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { IsBoolean, IsObject, IsOptional, IsString } from 'class-validator'

import { ApiProperty } from '@nestjs/swagger'
import type { Aid } from '@island.is/financial-aid/shared/lib'
import type { Aid, ChildrenAid } from '@island.is/financial-aid/shared/lib'

export class UpdateMunicipalityDto {
@IsOptional()
Expand Down Expand Up @@ -49,6 +49,11 @@ export class UpdateMunicipalityDto {
@ApiProperty()
navPassword?: string

@IsOptional()
@IsString()
@ApiProperty()
childrenAid?: ChildrenAid

@IsString()
@ApiProperty()
readonly municipalityId: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {

import { ApiProperty } from '@nestjs/swagger'

import { Municipality } from '@island.is/financial-aid/shared/lib'
import { ChildrenAid, Municipality } from '@island.is/financial-aid/shared/lib'

import { AidModel } from '../../aid/models'
@Table({
Expand Down Expand Up @@ -132,4 +132,12 @@ export class MunicipalityModel extends Model<Municipality> {
})
@ApiProperty()
navPassword?: string

@Column({
type: DataType.ENUM,
allowNull: false,
values: Object.values(ChildrenAid),
})
@ApiProperty({ enum: ChildrenAid })
childrenAid: ChildrenAid
}
1 change: 1 addition & 0 deletions apps/financial-aid/web-veita/graphql/sharedGql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,7 @@ export const UpdateMunicipalityMutation = gql`
navUrl
navUsername
navPassword
childrenAid
individualAid {
ownPlace
registeredRenting
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ import {
Button,
ToastContainer,
Checkbox,
RadioButton,
} from '@island.is/island-ui/core'

import {
Aid,
AidName,
ApiKeysForMunicipality,
ChildrenAid,
Municipality,
scrollToId,
} from '@island.is/financial-aid/shared/lib'
Expand Down Expand Up @@ -379,6 +381,50 @@ const MunicipalityAdminSettings = ({ currentMunicipality }: Props) => {
)
})}

<Box marginBottom={[2, 2, 7]} id="childrenAid" className={`contentUp`}>
<Text as="h3" variant="h3" marginBottom={[2, 2, 3]} color="dark300">
Börn
</Text>
<Box
display="flex"
alignItems="center"
width="full"
columnGap={3}
rowGap={3}
flexWrap={'wrap'}
>
<Box flexGrow={1}>
<RadioButton
name="children-aid-institution"
label="Styrkur greiddur til stofnunar"
value={ChildrenAid.INSTITUTION}
checked={state.childrenAid === ChildrenAid.INSTITUTION}
onChange={() => {
setState({ ...state, childrenAid: ChildrenAid.INSTITUTION })
}}
backgroundColor="blue"
large
/>
</Box>
<Box flexGrow={1}>
<RadioButton
name="children-aid-applicant"
label="Styrkur greiddur til umsækjanda"
value={ChildrenAid.APPLICANT}
checked={state.childrenAid === ChildrenAid.APPLICANT}
onChange={() => {
setState({
...state,
childrenAid: ChildrenAid.APPLICANT,
})
}}
backgroundColor="blue"
large
/>
</Box>
</Box>
</Box>

<Box display="flex" justifyContent="flexEnd">
<Button loading={loading} onClick={submit} icon="checkmark">
Vista stillingar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const useCurrentMunicipalityState = ({ municipality }: Props) => {
: state.navUrl,
navUsername: state.navUsername,
navPassword: state.navPassword,
childrenAid: state.childrenAid,
},
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const MunicipalityQuery = gql`
navUrl
navUsername
navPassword
childrenAid
individualAid {
ownPlace
registeredRenting
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,9 @@ export class UpdateDefendantInput {
@IsOptional()
@Field(() => ServiceRequirement, { nullable: true })
readonly serviceRequirement?: ServiceRequirement

@Allow()
@IsOptional()
@Field(() => String, { nullable: true })
readonly verdictViewDate?: string
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,7 @@ export class Defendant {

@Field(() => ServiceRequirement, { nullable: true })
readonly serviceRequirement?: ServiceRequirement

@Field(() => String, { nullable: true })
readonly verdictViewDate?: string
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use strict'

module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.sequelize.transaction((t) =>
queryInterface.addColumn(
'defendant',
'verdict_view_date',
{ type: Sequelize.DATE, allowNull: true },
{ transaction: t },
),
)
},

down: (queryInterface) => {
return queryInterface.sequelize.transaction((t) =>
queryInterface.removeColumn('defendant', 'verdict_view_date', {
transaction: t,
}),
)
},
}
12 changes: 6 additions & 6 deletions apps/judicial-system/backend/src/app/messages/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,22 +297,22 @@ export const notifications = {
}),
caseCompleted: defineMessages({
subject: {
id: 'judicial.system.backend:notifications.case_completed.subject',
defaultMessage: 'Dómur í máli {courtCaseNumber}',
id: 'judicial.system.backend:notifications.case_completed.subject_v1',
defaultMessage: 'Máli lokið {courtCaseNumber}',
description:
'Notaður sem titill í pósti til hagaðila vegna staðfests dóms',
},
prosecutorBody: {
id: 'judicial.system.backend:notifications.case_completed.prosecutor_body',
id: 'judicial.system.backend:notifications.case_completed.prosecutor_body_v1',
defaultMessage:
'Dómari hefur staðfest dóm í máli {courtCaseNumber} hjá {courtName}.<br /><br />Skjöl málsins eru aðengileg á {linkStart}yfirlitssíðu málsins í Réttarvörslugátt{linkEnd}.',
'Máli {courtCaseNumber} hjá {courtName} hefur verið lokið.<br /><br />Niðurstaða: {caseIndictmentRulingDecision}<br /><br />Skjöl málsins eru aðengileg á {linkStart}yfirlitssíðu málsins í Réttarvörslugátt{linkEnd}.',
description:
'Notaður sem texti í pósti til sækjanda vegna staðfests dóms',
},
defenderBody: {
id: 'judicial.system.backend:notifications.case_completed.defender_body_v2',
id: 'judicial.system.backend:notifications.case_completed.defender_body_v3',
defaultMessage:
'Dómari hefur staðfest dóm í máli {courtCaseNumber} hjá {courtName}.<br /><br />{defenderHasAccessToRvg, select, false {Þú getur nálgast gögn málsins hjá {courtName} ef þau hafa ekki þegar verið afhent} other {Þú getur nálgast gögn málsins á {linkStart}yfirlitssíðu málsins í Réttarvörslugátt{linkEnd}}}.',
'Máli {courtCaseNumber} hjá {courtName} hefur verið lokið.<br /><br />Niðurstaða: {caseIndictmentRulingDecision}<br /><br />{defenderHasAccessToRvg, select, false {Þú getur nálgast gögn málsins hjá {courtName} ef þau hafa ekki þegar verið afhent} other {Þú getur nálgast gögn málsins á {linkStart}yfirlitssíðu málsins í Réttarvörslugátt{linkEnd}}}.',
description:
'Notaður sem texti í pósti til verjanda vegna staðfests dóms',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
districtCourtRegistrarRule,
prosecutorRepresentativeRule,
prosecutorRule,
publicProsecutorStaffRule,
} from '../../guards'
import { Case, CaseExistsGuard, CaseWriteGuard, CurrentCase } from '../case'
import { CreateDefendantDto } from './dto/createDefendant.dto'
Expand Down Expand Up @@ -71,6 +72,7 @@ export class DefendantController {
districtCourtJudgeRule,
districtCourtRegistrarRule,
districtCourtAssistantRule,
publicProsecutorStaffRule,
)
@Patch(':defendantId')
@ApiOkResponse({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,9 @@ export class UpdateDefendantDto {
@IsEnum(ServiceRequirement)
@ApiPropertyOptional({ enum: ServiceRequirement })
readonly serviceRequirement?: ServiceRequirement

@IsOptional()
@IsString()
@ApiPropertyOptional()
readonly verdictViewDate?: string
}
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,11 @@ export class Defendant extends Model {
})
@ApiProperty({ enum: ServiceRequirement })
serviceRequirement?: ServiceRequirement

@Column({
type: DataType.STRING,
allowNull: true,
})
@ApiProperty()
verdictViewDate?: string
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
districtCourtRegistrarRule,
prosecutorRepresentativeRule,
prosecutorRule,
publicProsecutorStaffRule,
} from '../../../../guards'
import { DefendantController } from '../../defendant.controller'

Expand All @@ -19,11 +20,12 @@ describe('DefendantController - Update rules', () => {
})

it('should give permission to roles', () => {
expect(rules).toHaveLength(5)
expect(rules).toHaveLength(6)
expect(rules).toContain(prosecutorRule)
expect(rules).toContain(prosecutorRepresentativeRule)
expect(rules).toContain(districtCourtJudgeRule)
expect(rules).toContain(districtCourtRegistrarRule)
expect(rules).toContain(districtCourtAssistantRule)
expect(rules).toContain(publicProsecutorStaffRule)
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
import {
formatDate,
getAppealResultTextByValue,
getHumanReadableCaseIndictmentRulingDecision,
} from '@island.is/judicial-system/formatters'
import {
CaseMessage,
Expand Down Expand Up @@ -963,6 +964,10 @@ export class NotificationService {
? this.formatMessage(notifications.caseCompleted.prosecutorBody, {
courtCaseNumber: theCase.courtCaseNumber,
courtName: theCase.court?.name?.replace('dómur', 'dómi'),
caseIndictmentRulingDecision:
getHumanReadableCaseIndictmentRulingDecision(
theCase.indictmentRulingDecision,
),
linkStart: `<a href="${this.config.clientUrl}${CLOSED_INDICTMENT_OVERVIEW_ROUTE}/${theCase.id}">`,
linkEnd: '</a>',
})
Expand Down Expand Up @@ -997,6 +1002,10 @@ export class NotificationService {
? this.formatMessage(notifications.caseCompleted.defenderBody, {
courtCaseNumber: theCase.courtCaseNumber,
courtName: theCase.court?.name?.replace('dómur', 'dómi'),
caseIndictmentRulingDecision:
getHumanReadableCaseIndictmentRulingDecision(
theCase.indictmentRulingDecision,
),
defenderHasAccessToRvg: Boolean(defenderNationalId),
linkStart: `<a href="${formatDefenderRoute(
this.config.clientUrl,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ describe('InternalNotificationController - Send ruling notifications', () => {
expect(mockEmailService.sendEmail).toHaveBeenCalledWith(
expect.objectContaining({
to: [{ name: prosecutor.name, address: prosecutor.email }],
subject: 'Dómur í máli 007-2022-07',
html: `Dómari hefur staðfest dóm í máli 007-2022-07 hjá Héraðsdómi Reykjavíkur.<br /><br />Skjöl málsins eru aðengileg á ${expectedLink}yfirlitssíðu málsins í Réttarvörslugátt</a>.`,
subject: 'Máli lokið 007-2022-07',
html: `Máli 007-2022-07 hjá Héraðsdómi Reykjavíkur hefur verið lokið.<br /><br />Niðurstaða: Ekki skráð<br /><br />Skjöl málsins eru aðengileg á ${expectedLink}yfirlitssíðu málsins í Réttarvörslugátt</a>.`,
}),
)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ query Case($input: CaseQueryInput!) {
defendantWaivesRightToCounsel
defendantPlea
serviceRequirement
verdictViewDate
}
defenderName
defenderNationalId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ query LimitedAccessCase($input: CaseQueryInput!) {
defenderEmail
defenderPhoneNumber
defendantWaivesRightToCounsel
verdictViewDate
}
defenderName
defenderNationalId
Expand Down
Loading

0 comments on commit 8cbe952

Please sign in to comment.