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

feat(j-s): Add punishment type to indictment overview and table #17168

Closed
wants to merge 71 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
67a2110
feat: add labels for new punishment type in indictment overview
Dec 6, 2024
3858838
feat(j-s): add punishment type ts type and remaining radio buttons
Dec 6, 2024
6676277
chore: nx format:write update dirty files
andes-it Dec 6, 2024
58479b4
feat(j-s): add punishment type ts type and remaining radio buttons
Dec 6, 2024
1d65fb5
fix
Dec 6, 2024
aad341a
chore: nx format:write update dirty files
andes-it Dec 9, 2024
0e43e2c
feat(j-s): add field to relevant models and fetch prop via graphql sc…
thorhildurt Dec 9, 2024
fb4fee0
chore: nx format:write update dirty files
andes-it Dec 9, 2024
6974b9f
feat(web): WHODAS Calculator - Add text to top of component (#17136)
RunarVestmann Dec 5, 2024
a2abd29
feat(old-age-pension): Show conclusion page based on income plan stat…
ylfahfa Dec 5, 2024
9506cee
feat(web): WHODAS calculator - Change how we calculate score (#17139)
RunarVestmann Dec 5, 2024
8e6f6f0
chore(application-system-api-worker): Add missing user notification u…
obmagnusson Dec 5, 2024
01e9b70
fix(web): Generic List - Reset page number when filters are changed (…
RunarVestmann Dec 5, 2024
fd541a9
feat(ids-admin): General Mandate delegation for companies (#17026)
GunnlaugurG Dec 5, 2024
1083d0f
feat(auth-admin): Admin notifications (#16993)
magnearun Dec 5, 2024
d6ae54f
feat(native-app): update vehicle list query in app (#16824)
thoreyjona Dec 5, 2024
cdeb488
fix(ojoi): Updated controllers and bugfixes (#17146)
jonbjarnio Dec 5, 2024
f5d1565
fix(web): WHODAS calculator - Add parenthesis to max score calculatio…
RunarVestmann Dec 5, 2024
f25c74c
feat(j-s): Upload Additional Files to Court (#17152)
gudjong Dec 5, 2024
215e08d
feat(j-s): Show indictment decision type to public prosecutor users (…
oddsson Dec 5, 2024
2d9ee62
fix(j-s): Fix Empty National Id (#17149)
gudjong Dec 5, 2024
697e6de
fix(j-s): Display confirmation modal before completing case (#17112)
unakb Dec 5, 2024
80f3259
feat(j-s): Upload Confirmed Court Record to Court (#17150)
gudjong Dec 5, 2024
3161f9c
feat(web): Organization parent subpage - Use organization layout in c…
RunarVestmann Dec 6, 2024
f8d11af
chore(ids-api): Try fix flaky tests (#17154)
valurefugl Dec 6, 2024
a192ef3
feat(delegation-api): Use national registry v3 for name service (#17088)
magnearun Dec 6, 2024
2f91019
fix(native-app): change border radius circle to be full (#17155)
thoreyjona Dec 6, 2024
4c2a441
fix(j-s): Fix subpoena pdf (#17158)
unakb Dec 6, 2024
77f23da
fix(documents): Sort by publication v1 and v2 by default (#17157)
thordurhhh Dec 6, 2024
a36eaec
fix(inheritance-report): adding funeral service cost (#17159)
albinagu Dec 6, 2024
9a0e693
chore(inao-pp): refactor out custom components and enhance validation…
jonnigs Dec 6, 2024
593425d
fix(domains-education): Update education inna resolver (#17156)
thordurhhh Dec 6, 2024
218100e
feat(web): WHODAS calculator - Remove total score in breakdown and up…
RunarVestmann Dec 6, 2024
b4d6789
fix: add missing datadog ns grant to ids web (#17167)
brynjarorng Dec 6, 2024
595e2eb
feat(j-s): Show district court abbreviation on mobile (#17075)
oddsson Dec 6, 2024
09952dc
fix(ojoi): Input validation and bugfixes (#17124)
jonbjarnio Dec 6, 2024
1540488
feat(native-app): use national registry person endpoint (V3) (#16877)
thoreyjona Dec 9, 2024
d6c8caa
fix(ids-api): Use name field instead of fullname. (#17164)
valurefugl Dec 9, 2024
d4b765a
feat(native-app): support type: 'Table' in field render - do not merg…
thoreyjona Dec 9, 2024
f2d741c
fix(services-bff): Disable PAR until ids resolves error (#17176)
snaerth Dec 9, 2024
a2e0c6e
feat(web): Display logos in login button if there is a different top …
RunarVestmann Dec 9, 2024
6fefde3
feat(contentful-apps): Add organization parent subpage to link group …
mannipje Dec 9, 2024
d276e9d
fix(inheritance-report): adding service to mappers (#17177)
albinagu Dec 9, 2024
8aabb98
feat(web): Change vinnueftirlitid service web footer (#17179)
mannipje Dec 9, 2024
9251f4b
fix(service-portal): Fixes for third-party paths to old login (#17118)
snaerth Dec 9, 2024
cdb638d
fix(web): Set DropdownMenu styles to use minWidth (#17185)
RunarVestmann Dec 9, 2024
90480e5
feat(j-s): Add indictment count subtypes to IndictmentCount (#17129)
oddsson Dec 9, 2024
8c9fa83
feat(j-s): Only registered judge can complete indictment case with ru…
unakb Dec 9, 2024
85deace
fix(inheritance-report): deceased share texts (#17182)
albinagu Dec 9, 2024
7c8c6bb
fix(application-system-api-worker): Get template error catch (#17186)
obmagnusson Dec 9, 2024
cce1883
feat(j-s): Add modal when revoking send to prison admin (#17110)
oddsson Dec 9, 2024
8dd66df
chore(j-s): Switch indictment confirmation request (#17153)
oddsson Dec 9, 2024
d1d03b3
chore(inao-cem): Refactor out custom components (#17161)
jonnigs Dec 9, 2024
ffeb9f5
fix(web): Fix query for generic and team member lists (#17115)
mannipje Dec 10, 2024
1518eb9
fix(my-pages): small tweaks for vaccinations (#17138)
disaerna Dec 10, 2024
e6d5e1e
chore: Helm template support for ArgoCD (#17000)
peturgq Dec 10, 2024
d649388
feat: Add codeOwner to logging context (#17172)
eirikurn Dec 10, 2024
871f807
feat(web): WHODAS calculator - Allow users to go to previous step usi…
RunarVestmann Dec 10, 2024
96c966a
fix(social-insurance-maintenance): Disable payment plan with FF (#17181)
thorkellmani Dec 10, 2024
71fba61
fix(core): S3 copy object with foreign characters (#17151)
HjorturJ Dec 10, 2024
a9b8321
feat(j-s): Notifications to prosecutors office in completed indictmen…
unakb Dec 10, 2024
5d560a7
feat(web): Generic List - Stop date from taking up space if it is not…
RunarVestmann Dec 10, 2024
870b688
feat(native-app): Move app to nx (#17098)
thoreyjona Dec 10, 2024
9320ee0
fix(auth-react): Remove auth-react library in favour of bff (#17102)
snaerth Dec 10, 2024
1f78fec
fix(ads): Update code for explicit and manual use (#17193)
thordurhhh Dec 11, 2024
ec460be
refactor(j-s): add punishmentType to defendant update model
thorhildurt Dec 9, 2024
ca7bd6f
feat(j-s): Update defendant for fmst
thorhildurt Dec 10, 2024
2d47536
feat(j-s): Add limited access defendant endpoint
thorhildurt Dec 11, 2024
4f16d35
fix(f-j): add roles rules to limited access defendant controller
thorhildurt Dec 11, 2024
ce0391d
feat(j-s): add new punishment type field to defendant
thorhildurt Dec 11, 2024
4085d95
chore: nx format:write update dirty files
andes-it Dec 11, 2024
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
  •  
  •  
  •  
68 changes: 67 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,70 @@ apps/**/index.html
# E2E outputs
test-results/
playwright-report/
tmp-sessions/
tmp-sessions/

# React Native

# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.dSYM.zip
*.xcuserstate
**/.xcode.env.local
ios/*.cer
ios/*.certSigningRequest
ios/*.mobileprovision
ios/*.p12

# Android/IntelliJ
#
build/
.idea
.gradle
local.properties
*.iml
*.hprof
.cxx/
*.keystore
!debug.keystore
google-services.json
service-account.json

# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/

**/fastlane/report.xml
**/fastlane/Preview.html
**/fastlane/screenshots
**/fastlane/test_output

# Bundle artifact
*.jsbundle

# Ruby / CocoaPods
**/Pods/
**/vendor/bundle/

# Temporary files created by Metro to check the health of the file watcher
.metro-health-check*

# testing
/coverage
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import { UserService } from '../user/user.service'
import type { User as AuthUser } from '@island.is/auth-nest-tools'
import { ExplicitFlight } from './dto/ExplicitFlight.dto'
import { CreateSuperExplicitDiscountCodeParams } from './dto'
import type { Logger } from '@island.is/logging'
import { LOGGER_PROVIDER } from '@island.is/logging'

interface CachedDiscount {
user: User
Expand Down Expand Up @@ -47,6 +49,8 @@ export class DiscountService {

@InjectModel(ExplicitCode)
private explicitModel: typeof ExplicitCode,
@Inject(LOGGER_PROVIDER)
private readonly logger: Logger,

private readonly userService: UserService,
) {}
Expand Down Expand Up @@ -197,13 +201,19 @@ export class DiscountService {
unConnectedFlights: Flight[] | ExplicitFlight[],
isExplicit: boolean,
flightLegs = 1,
isManual?: boolean,
): Promise<Array<Discount> | null> {
const user = await this.userService.getUserInfoByNationalId(
nationalId,
auth,
isExplicit,
isManual,
)

if (!user) {
this.logger.warn('User by national id not found for explicit discount.', {
category: 'ads-backend',
})
return null
}
// overwrite credit since validation may return 0 depending on what the problem is
Expand All @@ -212,10 +222,19 @@ export class DiscountService {
user.fund.credit = 2 //making sure we can get flight from and to
user.fund.total = 2
} else {
this.logger.warn(
`User fund used requirements not met: ${user.fund.used}.`,
{
category: 'ads-backend',
},
)
return null
}
}
if (user.fund.credit === 0 && user.fund.total !== undefined) {
this.logger.warn(`User fund no credit, has total: ${user.fund.total}.`, {
category: 'ads-backend',
})
return null
}

Expand Down Expand Up @@ -477,6 +496,7 @@ export class DiscountService {
],
}

const isManual = true
const discount = await this.createExplicitDiscountCode(
auth,
body.nationalId,
Expand All @@ -487,6 +507,7 @@ export class DiscountService {
body.needsConnectionFlight ? [flight] : [],
isExplicit,
1,
isManual,
)
if (!discount) {
throw new Error(`Could not create explicit discount`)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ describe('DiscountService', () => {
{
provide: LOGGER_PROVIDER,
useClass: jest.fn(() => ({
error: () => ({}),
error: jest.fn(),
info: jest.fn(),
warn: jest.fn(),
})),
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ const ONE_WEEK = 604800 // seconds
const CACHE_KEY = 'userService'
const MAX_AGE_LIMIT = 18

const DEFAULT_FUND: Fund = {
credit: 2,
total: 2,
used: 0,
}

interface CustodianCache {
custodians: Array<NationalRegistryUser | null>
}
Expand All @@ -42,14 +48,15 @@ export class UserService {
private async getFund(
user: NationalRegistryUser,
auth?: AuthUser,
isManual?: boolean,
): Promise<Fund> {
const { used, unused, total } =
await this.flightService.countThisYearsFlightLegsByNationalId(
user.nationalId,
)
let meetsADSRequirements = false

if (this.flightService.isADSPostalCode(user.postalcode)) {
if (this.flightService.isADSPostalCode(user.postalcode) || isManual) {
meetsADSRequirements = true
} else if (info(user.nationalId).age < MAX_AGE_LIMIT) {
// NationalId is a minor and doesn't live in ADS postal codes.
Expand Down Expand Up @@ -95,20 +102,33 @@ export class UserService {
nationalId: string,
model: new (user: NationalRegistryUser, fund: Fund) => T,
auth: AuthUser,
isExplicit?: boolean,
isManual?: boolean,
): Promise<T | null> {
const user = await this.nationalRegistryService.getUser(nationalId, auth)
if (!user) {
return null
}
const fund = await this.getFund(user, auth)
if (isExplicit) {
return new model(user, DEFAULT_FUND)
}
const fund = await this.getFund(user, auth, isManual)
return new model(user, fund)
}

async getUserInfoByNationalId(
nationalId: string,
auth: AuthUser,
isExplicit?: boolean,
isManual?: boolean,
): Promise<User | null> {
return this.getUserByNationalId<User>(nationalId, User, auth)
return this.getUserByNationalId<User>(
nationalId,
User,
auth,
isExplicit,
isManual,
)
}

async getMultipleUsersByNationalIdArray(
Expand Down
151 changes: 77 additions & 74 deletions apps/application-system/api/infra/application-system-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,80 +49,83 @@ export const GRAPHQL_API_URL_ENV_VAR_NAME = 'GRAPHQL_API_URL' // This property i

const namespace = 'application-system'
const serviceAccount = 'application-system-api'
export const workerSetup =
(): ServiceBuilder<'application-system-api-worker'> =>
service('application-system-api-worker')
.namespace(namespace)
.image('application-system-api')
.db()
.serviceAccount('application-system-api-worker')
.redis()
.codeOwner(CodeOwners.NordaApplications)
.env({
IDENTITY_SERVER_CLIENT_ID: '@island.is/clients/application-system',
IDENTITY_SERVER_ISSUER_URL: {
dev: 'https://identity-server.dev01.devland.is',
staging: 'https://identity-server.staging01.devland.is',
prod: 'https://innskra.island.is',
},
XROAD_CHARGE_FJS_V2_PATH: {
dev: '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: {
dev: 'island-is-dev-storage-application-system',
staging: 'island-is-staging-storage-application-system',
prod: 'island-is-prod-storage-application-system',
},
FILE_SERVICE_PRESIGN_BUCKET: {
dev: 'island-is-dev-fs-presign-bucket',
staging: 'island-is-staging-fs-presign-bucket',
prod: 'island-is-prod-fs-presign-bucket',
},
FILE_STORAGE_UPLOAD_BUCKET: {
dev: 'island-is-dev-upload-api',
staging: 'island-is-staging-upload-api',
prod: 'island-is-prod-upload-api',
},
CLIENT_LOCATION_ORIGIN: {
dev: 'https://beta.dev01.devland.is/umsoknir',
staging: 'https://beta.staging01.devland.is/umsoknir',
prod: 'https://island.is/umsoknir',
local: 'http://localhost:4200/umsoknir',
},
})
.xroad(Base, Client, Payment, Inna, EHIC, WorkMachines)
.secrets({
IDENTITY_SERVER_CLIENT_SECRET:
'/k8s/application-system/api/IDENTITY_SERVER_CLIENT_SECRET',
SYSLUMENN_HOST: '/k8s/application-system-api/SYSLUMENN_HOST',
SYSLUMENN_USERNAME: '/k8s/application-system/api/SYSLUMENN_USERNAME',
SYSLUMENN_PASSWORD: '/k8s/application-system/api/SYSLUMENN_PASSWORD',
DRIVING_LICENSE_BOOK_XROAD_PATH:
'/k8s/application-system-api/DRIVING_LICENSE_BOOK_XROAD_PATH',
DRIVING_LICENSE_BOOK_USERNAME:
'/k8s/application-system-api/DRIVING_LICENSE_BOOK_USERNAME',
DRIVING_LICENSE_BOOK_PASSWORD:
'/k8s/application-system-api/DRIVING_LICENSE_BOOK_PASSWORD',
DOKOBIT_ACCESS_TOKEN:
'/k8s/application-system/api/DOKOBIT_ACCESS_TOKEN',
DOKOBIT_URL: '/k8s/application-system-api/DOKOBIT_URL',
ARK_BASE_URL: '/k8s/application-system-api/ARK_BASE_URL',
DOMSYSLA_PASSWORD: '/k8s/application-system-api/DOMSYSLA_PASSWORD',
DOMSYSLA_USERNAME: '/k8s/application-system-api/DOMSYSLA_USERNAME',
})
.args('main.js', '--job', 'worker')
.command('node')
.extraAttributes({
dev: { schedule: '*/30 * * * *' },
staging: { schedule: '*/30 * * * *' },
prod: { schedule: '*/30 * * * *' },
})
.resources({
limits: { cpu: '400m', memory: '768Mi' },
requests: { cpu: '150m', memory: '384Mi' },
})
export const workerSetup = (services: {
userNotificationService: ServiceBuilder<'services-user-notification'>
}): ServiceBuilder<'application-system-api-worker'> =>
service('application-system-api-worker')
.namespace(namespace)
.image('application-system-api')
.db()
.serviceAccount('application-system-api-worker')
.redis()
.codeOwner(CodeOwners.NordaApplications)
.env({
IDENTITY_SERVER_CLIENT_ID: '@island.is/clients/application-system',
IDENTITY_SERVER_ISSUER_URL: {
dev: 'https://identity-server.dev01.devland.is',
staging: 'https://identity-server.staging01.devland.is',
prod: 'https://innskra.island.is',
},
XROAD_CHARGE_FJS_V2_PATH: {
dev: '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: {
dev: 'island-is-dev-storage-application-system',
staging: 'island-is-staging-storage-application-system',
prod: 'island-is-prod-storage-application-system',
},
FILE_SERVICE_PRESIGN_BUCKET: {
dev: 'island-is-dev-fs-presign-bucket',
staging: 'island-is-staging-fs-presign-bucket',
prod: 'island-is-prod-fs-presign-bucket',
},
FILE_STORAGE_UPLOAD_BUCKET: {
dev: 'island-is-dev-upload-api',
staging: 'island-is-staging-upload-api',
prod: 'island-is-prod-upload-api',
},
CLIENT_LOCATION_ORIGIN: {
dev: 'https://beta.dev01.devland.is/umsoknir',
staging: 'https://beta.staging01.devland.is/umsoknir',
prod: 'https://island.is/umsoknir',
local: 'http://localhost:4200/umsoknir',
},
USER_NOTIFICATION_API_URL: ref(
(h) => `http://${h.svc(services.userNotificationService)}`,
),
})
.xroad(Base, Client, Payment, Inna, EHIC, WorkMachines)
.secrets({
IDENTITY_SERVER_CLIENT_SECRET:
'/k8s/application-system/api/IDENTITY_SERVER_CLIENT_SECRET',
SYSLUMENN_HOST: '/k8s/application-system-api/SYSLUMENN_HOST',
SYSLUMENN_USERNAME: '/k8s/application-system/api/SYSLUMENN_USERNAME',
SYSLUMENN_PASSWORD: '/k8s/application-system/api/SYSLUMENN_PASSWORD',
DRIVING_LICENSE_BOOK_XROAD_PATH:
'/k8s/application-system-api/DRIVING_LICENSE_BOOK_XROAD_PATH',
DRIVING_LICENSE_BOOK_USERNAME:
'/k8s/application-system-api/DRIVING_LICENSE_BOOK_USERNAME',
DRIVING_LICENSE_BOOK_PASSWORD:
'/k8s/application-system-api/DRIVING_LICENSE_BOOK_PASSWORD',
DOKOBIT_ACCESS_TOKEN: '/k8s/application-system/api/DOKOBIT_ACCESS_TOKEN',
DOKOBIT_URL: '/k8s/application-system-api/DOKOBIT_URL',
ARK_BASE_URL: '/k8s/application-system-api/ARK_BASE_URL',
DOMSYSLA_PASSWORD: '/k8s/application-system-api/DOMSYSLA_PASSWORD',
DOMSYSLA_USERNAME: '/k8s/application-system-api/DOMSYSLA_USERNAME',
})
.args('main.js', '--job', 'worker')
.command('node')
.extraAttributes({
dev: { schedule: '*/30 * * * *' },
staging: { schedule: '*/30 * * * *' },
prod: { schedule: '*/30 * * * *' },
})
.resources({
limits: { cpu: '400m', memory: '768Mi' },
requests: { cpu: '150m', memory: '384Mi' },
})

export const serviceSetup = (services: {
documentsService: ServiceBuilder<'services-documents'>
Expand Down
Loading
Loading