Skip to content

Commit

Permalink
merged with main
Browse files Browse the repository at this point in the history
  • Loading branch information
GunnlaugurG committed May 23, 2024
2 parents 2887604 + 94fd51f commit 808d9ef
Show file tree
Hide file tree
Showing 170 changed files with 5,069 additions and 3,732 deletions.
26 changes: 0 additions & 26 deletions .yarn/patches/cache-manager-ioredis-yet-npm-1.1.0-da7d1a9865.patch

This file was deleted.

4 changes: 2 additions & 2 deletions apps/api/infra/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -440,8 +440,8 @@ export const serviceSetup = (services: {
.readiness('/health')
.liveness('/liveness')
.resources({
limits: { cpu: '600m', memory: '2048Mi' },
requests: { cpu: '250m', memory: '896Mi' },
limits: { cpu: '1200m', memory: '2048Mi' },
requests: { cpu: '350m', memory: '896Mi' },
})
.replicaCount({
default: 2,
Expand Down
3 changes: 1 addition & 2 deletions apps/api/src/app/graphql-options.factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,14 @@ export class GraphqlOptionsFactory implements GqlOptionsFactory {
? true
: 'apps/api/src/api.graphql'
const bypassCacheSecret = this.config.bypassCacheSecret

return {
debug,
playground,
autoSchemaFile,
path: '/api/graphql',
cache:
this.config.redis.nodes.length > 0
? await createRedisApolloCache({
? createRedisApolloCache({
name: 'apollo-cache',
nodes: this.config.redis.nodes,
ssl: this.config.redis.ssl,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ export class CreateApplicationInput implements CreateApplication {
@Field({ nullable: true })
readonly formComment?: string

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

@Allow()
@Field(() => String)
readonly state!: ApplicationState
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ export class ApplicationModel implements Application {
@Field({ nullable: true })
readonly formComment?: string

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

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

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
'use strict'

module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.sequelize.transaction((t) =>
Promise.all([
queryInterface.addColumn(
'applications',
'children_comment',
{
type: Sequelize.TEXT,
allowNull: true,
},
{ transaction: t },
),
]),
)
},

down: (queryInterface, Sequelize) => {
return queryInterface.sequelize.transaction((t) =>
Promise.all([
queryInterface.removeColumn('applications', 'children_comment', {
transaction: t,
}),
]),
)
},
}
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,12 @@ export class ApplicationService {
updatedApplication?.setDataValue('applicationEvents', eventsResolved)
})

const children = this.childrenService
.findById(id)
.then((childrenResolved) => {
updatedApplication?.setDataValue('children', childrenResolved)
})

const files = this.fileService
.getAllApplicationFiles(id)
.then((filesResolved) => {
Expand Down Expand Up @@ -534,7 +540,7 @@ export class ApplicationService {
])
}

await Promise.all([events, files, directTaxPayments])
await Promise.all([events, files, directTaxPayments, children])

return updatedApplication
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ export class CreateApplicationDto {
@ApiProperty()
readonly formComment: string

@IsOptional()
@IsString()
@ApiProperty()
readonly childrenComment: string

@IsNotEmpty()
@IsString()
@ApiProperty()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,19 @@ export class ApplicationModel extends Model {
interview: boolean

@Column({
type: DataType.STRING,
type: DataType.TEXT,
allowNull: true,
})
@ApiProperty()
formComment: string

@Column({
type: DataType.TEXT,
allowNull: true,
})
@ApiProperty()
childrenComment: string

@Column({
type: DataType.STRING,
allowNull: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { createTestingApplicationModule } from './createTestingApplicationModule
import type { User } from '@island.is/auth-nest-tools'
import { MunicipalitiesFinancialAidScope } from '@island.is/auth/scopes'
import { DirectTaxPaymentService } from '../../directTaxPayment'
import { ChildrenService } from '../../children'

interface Then {
result: ApplicationModel
Expand All @@ -45,6 +46,7 @@ describe('ApplicationController - Update', () => {
let mockMunicipalityService: MunicipalityService
let mockEmailService: EmailService
let mockDirectTaxPaymentService: DirectTaxPaymentService
let mockChildrenService: ChildrenService

beforeEach(async () => {
const {
Expand All @@ -57,6 +59,7 @@ describe('ApplicationController - Update', () => {
municipalityService,
emailService,
directTaxPaymentService,
childrenService,
} = await createTestingApplicationModule()

mockApplicationModel = applicationModel
Expand All @@ -67,6 +70,7 @@ describe('ApplicationController - Update', () => {
mockMunicipalityService = municipalityService
mockEmailService = emailService
mockDirectTaxPaymentService = directTaxPaymentService
mockChildrenService = childrenService

givenWhenThen = async (
id: string,
Expand Down Expand Up @@ -158,6 +162,8 @@ describe('ApplicationController - Update', () => {
const getDirectTaxPayment =
mockDirectTaxPaymentService.getByApplicationId as jest.Mock
getDirectTaxPayment.mockReturnValueOnce(Promise.resolve([]))
const getChildren = mockChildrenService.findById as jest.Mock
getChildren.mockReturnValueOnce(Promise.resolve([]))

then = await givenWhenThen(id, applicationUpdate, user)
})
Expand Down Expand Up @@ -273,6 +279,8 @@ describe('ApplicationController - Update', () => {
const getDirectTaxPayment =
mockDirectTaxPaymentService.getByApplicationId as jest.Mock
getDirectTaxPayment.mockReturnValueOnce(Promise.resolve([]))
const getChildren = mockChildrenService.findById as jest.Mock
getChildren.mockReturnValueOnce(Promise.resolve([]))
})

describe('Allowed events', () => {
Expand Down Expand Up @@ -382,6 +390,8 @@ describe('ApplicationController - Update', () => {
const getDirectTaxPayment =
mockDirectTaxPaymentService.getByApplicationId as jest.Mock
getDirectTaxPayment.mockReturnValueOnce(Promise.resolve([]))
const getChildren = mockChildrenService.findById as jest.Mock
getChildren.mockReturnValueOnce(Promise.resolve([]))
})

describe('Forbidden events', () => {
Expand Down Expand Up @@ -498,6 +508,8 @@ describe('ApplicationController - Update', () => {
const getDirectTaxPayment =
mockDirectTaxPaymentService.getByApplicationId as jest.Mock
getDirectTaxPayment.mockReturnValueOnce(Promise.resolve([]))
const getChildren = mockChildrenService.findById as jest.Mock
getChildren.mockReturnValueOnce(Promise.resolve([]))

then = await givenWhenThen(id, applicationUpdate, staff)
})
Expand Down
72 changes: 54 additions & 18 deletions apps/financial-aid/web-veita/graphql/sharedGql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export const ApplicationQuery = gql`
}
state
formComment
childrenComment
spouseFormComment
municipalityCode
studentCustom
Expand Down Expand Up @@ -200,6 +201,7 @@ export const ApplicationEventMutation = gql`
mutation CreateApplicationEvent($input: CreateApplicationEventInput!) {
createApplicationEvent(input: $input) {
id
applicationSystemId
nationalId
created
modified
Expand All @@ -217,6 +219,14 @@ export const ApplicationEventMutation = gql`
interview
employmentCustom
homeCircumstancesCustom
familyStatus
spouseNationalId
spouseName
spouseEmail
spousePhoneNumber
city
streetName
postalCode
files {
id
applicationId
Expand All @@ -227,20 +237,44 @@ export const ApplicationEventMutation = gql`
}
state
formComment
childrenComment
spouseFormComment
municipalityCode
studentCustom
rejection
staff {
name
municipalityIds
nationalId
}
applicationEvents {
id
applicationId
eventType
comment
created
staffNationalId
staffName
staffNationalId
emailSent
}
children {
id
applicationId
nationalId
name
school
}
amount {
aidAmount
income
personalTaxCredit
spousePersonalTaxCredit
tax
finalAmount
deductionFactors {
description
amount
}
}
spouseHasFetchedDirectTaxPayment
hasFetchedDirectTaxPayment
Expand Down Expand Up @@ -284,6 +318,7 @@ export const UpdateApplicationMutation = gql`
mutation UpdateApplicationMutation($input: UpdateApplicationInput!) {
updateApplication(input: $input) {
id
applicationSystemId
nationalId
created
modified
Expand All @@ -306,7 +341,6 @@ export const UpdateApplicationMutation = gql`
spouseName
spouseEmail
spousePhoneNumber
municipalityCode
city
streetName
postalCode
Expand All @@ -320,9 +354,16 @@ export const UpdateApplicationMutation = gql`
}
state
formComment
childrenComment
spouseFormComment
municipalityCode
studentCustom
rejection
staff {
name
municipalityIds
nationalId
}
applicationEvents {
id
applicationId
Expand All @@ -340,22 +381,6 @@ export const UpdateApplicationMutation = gql`
name
school
}
staff {
name
municipalityIds
nationalId
}
spouseHasFetchedDirectTaxPayment
hasFetchedDirectTaxPayment
directTaxPayments {
totalSalary
payerNationalId
personalAllowance
withheldAtSource
month
year
userType
}
amount {
aidAmount
income
Expand All @@ -368,6 +393,17 @@ export const UpdateApplicationMutation = gql`
amount
}
}
spouseHasFetchedDirectTaxPayment
hasFetchedDirectTaxPayment
directTaxPayments {
totalSalary
payerNationalId
personalAllowance
withheldAtSource
month
year
userType
}
navSuccess
}
}
Expand Down
13 changes: 12 additions & 1 deletion apps/financial-aid/web-veita/src/utils/applicationHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,18 @@ export const getChildrenInfo = (application: Application) => {
]
})

return allChildren.flat()
const childrenComment = application.childrenComment
? [
{
title: 'Athugasemd',
content: '',
other: application.childrenComment,
fullWidth: commentFullWidth(application.childrenComment),
},
]
: []

return allChildren.flat().concat(childrenComment)
}

export const getApplicantSpouse = (application: Application) => {
Expand Down
Loading

0 comments on commit 808d9ef

Please sign in to comment.