diff --git a/backend/src/case_file/case_file.graphql b/backend/src/case_file/case_file.graphql index 1fbe6d18..55357ce9 100644 --- a/backend/src/case_file/case_file.graphql +++ b/backend/src/case_file/case_file.graphql @@ -117,6 +117,13 @@ input CreateSupplementalNoteInput { createUserId: String! } +input UpdateSupplementalNoteInput { + caseIdentifier: String! + note: String! + actor: String! + updateUserId: String! +} + type Query { getCaseFile( caseIdentifier: String!): CaseFile getCaseFileByLeadId( leadIdentifier: String!): CaseFile @@ -130,4 +137,5 @@ type Mutation { updatePrevention(updatePreventionInput: UpdatePreventionInput!): CaseFile! createNote(input: CreateSupplementalNoteInput!): CaseFile! + updateNote(input: UpdateSupplementalNoteInput!): CaseFile! } diff --git a/backend/src/case_file/case_file.resolver.ts b/backend/src/case_file/case_file.resolver.ts index a47eb9e8..bef86b04 100644 --- a/backend/src/case_file/case_file.resolver.ts +++ b/backend/src/case_file/case_file.resolver.ts @@ -7,6 +7,7 @@ import { UseGuards } from "@nestjs/common"; import { Role } from "../enum/role.enum"; import { Roles } from "../auth/decorators/roles.decorator"; import { CreateSupplementalNoteInput } from './dto/supplemental-note/create-supplemental-note.input'; +import { UpdateSupplementalNoteInput } from './dto/supplemental-note/update-supplemental-note.input'; @UseGuards(JwtRoleGuard) @Resolver('CaseFile') @@ -54,4 +55,10 @@ export class CaseFileResolver { createNote(@Args("input") input: CreateSupplementalNoteInput) { return this.caseFileService.createNote(input); } + + @Mutation("updateNote") + @Roles(Role.COS_OFFICER) + updateNote(@Args("input") input: UpdateSupplementalNoteInput) { + return this.caseFileService.updateNote(input); + } } diff --git a/backend/src/case_file/case_file.service.ts b/backend/src/case_file/case_file.service.ts index d0fd0fc3..5e053e55 100644 --- a/backend/src/case_file/case_file.service.ts +++ b/backend/src/case_file/case_file.service.ts @@ -7,6 +7,7 @@ import { GraphQLError } from "graphql"; import { CreateSupplementalNoteInput } from "./dto/supplemental-note/create-supplemental-note.input"; import { Note } from "./entities/supplemental-note/supplemental-note.entity"; import { ACTION_CODES } from "../common/action_codes"; +import { UpdateSupplementalNoteInput } from "./dto/supplemental-note/update-supplemental-note.input"; @Injectable() export class CaseFileService { @@ -633,6 +634,12 @@ export class CaseFileService { return await this._upsertNote(caseFileId, note, actor, createUserId); }; + updateNote = async (input: UpdateSupplementalNoteInput): Promise => { + const { caseIdentifier: caseFileId, actor, note, updateUserId } = input; + + return await this._upsertNote(caseFileId, note, actor, updateUserId); + } + private _upsertNote = async (caseId: string, note: string, actor: string, userId: string): Promise => { const _hasAction = async (caseId: string): Promise => { const NOTES_QUERY = `SELECT a.action_type_action_xref_guid AS actionId FROM case_management.action_type_action_xref atax diff --git a/backend/src/case_file/dto/supplemental-note/create-supplemental-note.input.ts b/backend/src/case_file/dto/supplemental-note/create-supplemental-note.input.ts index 29d5abeb..317c2cd1 100644 --- a/backend/src/case_file/dto/supplemental-note/create-supplemental-note.input.ts +++ b/backend/src/case_file/dto/supplemental-note/create-supplemental-note.input.ts @@ -5,4 +5,4 @@ export class CreateSupplementalNoteInput { createUserId: string; actor: string; note: string; -} +} \ No newline at end of file diff --git a/backend/src/case_file/dto/supplemental-note/update-supplemental-note.input.ts b/backend/src/case_file/dto/supplemental-note/update-supplemental-note.input.ts new file mode 100644 index 00000000..31e25e29 --- /dev/null +++ b/backend/src/case_file/dto/supplemental-note/update-supplemental-note.input.ts @@ -0,0 +1,6 @@ +export class UpdateSupplementalNoteInput { + caseIdentifier: string; + updateUserId: string; + actor: string; + note: string; +}