Skip to content

Commit

Permalink
remove everything but caseid from create civil claimant
Browse files Browse the repository at this point in the history
  • Loading branch information
unakb committed Sep 18, 2024
1 parent 42e551a commit 5487ba2
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 115 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Allow, IsOptional } from 'class-validator'
import { Allow } from 'class-validator'

import { Field, ID, InputType } from '@nestjs/graphql'

Expand All @@ -7,54 +7,4 @@ export class CreateCivilClaimantInput {
@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
}
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ export const order: OrderItem[] = [
[{ model: IndictmentCount, as: 'indictmentCounts' }, 'created', 'ASC'],
[{ model: DateLog, as: 'dateLogs' }, 'created', 'DESC'],
[{ model: Notification, as: 'notifications' }, 'created', 'DESC'],
[{ model: CivilClaimant, as: 'civilClaimants' }, 'created', 'ASC'],
]

export const caseListInclude: Includeable[] = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {

import { prosecutorRepresentativeRule, prosecutorRule } from '../../guards'
import { Case, CaseExistsGuard, CaseWriteGuard, CurrentCase } from '../case'
import { CreateCivilClaimantDto } from './dto/createCivilClaimant.dto'
import { UpdateCivilClaimantDto } from './dto/updateCivilClaimant.dto'
import { CivilClaimant } from './models/civilClaimant.model'
import { DeleteCivilClaimantResponse } from './models/deleteCivilClaimant.response'
Expand All @@ -46,11 +45,10 @@ export class CivilClaimantController {
async create(
@Param('caseId') caseId: string,
@CurrentCase() theCase: Case,
@Body() createCivilClaimantDto: CreateCivilClaimantDto,
): Promise<CivilClaimant> {
this.logger.debug(`Creating a new civil claimant for case ${caseId}`)

return this.civilClaimantService.create(theCase, createCivilClaimantDto)
return this.civilClaimantService.create(theCase)
}

@UseGuards(CaseExistsGuard, CaseWriteGuard)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import type { Logger } from '@island.is/logging'
import { LOGGER_PROVIDER } from '@island.is/logging'

import { Case } from '../case'
import { CreateCivilClaimantDto } from './dto/createCivilClaimant.dto'
import { UpdateCivilClaimantDto } from './dto/updateCivilClaimant.dto'
import { CivilClaimant } from './models/civilClaimant.model'

Expand All @@ -17,12 +16,8 @@ export class CivilClaimantService {
@Inject(LOGGER_PROVIDER) private readonly logger: Logger,
) {}

async create(
theCase: Case,
claimantToCreate: CreateCivilClaimantDto,
): Promise<CivilClaimant> {
async create(theCase: Case): Promise<CivilClaimant> {
return this.civilClaimantModel.create({
...claimantToCreate,
caseId: theCase.id,
})
}
Expand Down

This file was deleted.

0 comments on commit 5487ba2

Please sign in to comment.