Skip to content

Commit

Permalink
feat: CE-1003 Add notes to CEEB complaint outcome (#621)
Browse files Browse the repository at this point in the history
Co-authored-by: afwilcox <[email protected]>
  • Loading branch information
Scarlett-Truong and afwilcox authored Sep 9, 2024
1 parent beb8193 commit 927ccb6
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 17 deletions.
6 changes: 3 additions & 3 deletions backend/src/v1/case_file/case_file.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,19 @@ export class CaseFileController {
}

@Post("/note")
@Roles(Role.COS_OFFICER)
@Roles(Role.COS_OFFICER, Role.CEEB)
async createNote(@Token() token, @Body() model: CreateSupplementalNotesInput): Promise<CaseFileDto> {
return await this.service.createNote(token, model);
}

@Patch("/note")
@Roles(Role.COS_OFFICER)
@Roles(Role.COS_OFFICER, Role.CEEB)
async UpdateNote(@Token() token, @Body() model: UpdateSupplementalNotesInput): Promise<CaseFileDto> {
return await this.service.updateNote(token, model);
}

@Delete("/note")
@Roles(Role.COS_OFFICER)
@Roles(Role.COS_OFFICER, Role.CEEB)
async deleteNote(
@Token() token,
@Query("caseIdentifier") caseIdentifier: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { useAppDispatch } from "../../../../../hooks/hooks";
import { getCaseFile } from "../../../../../store/reducers/case-thunks";
import { ComplaintParams } from "../../details/complaint-details-edit";
import { OutcomeAttachments } from "../outcome-attachments";

import { SupplementalNote } from "../supplemental-note";

export const CeebOutcomeReport: FC = () => {
const { id = "" } = useParams<ComplaintParams>();
const dispatch = useAppDispatch();
Expand All @@ -23,6 +24,7 @@ export const CeebOutcomeReport: FC = () => {
</div>
{/* <CeebAuthorization /> */}
<CeebDecision />
<SupplementalNote />
<OutcomeAttachments showAddButton={true} />
</section>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { FC, useEffect } from "react";
import { HWCRComplaintAssessment } from "./hwcr-complaint-assessment";
import { HWCREquipment } from "./hwcr-equipment";
import { HWCRFileReview } from "./hwcr-file-review";
import { HWCRSupplementalNotes } from "./hwcr-supplemental-notes";
import { SupplementalNote } from "./supplemental-note";
import { OutcomeAttachments } from "./outcome-attachments";
import { HWCRComplaintPrevention } from "./hwcr-prevention-education";
import { useParams } from "react-router-dom";
Expand Down Expand Up @@ -30,7 +30,7 @@ export const HWCROutcomeReport: FC = () => {
<HWCRComplaintPrevention />
<HWCREquipment />
<HWCROutcomeByAnimalv2 />
<HWCRSupplementalNotes />
<SupplementalNote />
<OutcomeAttachments />
<HWCRFileReview />
</section>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,10 @@ import { selectSupplementalNote } from "../../../../store/reducers/case-selector
import { openModal } from "../../../../store/reducers/app";
import { DELETE_NOTE } from "../../../../types/modal/modal-types";
import { setIsInEdit } from "../../../../store/reducers/cases";
import { ComplaintParams } from "../details/complaint-details-edit";

type ComplaintParams = {
id: string;
};

export const HWCRSupplementalNotes: FC = () => {
const { id = "" } = useParams<ComplaintParams>();
export const SupplementalNote: FC = () => {
const { id = "", complaintType = "" } = useParams<ComplaintParams>();
const dispatch = useAppDispatch();

const officer = useAppSelector(selectCurrentOfficer());
Expand Down Expand Up @@ -77,6 +74,7 @@ export const HWCRSupplementalNotes: FC = () => {
return (
<SupplementalNotesInput
id={id}
complaintType={complaintType}
notes={note}
currentOfficer={officer}
setShowInput={setShowInput}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ import { ToggleError } from "../../../../../common/toast";

type props = {
id: string;
complaintType: string;
notes: string;
currentOfficer: OfficerDto | null;
mode: "create" | "update";
setShowInput: Function;
};

export const SupplementalNotesInput: FC<props> = ({ id, notes, currentOfficer, mode, setShowInput }) => {
export const SupplementalNotesInput: FC<props> = ({ id, complaintType, notes, currentOfficer, mode, setShowInput }) => {
const currentDate = new Date();

const dispatch = useAppDispatch();
Expand Down Expand Up @@ -68,7 +69,7 @@ export const SupplementalNotesInput: FC<props> = ({ id, notes, currentOfficer, m

const handleSaveNotes = () => {
if (validateInput()) {
dispatch(upsertNote(id, currentNotes)).then((result) => {
dispatch(upsertNote(id, complaintType, currentNotes)).then((result) => {
if (result === "success") {
dispatch(getCaseFile(id));
setShowInput(false);
Expand Down
11 changes: 8 additions & 3 deletions frontend/src/app/store/reducers/case-thunks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import { UpdateAnimalOutcomeInput } from "../../types/app/case-files/animal-outc
import { Decision } from "../../types/app/case-files/ceeb/decision/decision";
import { CreateDecisionInput } from "../../types/app/case-files/ceeb/decision/create-decision-input";
import { UpdateDecisionInput } from "../../types/app/case-files/ceeb/decision/update-decsion-input";
import { getUserAgency } from "../../service/user-service";

//-- general thunks
export const findCase =
Expand Down Expand Up @@ -468,7 +469,11 @@ const parsePreventionResponse = async (

//-- supplemental note thunks
export const upsertNote =
(id: string, note: string): ThunkAction<Promise<string | undefined>, RootState, unknown, Action<string>> =>
(
id: string,
complaintType: string,
note: string,
): ThunkAction<Promise<string | undefined>, RootState, unknown, Action<string>> =>
async (dispatch, getState) => {
const {
officers: { officers },
Expand All @@ -489,8 +494,8 @@ export const upsertNote =
const input: CreateSupplementalNotesInput = {
note,
leadIdentifier: id,
agencyCode: "COS",
caseCode: "HWCR",
agencyCode: getUserAgency(),
caseCode: complaintType,
actor,
createUserId: userId,
};
Expand Down

0 comments on commit 927ccb6

Please sign in to comment.