Skip to content

Commit

Permalink
Merge branch 'main' of github.com:island-is/island.is into j-s/case-f…
Browse files Browse the repository at this point in the history
…iles-added-notification
  • Loading branch information
gudjong committed Oct 22, 2024
2 parents c265515 + 49ba64d commit d5d7861
Show file tree
Hide file tree
Showing 169 changed files with 4,556 additions and 1,523 deletions.
4 changes: 3 additions & 1 deletion .envrc
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ fi

# Podman compatibility
# NOTE: Exits direnv if user is using docker.
source_env_if_exists .env.podman
source_env_if_exists .envrc.podman

source_env_if_exists .envrc.kube
24 changes: 24 additions & 0 deletions .envrc.kube
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

set -euo pipefail

for c in kubectx kubectl aws; do
if ! command -v "$c" >/dev/null; then
echo "$c not installed"
return
fi
done

set-kubectx() {
: "${AWS_PROFILE:=}"
if kubectx | grep -q "${AWS_PROFILE##islandis-}"; then
return
fi
echo "Setting kube context..." >&2
AWS_ACCOUNT_ID="$(aws sts get-caller-identity | jq -r '.Account')"
kubectx "$(kubectx | grep "${AWS_ACCOUNT_ID}")"
CLUSTER="$(kubectl config current-context | sed 's/.*\///')"
export CLUSTER
}

set-kubectx
4 changes: 2 additions & 2 deletions .env.podman → .envrc.podman
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ set -euo pipefail
if [[ -n "${DOCKER_HOST:-}" ]] ||
command -v docker >/dev/null &&
! (docker --version | grep -i podman); then
exit 0
return 0
fi

echo "🐳 Using podman"

SOCKET_DIR="${XDG_RUNTIME_DIR:-/run/user/$(id -u)}"
if [[ -S /run/podman/podman.sock ]]; then
SOCKET_DIR="/run/podman"
exit 0
return 0
fi

export DOCKER_HOST=unix://$SOCKET_DIR/podman/podman.sock
Expand Down
17 changes: 14 additions & 3 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,6 @@ codemagic.yaml
/libs/application/templates/university/ @island-is/origo
/libs/application/template-api-modules/src/lib/modules/templates/university/ @island-is/origo

# Temporary assignment while the QA bootstrap project is in progress
/apps/system-e2e/ @island-is/qa

# DevOps
/.github/ @island-is/devops
/.githooks/ @island-is/devops
Expand All @@ -386,3 +383,17 @@ codemagic.yaml
/scripts/postinstall.js @island-is/devops @island-is/core
/scripts/codegen.js @island-is/devops @island-is/core
/charts/ @island-is/devops


# System tests
# Catch-all
/apps/system-e2e/ @island-is/qa
# Islandis
/apps/system-e2e/src/tests/islandis/admin-portal/ @island-is/aranja
/apps/system-e2e/src/tests/islandis/application-system/ @island-is/norda-applications
/apps/system-e2e/src/tests/islandis/application-system/acceptance/parental-leave.spec.ts @island-is/deloitte
/apps/system-e2e/src/tests/islandis/consultation-portal/ @island-is/advania
/apps/system-e2e/src/tests/islandis/service-portal/ @island-is/hugsmidjan @island-is/juni @island-is/norda-applications
/apps/system-e2e/src/tests/islandis/web/ @island-is/hugsmidjan @island-is/juni @island-is/stefna
# Judicial system
/apps/system-e2e/src/tests/judicial-system/ @island-is/kolibri-justice-league
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ TODO
*.todo
.env
.env.*
!.env.podman
.envrc.*
.envrc.private
.nvmrc
.node-version
# IDE - VSCode
Expand Down
4 changes: 4 additions & 0 deletions apps/application-system/api/infra/application-system-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ export const serviceSetup = (services: {
skilavottordWs: ServiceBuilder<'skilavottord-ws'>
// The user profile service is named service-portal-api in infra setup
servicePortalApi: ServiceBuilder<'service-portal-api'>
userNotificationService: ServiceBuilder<'services-user-notification'>
}): ServiceBuilder<'application-system-api'> =>
service('application-system-api')
.namespace(namespace)
Expand Down Expand Up @@ -256,6 +257,9 @@ export const serviceSetup = (services: {
SERVICE_USER_PROFILE_URL: ref(
(h) => `http://${h.svc(services.servicePortalApi)}`,
),
USER_NOTIFICATION_API_URL: ref(
(h) => `http://${h.svc(services.userNotificationService)}`,
),
})
.xroad(
Base,
Expand Down
2 changes: 2 additions & 0 deletions apps/application-system/api/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ import { FriggClientConfig } from '@island.is/clients/mms/frigg'
import { smsModuleConfig } from '@island.is/nova-sms'
import { emailModuleConfig } from '@island.is/email-service'
import { sharedModuleConfig } from '@island.is/application/template-api-modules'
import { UserNotificationClientConfig } from '@island.is/clients/user-notification'

@Module({
imports: [
Expand Down Expand Up @@ -119,6 +120,7 @@ import { sharedModuleConfig } from '@island.is/application/template-api-modules'
smsModuleConfig,
emailModuleConfig,
sharedModuleConfig,
UserNotificationClientConfig,
],
}),
],
Expand Down
27 changes: 26 additions & 1 deletion apps/judicial-system/api/src/app/modules/file/file.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,32 @@ export class FileController {
)
}

