Skip to content

Commit

Permalink
feat(license-service): update license service (#15204)
Browse files Browse the repository at this point in the history
* feat:updat emodels

* feat/bunch

* feat: updates

* feat: add and remove

* chore: stash merge

* feat: more stuff

* fix: license type

* feat: license overivew works

* chore:revert

* chore: revert messages

* chore: console

* chore: revert

* chore: nx format:write update dirty files

* fix: passports

* chore: start details

* chore: nx format:write update dirty files

* feat: update details

* fix: enum

* fix: date format

* fix: type import

* chore:small fixes

* chore:rename-liceinse-service
'

'

* chore: remove original license service

* chore: add unchanged license service

* chore: add mocks back

* chore: add to resolver

* chore:renmae license

* chore: readd licens service

* fix: license-v2

* fix: readd ls-v1

* feat: rename

* chore: nx format:write update dirty files

* fix: passport display

* chore: codeowners

* chore: move datafields

* fix: html semantics

* fix:pkpass display

* chore:console log

* chore: use types

* feat: remove v2 and merge in v1

* chore:import

* fix: expires

* fix:navigation

* fix: mapping

* chore: import

* fix: time format

* fix:fix

* chore: clean up types

* fix: async

* fix: messages

* fix: update display slightly

* fix: mcoks

* chore: deprecate model

* chore: import clean up

* fix: update mapping

* chore: import clean up

* fix: reimport reaect

* chore: use tag map

* chore: coderabbit improvements

* fix: const issues

* chore: concising

---------

Co-authored-by: Þorkell Máni Þorkelsson <[email protected]>
Co-authored-by: andes-it <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
4 people authored and oskarjs committed Aug 20, 2024
1 parent 609194d commit 1a59589
Show file tree
Hide file tree
Showing 86 changed files with 3,154 additions and 1,282 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,7 @@ const NotificationMenu = ({
isVisible={sideMenuOpen}
hideOnClickOutside={true}
hideOnEsc={true}
modalLabel={formatMessage({
id: 'service.portal:notification-button-aria',
defaultMessage: 'Valmynd fyrir tilkynningar',
})}
modalLabel={formatMessage(m.notificationButtonAria)}
removeOnClose={true}
preventBodyScroll={false}
onVisibilityChange={(visibility: boolean) => {
Expand Down
6 changes: 1 addition & 5 deletions apps/service-portal/src/components/Sidemenu/Sidemenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,7 @@ const Sidemenu = ({
isVisible={sideMenuOpen}
hideOnClickOutside={true}
hideOnEsc={true}
modalLabel={formatMessage({
id: 'service.portal:menu-button-aria',
description: 'Lýsing á notendavalmynd fyrir skjálesara',
defaultMessage: 'Valmynd fyrir yfirlit',
})}
modalLabel={formatMessage(m.menuButtonAria)}
removeOnClose={true}
preventBodyScroll={false}
onVisibilityChange={(visibility: boolean) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ export const loadLicensesXroadMocks = async () => {
categories: [
{
id: 68446262,
nr: '5u84961',
nr: 'A',
categoryName: 'Big big trucks',
publishDate: new Date('2017-04-22T15:30:23Z'),
dateTo: new Date('2030-04-22T15:30:23Z'),
Expand Down Expand Up @@ -524,7 +524,7 @@ export const loadLicensesXroadMocks = async () => {
licenseNumber: '987654321',
properties: [
{
category: 'testCatA',
category: 'A',
typeOfFirearm: 'cannon',
name: 'Howitzer',
serialNumber: '1337',
Expand All @@ -533,7 +533,7 @@ export const loadLicensesXroadMocks = async () => {
limitation: 'aint no brakes',
},
{
category: 'testCatB',
category: 'B',
typeOfFirearm: 'laserrailgun',
name: 'Macguffin',
serialNumber: '010101',
Expand All @@ -552,8 +552,18 @@ export const loadLicensesXroadMocks = async () => {
apiPath: '/api/FirearmApplication/Categories',
response: [
new Response().withJSONBody({
testCatA: 'bibbiddí boo',
testCatB: 'babbbada',
'Flokkur A':
'1. Haglabyssum nr. 12 og minni, þó eigi sjálfvirkum eða hálfsjálfvirkum.\n2. Rifflum cal. 22 (long rifle og minni), þ.m.t. loftrifflum, þó eigi sjálfvirkum eða hálfsjálfvirkum.',
'Flokkur B':
'Leyfi fyrir rifflum með hlaupvídd allt að cal. 30 og hálfsjálfvirkum haglabyssum skal ekki veitt nema sérstakar ástæður mæli með því, enda hafi umsækjandi haft skotvopnaleyfi í a.m.k. eitt ár.',
'Flokkur C':
'Leyfi fyrir skotvopnum sem sérstaklega eru ætluð til minkaveiða eða meindýraeyðingar (t.d. skammbyssur fyrir haglaskot) má aðeins veita að fenginni umsögn veiðistjóra. Áskilið er að umsækjandi hafi haft aukin skotvopnaréttindi (B flokkur) í eitt ár. Slík leyfi vegna þeirra sem stunda minkaveiðar skal ekki veita til að eignast skotvopn heldur einungis til láns eða leigu. Lögreglustjóri skal senda slíkar umsóknir með umsögn sinni ríkislögreglustjóra til ákvörðunar.',
'Flokkur D':
'Leyfi sem sérstaklega er veitt einstaklingi eða skotfélagi fyrir skammbyssum vegna íþróttaskotfimi sbr. 11. gr. Lögreglustjóri skal senda slíkar umsóknir með umsögn sinni ríkislögreglustjóra til ákvörðunar.',
'Flokkur E':
'Leyfi lögreglustjóra til að hlaða skothylki til eigin nota í þau skotvopn sem viðkomandi hefur leyfi fyrir, enda sé að öðru leyti heimilt að nota slík skotfæri hér á landi.',
'Flokkur S':
'Söfnunarleyfi sbr. 20. gr. Reglugerð um skotvopn, skotfæri o.fl.',
}),
],
})
Expand Down
6 changes: 6 additions & 0 deletions libs/api/domains/license-service/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
"options": {
"jestConfig": "libs/api/domains/license-service/jest.config.ts"
}
},
"extract-strings": {
"executor": "nx:run-commands",
"options": {
"command": "yarn ts-node -P libs/localization/tsconfig.lib.json libs/localization/scripts/extract 'libs/api/domains/license-service/src/lib/messages.ts'"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Field, ObjectType } from '@nestjs/graphql'
import { Field, ObjectType, Int } from '@nestjs/graphql'

@ObjectType('CreateBarcodeResult')
export class CreateBarcodeResult {
Expand All @@ -7,7 +7,7 @@ export class CreateBarcodeResult {
})
token!: string

@Field(() => Number, {
@Field(() => Int, {
description: 'Barcode expire time in seconds',
})
expiresIn!: number
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Field, ObjectType, registerEnumType } from '@nestjs/graphql'
import { Field, Int, ObjectType, registerEnumType } from '@nestjs/graphql'
import {
GenericLicenseType,
GenericUserLicensePkPassStatus,
Expand Down Expand Up @@ -33,20 +33,19 @@ export class GenericLicense {
})
provider!: GenericLicenseProvider

@Field({ description: 'Display name of license' })
name?: string

@Field({ description: 'Does the license support pkpass?' })
pkpass!: boolean

@Field({ description: 'Does the license support verification of pkpass?' })
pkpassVerify!: boolean

@Field({
@Field(() => Int, {
description:
'How long the data about the license should be treated as fresh',
nullable: true,
deprecationReason: 'Unclear if this is used, will revert if necessary',
})
timeout!: number
timeout?: number

@Field(() => GenericUserLicenseStatus, { description: 'Status of license' })
status!: GenericUserLicenseStatus
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Field, ObjectType } from '@nestjs/graphql'
import { GenericLicenseError } from './GenericLicenseError.dto'
import { GenericUserLicense } from './GenericUserLicense.dto'

@ObjectType('GenericLicenseCollection')
export class LicenseCollection {
@Field(() => [GenericUserLicense], { nullable: true })
licenses!: Array<GenericUserLicense>

@Field(() => [GenericLicenseError], { nullable: true })
errors?: Array<GenericLicenseError>
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Field, ObjectType, registerEnumType } from '@nestjs/graphql'
import { GenericLicenseDataFieldType } from '../licenceService.type'
import { GenericUserLicenseMetaLinks } from './GenericUserLicenseMetaLinks.dto'
import { GenericUserLicenseMetaTag } from './GenericUserLicenseMetaTag.dto'

registerEnumType(GenericLicenseDataFieldType, {
name: 'GenericLicenseDataFieldType',
Expand All @@ -20,15 +21,19 @@ export class GenericLicenseDataField {
@Field({ nullable: true, description: 'Label of data field' })
label?: string

@Field({ nullable: true, description: 'Value of data field' })
value?: string

@Field({
nullable: true,
description: 'Same as value, used in service portal',
description: 'Display value of data field category',
deprecationReason: 'Only used for cosmetic purposes, can be done better',
})
description?: string

@Field({ nullable: true, description: 'Value of data field' })
value?: string

@Field(() => GenericUserLicenseMetaTag, { nullable: true })
tag?: GenericUserLicenseMetaTag

@Field(() => GenericUserLicenseMetaLinks, {
nullable: true,
description: 'External meta link',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Field, Int, ObjectType } from '@nestjs/graphql'
import { GenericLicenseType } from '../licenceService.type'
import { GenericLicenseProvider } from './GenericLicenseProvider.dto'
import { GenericLicenseFetch } from './GenericLicenseFetch.dto'

@ObjectType('GenericLicenseError')
export class GenericLicenseError {
@Field(() => GenericLicenseType)
type!: GenericLicenseType

@Field(() => GenericLicenseFetch, { description: 'Info about license fetch' })
fetch!: GenericLicenseFetch

@Field(() => GenericLicenseProvider, { nullable: true })
provider?: GenericLicenseProvider

@Field(() => Int, { nullable: true })
code?: number

@Field({ nullable: true })
message?: string

@Field({ nullable: true })
extraData?: string
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,16 @@ export class GenericLicenseProvider {
description: 'ID of license provider',
})
id!: GenericLicenseProviderId

@Field({
nullable: true,
description: 'Contentful reference id',
})
referenceId?: string

@Field({ nullable: true })
providerName?: string

@Field({ nullable: true })
providerLogo?: string
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import { Field, ObjectType } from '@nestjs/graphql'

@ObjectType()
export class GenericPkPass {
@Field(() => String)
@Field()
pkpassUrl!: string
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import { Field, ObjectType } from '@nestjs/graphql'

@ObjectType()
export class GenericPkPassQrCode {
@Field(() => String)
@Field()
pkpassQRCode!: string
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@ import { Field, ObjectType } from '@nestjs/graphql'

@ObjectType()
export class GenericPkPassVerificationError {
@Field(() => String, {
@Field({
nullable: true,
description:
'pkpass verification error code, depandant on origination service, "0" for unknown error',
})
status?: string

@Field(() => String, {
@Field({
nullable: true,
description:
'pkpass verification error message, depandant on origination service',
})
message?: string

@Field(() => String, {
@Field({
nullable: true,
description: 'Optional data related to the error',
})
Expand All @@ -25,7 +25,7 @@ export class GenericPkPassVerificationError {

@ObjectType()
export class GenericPkPassVerification {
@Field(() => String, {
@Field({
nullable: true,
description: 'Optional data related to the pkpass verification',
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@ import { Payload } from './Payload.dto'
export class GenericUserLicense {
@Field({
description: 'National ID of license owner',
deprecationReason: 'Moved one level up',
})
nationalId!: string

@Field({
nullable: true,
description: 'Is license owner child of user',
})
isOwnerChildOfUser?: boolean

@Field(() => GenericLicense, { description: 'License info' })
license!: GenericLicense

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Field, ObjectType, registerEnumType } from '@nestjs/graphql'
import { AlertType } from '../licenceService.type'

registerEnumType(AlertType, {
name: 'GenericUserLicenseAlertType',
})

@ObjectType('GenericUserLicenseAlert')
export class GenericUserLicenseAlert {
@Field()
title!: string

@Field(() => AlertType, { defaultValue: AlertType.WARNING })
type?: AlertType

@Field({ nullable: true })
message?: string
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ registerEnumType(GenericUserLicenseMetaLinksType, {

@ObjectType()
export class GenericUserLicenseMetaLinks {
@Field(() => String, { nullable: true })
@Field({ nullable: true })
label?: string

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

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

@Field(() => GenericUserLicenseMetaLinksType, { nullable: true })
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { Field, ObjectType, registerEnumType } from '@nestjs/graphql'
import {
GenericUserLicenseDataFieldTagColor,
GenericUserLicenseDataFieldTagType,
} from '../licenceService.type'

registerEnumType(GenericUserLicenseDataFieldTagType, {
name: 'GenericUserLicenseDataFieldTagType',
description: 'Exhaustive list of possible tag icons',
})
registerEnumType(GenericUserLicenseDataFieldTagColor, {
name: 'GenericUserLicenseDataFieldTagColor',
description: 'Exhaustive list of possible tag icon color',
})

@ObjectType('GenericUserLicenseMetaTag')
export class GenericUserLicenseMetaTag {
@Field()
text!: string

@Field({ nullable: true })
color?: string

@Field(() => GenericUserLicenseDataFieldTagType, { nullable: true })
icon?: GenericUserLicenseDataFieldTagType

@Field(() => GenericUserLicenseDataFieldTagColor, { nullable: true })
iconColor?: GenericUserLicenseDataFieldTagColor

@Field({
nullable: true,
description:
'Defaults to the text property if icon defined but iconText left undefined',
})
iconText?: string
}
Loading

0 comments on commit 1a59589

Please sign in to comment.