-
Notifications
You must be signed in to change notification settings - Fork 57
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 ids-admin/add-legalrep-translation
- Loading branch information
Showing
43 changed files
with
1,018 additions
and
56 deletions.
There are no files selected for viewing
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
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
89 changes: 89 additions & 0 deletions
89
apps/judicial-system/api/src/app/modules/defendant/civilClaimant.resolver.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,89 @@ | ||
import { Inject, Logger, UseGuards } from '@nestjs/common' | ||
import { Args, Context, Mutation, Resolver } from '@nestjs/graphql' | ||
|
||
import { LOGGER_PROVIDER } from '@island.is/logging' | ||
|
||
import { | ||
AuditedAction, | ||
AuditTrailService, | ||
} from '@island.is/judicial-system/audit-trail' | ||
import { | ||
CurrentGraphQlUser, | ||
JwtGraphQlAuthGuard, | ||
} from '@island.is/judicial-system/auth' | ||
import type { User } from '@island.is/judicial-system/types' | ||
|
||
import { BackendService } from '../backend' | ||
import { CreateCivilClaimantInput } from './dto/createCivilClaimant.input' | ||
import { DeleteCivilClaimantInput } from './dto/deleteCivilClaimant.input' | ||
import { UpdateCivilClaimantInput } from './dto/updateCivilClaimant.input' | ||
import { CivilClaimant } from './models/civilClaimant.model' | ||
import { DeleteCivilClaimantResponse } from './models/deleteCivilClaimant.response' | ||
|
||
@UseGuards(JwtGraphQlAuthGuard) | ||
@Resolver(() => CivilClaimant) | ||
export class CivilClaimantResolver { | ||
constructor( | ||
private readonly auditTrailService: AuditTrailService, | ||
@Inject(LOGGER_PROVIDER) | ||
private readonly logger: Logger, | ||
) {} | ||
|
||
@Mutation(() => CivilClaimant) | ||
createCivilClaimant( | ||
@Args('input', { type: () => CreateCivilClaimantInput }) | ||
input: CreateCivilClaimantInput, | ||
@CurrentGraphQlUser() user: User, | ||
@Context('dataSources') | ||
{ backendService }: { backendService: BackendService }, | ||
): Promise<CivilClaimant> { | ||
const { caseId, ...createCivilClaimant } = input | ||
|
||
return this.auditTrailService.audit( | ||
user.id, | ||
AuditedAction.CREATE_CIVIL_CLAIMANT, | ||
backendService.createCivilClaimant(caseId, createCivilClaimant), | ||
(civilClaimant) => civilClaimant.id, | ||
) | ||
} | ||
|
||
@Mutation(() => CivilClaimant) | ||
updateCivilClaimant( | ||
@Args('input', { type: () => UpdateCivilClaimantInput }) | ||
input: UpdateCivilClaimantInput, | ||
@CurrentGraphQlUser() user: User, | ||
@Context('dataSources') | ||
{ backendService }: { backendService: BackendService }, | ||
): Promise<CivilClaimant> { | ||
const { caseId, civilClaimantId, ...updateCivilClaimant } = input | ||
|
||
return this.auditTrailService.audit( | ||
user.id, | ||
AuditedAction.UPDATE_CIVIL_CLAIMANT, | ||
backendService.updateCivilClaimant( | ||
caseId, | ||
civilClaimantId, | ||
updateCivilClaimant, | ||
), | ||
(civilClaimant) => civilClaimant.id, | ||
) | ||
} | ||
|
||
@Mutation(() => DeleteCivilClaimantResponse) | ||
async deleteCivilClaimant( | ||
@Args('input', { type: () => DeleteCivilClaimantInput }) | ||
input: DeleteCivilClaimantInput, | ||
@CurrentGraphQlUser() user: User, | ||
@Context('dataSources') | ||
{ backendService }: { backendService: BackendService }, | ||
): Promise<DeleteCivilClaimantResponse> { | ||
const { caseId, civilClaimantId } = input | ||
|
||
return this.auditTrailService.audit( | ||
user.id, | ||
AuditedAction.DELETE_CIVIL_CLAIMANT, | ||
backendService.deleteCivilClaimant(caseId, civilClaimantId), | ||
civilClaimantId, | ||
) | ||
} | ||
} |
3 changes: 2 additions & 1 deletion
3
apps/judicial-system/api/src/app/modules/defendant/defendant.module.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 |
---|---|---|
@@ -1,8 +1,9 @@ | ||
import { Module } from '@nestjs/common' | ||
|
||
import { CivilClaimantResolver } from './civilClaimant.resolver' | ||
import { DefendantResolver } from './defendant.resolver' | ||
|
||
@Module({ | ||
providers: [DefendantResolver], | ||
providers: [DefendantResolver, CivilClaimantResolver], | ||
}) | ||
export class DefendantModule {} |
10 changes: 10 additions & 0 deletions
10
apps/judicial-system/api/src/app/modules/defendant/dto/createCivilClaimant.input.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,10 @@ | ||
import { Allow } from 'class-validator' | ||
|
||
import { Field, ID, InputType } from '@nestjs/graphql' | ||
|
||
@InputType() | ||
export class CreateCivilClaimantInput { | ||
@Allow() | ||
@Field(() => ID) | ||
readonly caseId!: string | ||
} |
14 changes: 14 additions & 0 deletions
14
apps/judicial-system/api/src/app/modules/defendant/dto/deleteCivilClaimant.input.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,14 @@ | ||
import { Allow } from 'class-validator' | ||
|
||
import { Field, ID, InputType } from '@nestjs/graphql' | ||
|
||
@InputType() | ||
export class DeleteCivilClaimantInput { | ||
@Allow() | ||
@Field(() => ID) | ||
readonly caseId!: string | ||
|
||
@Allow() | ||
@Field(() => ID) | ||
readonly civilClaimantId!: string | ||
} |
64 changes: 64 additions & 0 deletions
64
apps/judicial-system/api/src/app/modules/defendant/dto/updateCivilClaimant.input.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,64 @@ | ||
import { Allow, IsOptional } from 'class-validator' | ||
|
||
import { Field, ID, InputType } from '@nestjs/graphql' | ||
|
||
@InputType() | ||
export class UpdateCivilClaimantInput { | ||
@Allow() | ||
@Field(() => ID) | ||
readonly civilClaimantId!: string | ||
|
||
@Allow() | ||
@Field(() => ID) | ||
readonly caseId!: string | ||
|
||
@Allow() | ||
@IsOptional() | ||
@Field(() => Boolean, { nullable: true }) | ||
readonly noNationalId?: boolean | ||
|
||
@Allow() | ||
@IsOptional() | ||
@Field(() => String, { nullable: true }) | ||
readonly name?: string | ||
|
||
@Allow() | ||
@IsOptional() | ||
@Field(() => String, { nullable: true }) | ||
readonly nationalId?: string | ||
|
||
@Allow() | ||
@IsOptional() | ||
@Field(() => Boolean, { nullable: true }) | ||
readonly hasSpokesperson?: boolean | ||
|
||
@Allow() | ||
@IsOptional() | ||
@Field(() => Boolean, { nullable: true }) | ||
readonly spokespersonIsLawyer?: boolean | ||
|
||
@Allow() | ||
@IsOptional() | ||
@Field(() => String, { nullable: true }) | ||
readonly spokespersonNationalId?: string | ||
|
||
@Allow() | ||
@IsOptional() | ||
@Field(() => String, { nullable: true }) | ||
readonly spokespersonName?: string | ||
|
||
@Allow() | ||
@IsOptional() | ||
@Field(() => String, { nullable: true }) | ||
readonly spokespersonEmail?: string | ||
|
||
@Allow() | ||
@IsOptional() | ||
@Field(() => String, { nullable: true }) | ||
readonly spokespersonPhoneNumber?: string | ||
|
||
@Allow() | ||
@IsOptional() | ||
@Field(() => Boolean, { nullable: true }) | ||
readonly caseFilesSharedWithSpokesperson?: boolean | ||
} |
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 |
---|---|---|
@@ -1,2 +1,4 @@ | ||
export { Defendant } from './models/defendant.model' | ||
export { DeleteDefendantResponse } from './models/delete.response' | ||
export { CivilClaimant } from './models/civilClaimant.model' | ||
export { DeleteCivilClaimantResponse } from './models/deleteCivilClaimant.response' |
Oops, something went wrong.