@Get(['subpoena/:defendantId', 'subpoena/:defendantId/:subpoenaId'])
@Get('serviceCertificate/:defendantId/:subpoenaId')
@Header('Content-Type', 'application/pdf')
getServiceCertificatePdf(
@Param('id') id: string,
@Param('defendantId') defendantId: string,
@CurrentHttpUser() user: User,
@Req() req: Request,
@Res() res: Response,
@Param('subpoenaId') subpoenaId?: string,
): Promise<Response> {
this.logger.debug(
`Getting service certificate for defendant ${defendantId} of case ${id} as a pdf document`,
)

return this.fileService.tryGetFile(
user.id,
AuditedAction.GET_SERVICE_CERTIFICATE_PDF,
id,
`defendant/${defendantId}/subpoena/${subpoenaId}/serviceCertificate`,
req,
res,
'pdf',
)
}

@Get('subpoena/:defendantId')
@Header('Content-Type', 'application/pdf')
getSubpoenaPdf(
@Param('id') id: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
Header,
Inject,
Param,
Query,
Req,
Res,
UseGuards,
Expand All @@ -20,7 +19,7 @@ import {
CurrentHttpUser,
JwtInjectBearerAuthGuard,
} from '@island.is/judicial-system/auth'
import type { SubpoenaType, User } from '@island.is/judicial-system/types'
import type { User } from '@island.is/judicial-system/types'

import { FileService } from './file.service'

Expand Down Expand Up @@ -201,6 +200,31 @@ export class LimitedAccessFileController {
)
}

@Get('serviceCertificate/:defendantId/:subpoenaId')
@Header('Content-Type', 'application/pdf')
getServiceCertificatePdf(
@Param('id') id: string,
@Param('defendantId') defendantId: string,
@CurrentHttpUser() user: User,
@Req() req: Request,
@Res() res: Response,
@Param('subpoenaId') subpoenaId?: string,
): Promise<Response> {
this.logger.debug(
`Getting service certificate for defendant ${defendantId} of case ${id} as a pdf document`,
)

return this.fileService.tryGetFile(
user.id,
AuditedAction.GET_SERVICE_CERTIFICATE_PDF,
id,
`limitedAccess/defendant/${defendantId}/subpoena/${subpoenaId}/serviceCertificate`,
req,
res,
'pdf',
)
}

@Get('allFiles')
@Header('Content-Type', 'application/zip')
async getAllFiles(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
'use strict'
const replaceEnum = require('sequelize-replace-enum-postgres').default

module.exports = {
up: (queryInterface) => {
// replaceEnum does not support transactions
return replaceEnum({
queryInterface,
tableName: 'notification',
columnName: 'type',
newValues: [
'HEADS_UP',
'READY_FOR_COURT',
'RECEIVED_BY_COURT',
'COURT_DATE',
'RULING',
'MODIFIED',
'REVOKED',
'DEFENDER_ASSIGNED',
'ADVOCATE_ASSIGNED',
'DEFENDANTS_NOT_UPDATED_AT_COURT',
'APPEAL_TO_COURT_OF_APPEALS',
'APPEAL_RECEIVED_BY_COURT',
'APPEAL_STATEMENT',
'APPEAL_COMPLETED',
'APPEAL_JUDGES_ASSIGNED',
'APPEAL_CASE_FILES_UPDATED',
'APPEAL_WITHDRAWN',
'INDICTMENT_DENIED',
'INDICTMENT_RETURNED',
'INDICTMENTS_WAITING_FOR_CONFIRMATION',
'SERVICE_SUCCESSFUL', // New value
'SERVICE_FAILED', // New value
'DEFENDANT_SELECTED_DEFENDER', // New value
],
enumName: 'enum_notification_type',
})
},

down: (queryInterface) => {
// replaceEnum does not support transactions
return replaceEnum({
queryInterface,
tableName: 'notification',
columnName: 'type',
newValues: [
'HEADS_UP',
'READY_FOR_COURT',
'RECEIVED_BY_COURT',
'COURT_DATE',
'RULING',
'MODIFIED',
'REVOKED',
'DEFENDER_ASSIGNED',
'DEFENDANTS_NOT_UPDATED_AT_COURT',
'APPEAL_TO_COURT_OF_APPEALS',
'APPEAL_RECEIVED_BY_COURT',
'APPEAL_STATEMENT',
'APPEAL_COMPLETED',
'APPEAL_JUDGES_ASSIGNED',
'APPEAL_CASE_FILES_UPDATED',
'APPEAL_WITHDRAWN',
'INDICTMENT_DENIED',
'INDICTMENT_RETURNED',
'INDICTMENTS_WAITING_FOR_CONFIRMATION',
],
enumName: 'enum_notification_type',
})
},
}
1 change: 1 addition & 0 deletions apps/judicial-system/backend/src/app/formatters/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ export { createCaseFilesRecord } from './caseFilesRecordPdf'
export { createIndictment } from './indictmentPdf'
export { createConfirmedPdf } from './confirmedPdf'
export { createSubpoena } from './subpoenaPdf'
export { createServiceCertificate } from './serviceCertificatePdf'
8 changes: 8 additions & 0 deletions apps/judicial-system/backend/src/app/formatters/pdfHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,14 @@ export const addMediumText = (
addText(doc, mediumFontSize, text, font)
}

export const addMediumCenteredText = (
doc: PDFKit.PDFDocument,
text: string,
font?: string,
) => {
addAlignedText(doc, mediumFontSize, text, 'center', font)
}

export const addNormalPlusText = (
doc: PDFKit.PDFDocument,
text: string,
Expand Down
Loading

0 comments on commit d5d7861

Please sign in to comment.