-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into efs_calculatewithshare
- Loading branch information
Showing
22 changed files
with
228 additions
and
101 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
apps/judicial-system/backend/migrations/20240904100012-update-institution.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
'use strict' | ||
|
||
module.exports = { | ||
up: async (queryInterface, Sequelize) => { | ||
await queryInterface.addColumn('institution', 'address', { | ||
type: Sequelize.STRING, | ||
allowNull: true, | ||
}) | ||
|
||
const institutionsToUpdate = [ | ||
{ | ||
name: 'Héraðsdómur Reykjavíkur', | ||
address: 'Dómhúsið við Lækjartorg, Reykjavík', | ||
}, | ||
{ name: 'Héraðsdómur Reykjaness', address: 'Fjarðargata 9, Hafnarfirði' }, | ||
{ | ||
name: 'Héraðsdómur Vesturlands', | ||
address: 'Bjarnarbraut 8, Borgarnesi', | ||
}, | ||
{ name: 'Héraðsdómur Vestfjarða', address: 'Hafnarstræti 9, Ísafirði' }, | ||
{ | ||
name: 'Héraðsdómur Norðurlands vestra', | ||
address: 'Skagfirðingabraut 21, Sauðárkróki', | ||
}, | ||
{ | ||
name: 'Héraðsdómur Norðurlands eystra', | ||
address: 'Hafnarstræti 107, 4. hæð, Akureyri', | ||
}, | ||
{ name: 'Héraðsdómur Austurlands', address: 'Lyngás 15, Egilsstöðum' }, | ||
{ name: 'Héraðsdómur Suðurlands', address: 'Austurvegur 4, Selfossi' }, | ||
] | ||
|
||
await queryInterface.sequelize.transaction(async (transaction) => { | ||
for (const institution of institutionsToUpdate) { | ||
await queryInterface.bulkUpdate( | ||
'institution', | ||
{ address: institution.address }, | ||
{ name: institution.name }, | ||
{ transaction }, | ||
) | ||
} | ||
}) | ||
}, | ||
|
||
down: async (queryInterface) => { | ||
await queryInterface.removeColumn('institution', 'address') | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
apps/judicial-system/backend/src/app/modules/case/interceptors/caseFile.interceptor.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { Observable } from 'rxjs' | ||
import { map } from 'rxjs/operators' | ||
|
||
import { | ||
CallHandler, | ||
ExecutionContext, | ||
Injectable, | ||
NestInterceptor, | ||
} from '@nestjs/common' | ||
|
||
import { | ||
CaseAppealState, | ||
CaseFileCategory, | ||
isDefenceUser, | ||
isPrisonStaffUser, | ||
isPrisonSystemUser, | ||
User, | ||
} from '@island.is/judicial-system/types' | ||
|
||
import { Case } from '../models/case.model' | ||
|
||
@Injectable() | ||
export class CaseFileInterceptor implements NestInterceptor { | ||
intercept(context: ExecutionContext, next: CallHandler): Observable<Case> { | ||
const request = context.switchToHttp().getRequest() | ||
const user: User = request.user | ||
|
||
return next.handle().pipe( | ||
map((data: Case) => { | ||
if (isDefenceUser(user)) { | ||
return data | ||
} | ||
|
||
if ( | ||
isPrisonStaffUser(user) || | ||
data.appealState !== CaseAppealState.COMPLETED | ||
) { | ||
data.caseFiles?.splice(0, data.caseFiles.length) | ||
} else if (isPrisonSystemUser(user)) { | ||
data.caseFiles?.splice( | ||
0, | ||
data.caseFiles.length, | ||
...data.caseFiles.filter( | ||
(cf) => cf.category === CaseFileCategory.APPEAL_RULING, | ||
), | ||
) | ||
} | ||
|
||
return data | ||
}), | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,5 @@ bootstrap({ | |
appModule: AppModule, | ||
name: 'regulations-admin-backend', | ||
openApi, | ||
jsonBodyLimit: '300kb', | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 0 additions & 37 deletions
37
...emplates/inheritance-report/src/fields/CalculationsOfTotal/CalculateTotalAssets/index.tsx
This file was deleted.
Oops, something went wrong.
21 changes: 21 additions & 0 deletions
21
...tion/templates/inheritance-report/src/fields/CalculationsOfTotal/SetTotalAssets/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { FieldBaseProps } from '@island.is/application/types' | ||
import { FC, useEffect } from 'react' | ||
import { useFormContext } from 'react-hook-form' | ||
import { calculateTotalAssets } from '../../../lib/utils/calculateTotalAssets' | ||
|
||
export const SetTotalAssets: FC<React.PropsWithChildren<FieldBaseProps>> = ({ | ||
application, | ||
}) => { | ||
const { answers } = application | ||
const { setValue } = useFormContext() | ||
|
||
const total = calculateTotalAssets(answers) | ||
|
||
useEffect(() => { | ||
setValue('assets.assetsTotal', total) | ||
}, [total, setValue]) | ||
|
||
return null | ||
} | ||
|
||
export default SetTotalAssets |
Oops, something went wrong.