Skip to content

Commit

Permalink
feat: HWCR last update changes part 1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
afwilcox committed Jan 16, 2025
1 parent c4dd056 commit 196b4b5
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const AuthoizationOutcomeForm: FC<props> = ({ id, type, value, leadIdenti
value: !unauthorized ? authorized : unauthorized,
};

dispatch(upsertAuthorizationOutcome(identifier, data)).then(async (response) => {
dispatch(upsertAuthorizationOutcome(identifier, leadIdentifier, data)).then(async (response) => {
if (response === "success") {
dispatch(getCaseFile(leadIdentifier));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const AuthoizationOutcome: FC = () => {
description: "Your changes will be lost.",
confirmText: "delete authorization",
deleteConfirmed: () => {
dispatch(deleteAuthorizationOutcome()).then(async (response) => {
dispatch(deleteAuthorizationOutcome(id)).then(async (response) => {
if (response === "success") {
dispatch(getCaseFile(id));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export const DecisionForm: FC<props> = ({
resetErrorMessages();

if (isValid()) {
dispatch(upsertDecisionOutcome(identifier, data)).then(async (response) => {
dispatch(upsertDecisionOutcome(identifier, leadIdentifier, data)).then(async (response) => {
if (response === "success") {
dispatch(getCaseFile(leadIdentifier));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export const HWCROutcomeByAnimalv2: FC<props> = () => {
//-- when saving make sure that the outcome is successfully
//-- saved before adding the outcome to the list of outcomes
const handleUpdate = (item: AnimalOutcomeData) => {
dispatch(updateAnimalOutcome(caseId, item)).then((result) => {
dispatch(updateAnimalOutcome(caseId, id, item)).then((result) => {
if (result === "success") {
dispatch(getCaseFile(id));
setShowForm(false);
Expand Down
23 changes: 20 additions & 3 deletions frontend/src/app/store/reducers/case-thunks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,7 @@ export const upsertNote =

const input: UpdateSupplementalNotesInput = {
note,
leadIdentifier: id,
caseIdentifier: caseId as UUID,
actor,
updateUserId: userId,
Expand Down Expand Up @@ -674,6 +675,7 @@ export const deleteNote =
async (dispatch) => {
const input: DeleteSupplementalNoteInput = {
caseIdentifier: caseId as UUID,
leadIdentifier: id,
actor,
updateUserId: userId,
actionId,
Expand Down Expand Up @@ -966,6 +968,7 @@ export const createAnimalOutcome =
export const updateAnimalOutcome =
(
id: UUID,
leadIdentifier: string,
animalOutcome: AnimalOutcome,
): ThunkAction<Promise<string | undefined>, RootState, unknown, Action<string>> =>
async (dispatch, getState) => {
Expand Down Expand Up @@ -1020,6 +1023,7 @@ export const updateAnimalOutcome =

const input: UpdateAnimalOutcomeInput = {
caseIdentifier: id,
leadIdentifier: leadIdentifier,
updateUserId: idir,
wildlife: {
id: wildlifeId,
Expand Down Expand Up @@ -1070,6 +1074,7 @@ export const deleteAnimalOutcome =
async (dispatch) => {
const input: DeleteAnimalOutcomeInput = {
caseIdentifier: caseId as UUID,
leadIdentifier: id,
actor,
updateUserId: userId,
outcomeId,
Expand All @@ -1095,7 +1100,11 @@ export const deleteAnimalOutcome =
};

export const upsertDecisionOutcome =
(id: string, decision: Decision): ThunkAction<Promise<string | undefined>, RootState, unknown, Action<string>> =>
(
id: string,
leadIdentifier: string,
decision: Decision,
): ThunkAction<Promise<string | undefined>, RootState, unknown, Action<string>> =>
async (dispatch, getState) => {
const {
app: {
Expand Down Expand Up @@ -1129,6 +1138,7 @@ export const upsertDecisionOutcome =

const input: UpdateDecisionInput = {
caseIdentifier: id,
leadIdentifier: leadIdentifier,
agencyCode: "EPO",
caseCode: "ERS",
actor: assignedTo,
Expand Down Expand Up @@ -1168,7 +1178,11 @@ export const upsertDecisionOutcome =
};

export const upsertAuthorizationOutcome =
(id: string, input: PermitSite): ThunkAction<Promise<string | undefined>, RootState, unknown, Action<string>> =>
(
id: string,
leadIdentifier: string,
input: PermitSite,
): ThunkAction<Promise<string | undefined>, RootState, unknown, Action<string>> =>
async (dispatch, getState) => {
const {
app: {
Expand Down Expand Up @@ -1197,6 +1211,7 @@ export const upsertAuthorizationOutcome =
async (dispatch) => {
const input: UpdateAuthorizationOutcomeInput = {
caseIdentifier: id,
leadIdentifier: leadIdentifier,
updateUserId: idir,
input: site,
};
Expand Down Expand Up @@ -1227,7 +1242,8 @@ export const upsertAuthorizationOutcome =
};

export const deleteAuthorizationOutcome =
(): ThunkAction<Promise<string | undefined>, RootState, unknown, Action<string>> => async (dispatch, getState) => {
(leadIdentifier: string): ThunkAction<Promise<string | undefined>, RootState, unknown, Action<string>> =>
async (dispatch, getState) => {
const {
app: {
profile: { idir_username: idir },
Expand All @@ -1239,6 +1255,7 @@ export const deleteAuthorizationOutcome =
const { id } = authorization;
const input: DeleteAuthorizationOutcomeInput = {
caseIdentifier: caseId,
leadIdentifier: leadIdentifier,
updateUserId: idir,
id,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export interface BaseCaseFileCreateInput {

export interface BaseCaseFileUpdateInput {
caseIdentifier: UUID | string;
leadIdentifier: string;
actor?: string;
updateUserId: string;
actionId?: string;
Expand Down

0 comments on commit 196b4b5

Please sign in to comment.