Skip to content

Commit

Permalink
Merge branch 'main' of github.com:island-is/island.is into j-s/advoca…
Browse files Browse the repository at this point in the history
…te-notifications
  • Loading branch information
oddsson committed Oct 7, 2024
2 parents 8263ce1 + b1623cc commit d0e3d38
Show file tree
Hide file tree
Showing 173 changed files with 3,267 additions and 2,045 deletions.
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@
.yarn
/infra/helm/
/.nx/cache
/.nx/workspace-data
/.nx/workspace-data
apps/web/public/assets/pdf.worker.min.mjs
2 changes: 2 additions & 0 deletions apps/api/infra/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,8 @@ export const serviceSetup = (services: {
ULTRAVIOLET_RADIATION_API_KEY: '/k8s/api/ULTRAVIOLET_RADIATION_API_KEY',
UMBODSMADUR_SKULDARA_COST_OF_LIVING_CALCULATOR_API_URL:
'/k8s/api/UMBODSMADUR_SKULDARA_COST_OF_LIVING_CALCULATOR_API_URL',
VINNUEFTIRLITID_CAMPAIGN_MONITOR_API_KEY:
'/k8s/api/VINNUEFTIRLITID_CAMPAIGN_MONITOR_API_KEY',
})
.xroad(
AdrAndMachine,
Expand Down
2 changes: 2 additions & 0 deletions apps/api/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { ElectronicRegistrationsModule } from '@island.is/api/domains/electronic
import {
EmailSignupModule,
ZenterSignupConfig,
CampaignMonitorSignupConfig,
} from '@island.is/api/domains/email-signup'
import { EndorsementSystemModule } from '@island.is/api/domains/endorsement-system'
import { EnergyFundsServiceModule } from '@island.is/api/domains/energy-funds'
Expand Down Expand Up @@ -390,6 +391,7 @@ const environment = getConfig
DocumentClientConfig,
DocumentsClientV2Config,
ZenterSignupConfig,
CampaignMonitorSignupConfig,
PaymentScheduleClientConfig,
JudicialAdministrationClientConfig,
CommunicationsConfig,
Expand Down
18 changes: 9 additions & 9 deletions apps/financial-aid/api/scripts/run-xroad-proxy.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#!/bin/bash

INSTANCE_ID=$(
aws ec2 describe-instances \
--filters "Name=tag:Name,Values=Bastion Host" "Name=instance-state-name,Values=running" \
--query "Reservations[0].Instances[0].InstanceId" \
--region eu-west-1 \
--output text
aws ec2 describe-instances \
--filters "Name=tag:Name,Values=Bastion Host" "Name=instance-state-name,Values=running" \
--query "Reservations[0].Instances[0].InstanceId" \
--region eu-west-1 \
--output text
)

echo "Starting port forwarding session with instance $INSTANCE_ID for profile $AWS_PROFILE"

aws ssm start-session \
--target "$INSTANCE_ID" \
--document-name AWS-StartPortForwardingSession \
--parameters '{"portNumber":["8081"],"localPortNumber":["5050"]}' \
--region eu-west-1
--target "$INSTANCE_ID" \
--document-name AWS-StartPortForwardingSession \
--parameters '{"portNumber":["8081"],"localPortNumber":["5050"]}' \
--region eu-west-1
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import { Institution } from '../institution'
import {
PoliceCaseFile,
PoliceCaseInfo,
SubpoenaStatus,
UploadPoliceCaseFileResponse,
} from '../police'
import { backendModuleConfig } from './backend.config'
Expand Down Expand Up @@ -306,6 +307,13 @@ export class BackendService extends DataSource<{ req: Request }> {
return this.get(`case/${caseId}/policeFiles`)
}

getSubpoenaStatus(
caseId: string,
subpoenaId: string,
): Promise<SubpoenaStatus> {
return this.get(`case/${caseId}/subpoenaStatus/${subpoenaId}`)
}

getPoliceCaseInfo(caseId: string): Promise<PoliceCaseInfo[]> {
return this.get(`case/${caseId}/policeCaseInfo`)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export { Defendant } from './models/defendant.model'
export { DeleteDefendantResponse } from './models/delete.response'
export { CivilClaimant } from './models/civilClaimant.model'
export { DeleteCivilClaimantResponse } from './models/deleteCivilClaimant.response'
export { Subpoena } from './models/subpoena.model'
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { Field, ID, ObjectType } from '@nestjs/graphql'
import { Field, ID, ObjectType, registerEnumType } from '@nestjs/graphql'

import { ServiceStatus } from '@island.is/judicial-system/types'

registerEnumType(ServiceStatus, { name: 'ServiceStatus' })

@ObjectType()
export class Subpoena {
Expand All @@ -14,15 +18,27 @@ export class Subpoena {
@Field(() => String, { nullable: true })
subpoenaId?: string

@Field(() => Boolean, { nullable: true })
acknowledged?: boolean
@Field(() => String, { nullable: true })
defendantId?: string

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

@Field(() => ServiceStatus, { nullable: true })
serviceStatus?: ServiceStatus

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

@Field(() => String, { nullable: true })
registeredBy?: string
servedBy?: string

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

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

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

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Allow } from 'class-validator'

import { Field, ID, InputType } from '@nestjs/graphql'

@InputType()
export class SubpoenaStatusQueryInput {
@Allow()
@Field(() => ID)
readonly caseId!: string

@Allow()
@Field(() => ID)
readonly subpoenaId!: string
}
1 change: 1 addition & 0 deletions apps/judicial-system/api/src/app/modules/police/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { PoliceCaseInfo } from './models/policeCaseInfo.model'
export { SubpoenaStatus } from './models/subpoenaStatus.model'
export { PoliceCaseFile } from './models/policeCaseFile.model'
export { UploadPoliceCaseFileResponse } from './models/uploadPoliceCaseFile.response'
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Field, ObjectType } from '@nestjs/graphql'

import { ServiceStatus } from '@island.is/judicial-system/types'

@ObjectType()
export class SubpoenaStatus {
@Field(() => ServiceStatus)
readonly serviceStatus!: ServiceStatus

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

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

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

@Field(() => String, { nullable: true })
readonly defenderNationalId?: string
}
22 changes: 22 additions & 0 deletions apps/judicial-system/api/src/app/modules/police/police.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ import type { User } from '@island.is/judicial-system/types'
import { BackendService } from '../backend'
import { PoliceCaseFilesQueryInput } from './dto/policeCaseFiles.input'
import { PoliceCaseInfoQueryInput } from './dto/policeCaseInfo.input'
import { SubpoenaStatusQueryInput } from './dto/subpoenaStatus.input'
import { UploadPoliceCaseFileInput } from './dto/uploadPoliceCaseFile.input'
import { PoliceCaseFile } from './models/policeCaseFile.model'
import { PoliceCaseInfo } from './models/policeCaseInfo.model'
import { SubpoenaStatus } from './models/subpoenaStatus.model'
import { UploadPoliceCaseFileResponse } from './models/uploadPoliceCaseFile.response'

@UseGuards(JwtGraphQlAuthGuard)
Expand Down Expand Up @@ -49,6 +51,26 @@ export class PoliceResolver {
)
}

@Query(() => SubpoenaStatus, { nullable: true })
subpoenaStatus(
@Args('input', { type: () => SubpoenaStatusQueryInput })
input: SubpoenaStatusQueryInput,
@CurrentGraphQlUser() user: User,
@Context('dataSources')
{ backendService }: { backendService: BackendService },
): Promise<SubpoenaStatus> {
this.logger.debug(
`Getting subpoena status for subpoena ${input.subpoenaId} of case ${input.caseId}`,
)

return this.auditTrailService.audit(
user.id,
AuditedAction.GET_SUBPOENA_STATUS,
backendService.getSubpoenaStatus(input.caseId, input.subpoenaId),
input.caseId,
)
}

@Query(() => [PoliceCaseInfo], { nullable: true })
policeCaseInfo(
@Args('input', { type: () => PoliceCaseInfoQueryInput })
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
'use strict'

module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.sequelize.transaction((transaction) =>
queryInterface
.changeColumn(
'subpoena',
'acknowledged',
{ type: Sequelize.STRING, allowNull: true },
{ transaction },
)
.then(
() =>
queryInterface.renameColumn(
'subpoena',
'acknowledged',
'service_status',
{ transaction },
),

queryInterface.renameColumn(
'subpoena',
'acknowledged_date',
'service_date',
{ transaction },
),

queryInterface.renameColumn(
'subpoena',
'registered_by',
'served_by',
{ transaction },
),

queryInterface.addColumn(
'subpoena',
'defender_national_id',
{
type: Sequelize.STRING,
allowNull: true,
},
{ transaction },
),
),
)
},

down: (queryInterface) => {
return queryInterface.sequelize.transaction((transaction) =>
queryInterface
.renameColumn('subpoena', 'service_status', 'acknowledged', {
transaction,
})
.then(
() =>
queryInterface.changeColumn(
'subpoena',
'acknowledged',
{
type: 'BOOLEAN USING CAST("acknowledged" as BOOLEAN)',
allowNull: true,
},
{ transaction },
),

queryInterface.renameColumn(
'subpoena',
'service_date',
'acknowledged_date',
{ transaction },
),

queryInterface.renameColumn(
'subpoena',
'served_by',
'registered_by',
{ transaction },
),

queryInterface.removeColumn('subpoena', 'defender_national_id', {
transaction,
}),
),
)
},
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import CryptoJS from 'crypto-js'
import format from 'date-fns/format'
import { Base64 } from 'js-base64'
import { Op } from 'sequelize'
import { Sequelize } from 'sequelize-typescript'

import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { CanActivate } from '@nestjs/common'

import { JwtAuthGuard, RolesGuard } from '@island.is/judicial-system/auth'
import { indictmentCases } from '@island.is/judicial-system/types'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
} from '@island.is/judicial-system/types'

import { type Case } from '../case'
import { CaseString } from '../case/models/caseString.model'
import { DateLog } from '../case/models/dateLog.model'
import { eventModuleConfig } from './event.config'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { CanActivate } from '@nestjs/common'

import { RolesGuard } from '@island.is/judicial-system/auth'

import { CaseExistsGuard, CaseReadGuard } from '../../../case'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ import {
} from '@island.is/judicial-system/auth'
import type { User } from '@island.is/judicial-system/types'

import { prosecutorRepresentativeRule, prosecutorRule } from '../../guards'
import {
districtCourtJudgeRule,
prosecutorRepresentativeRule,
prosecutorRule,
} from '../../guards'
import {
Case,
CaseExistsGuard,
Expand All @@ -30,6 +34,7 @@ import {
CaseReadGuard,
CurrentCase,
} from '../case'
import { Subpoena } from '../subpoena'
import { UploadPoliceCaseFileDto } from './dto/uploadPoliceCaseFile.dto'
import { PoliceCaseFile } from './models/policeCaseFile.model'
import { PoliceCaseInfo } from './models/policeCaseInfo.model'
Expand Down Expand Up @@ -69,6 +74,26 @@ export class PoliceController {
return this.policeService.getAllPoliceCaseFiles(theCase.id, user)
}

@RolesRules(
prosecutorRule,
prosecutorRepresentativeRule,
districtCourtJudgeRule,
)
@Get('subpoenaStatus/:subpoenaId')
@ApiOkResponse({
type: Subpoena,
description: 'Gets subpoena status',
})
getSubpoenaStatus(
@Param('subpoenaId') subpoenaId: string,
@CurrentCase() theCase: Case,
@CurrentHttpUser() user: User,
): Promise<Subpoena> {
this.logger.debug(`Gets subpoena status in case ${theCase.id}`)

return this.policeService.getSubpoenaStatus(subpoenaId, user)
}

@RolesRules(prosecutorRule, prosecutorRepresentativeRule)
@UseInterceptors(CaseOriginalAncestorInterceptor)
@Get('policeCaseInfo')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { forwardRef, Module } from '@nestjs/common'

import { AwsS3Module, CaseModule, EventModule } from '../index'
import { AwsS3Module, CaseModule, EventModule, SubpoenaModule } from '../index'
import { PoliceController } from './police.controller'
import { PoliceService } from './police.service'

Expand All @@ -9,6 +9,7 @@ import { PoliceService } from './police.service'
forwardRef(() => CaseModule),
forwardRef(() => EventModule),
forwardRef(() => AwsS3Module),
forwardRef(() => SubpoenaModule),
],
providers: [PoliceService],
exports: [PoliceService],
Expand Down
Loading

0 comments on commit d0e3d38

Please sign in to comment.