Skip to content

Commit

Permalink
feat: last update date (#884)
Browse files Browse the repository at this point in the history
Co-authored-by: Ryan Rondeau <[email protected]>
  • Loading branch information
afwilcox and nayr974 authored Jan 20, 2025
1 parent 90084e9 commit d8606c9
Show file tree
Hide file tree
Showing 37 changed files with 397 additions and 136 deletions.
16 changes: 16 additions & 0 deletions backend/src/middleware/maps/automapper-dto-to-entity-maps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ export const mapComplaintDtoToComplaint = (mapper: Mapper) => {
(dest) => dest.is_privacy_requested,
mapFrom((src) => src.isPrivacyRequested),
),
forMember(
(dest) => dest.comp_last_upd_utc_timestamp,
mapFrom((src) => src.updatedOn),
),
);
};

Expand Down Expand Up @@ -341,6 +345,10 @@ export const mapWildlifeComplaintDtoToHwcrComplaint = (mapper: Mapper) => {
(dest) => dest.complaint_identifier.is_privacy_requested,
mapFrom((src) => src.isPrivacyRequested),
),
forMember(
(dest) => dest.complaint_identifier.comp_last_upd_utc_timestamp,
mapFrom((src) => src.updatedOn),
),
);
};

Expand Down Expand Up @@ -502,6 +510,10 @@ export const mapAllegationComplaintDtoToAllegationComplaint = (mapper: Mapper) =
(dest) => dest.complaint_identifier.is_privacy_requested,
mapFrom((src) => src.isPrivacyRequested),
),
forMember(
(dest) => dest.complaint_identifier.comp_last_upd_utc_timestamp,
mapFrom((src) => src.updatedOn),
),
);
};

Expand Down Expand Up @@ -609,6 +621,10 @@ export const mapGirComplaintDtoToGirComplaint = (mapper: Mapper) => {
(dest) => dest.complaint_identifier.is_privacy_requested,
mapFrom((src) => src.isPrivacyRequested),
),
forMember(
(dest) => dest.complaint_identifier.comp_last_upd_utc_timestamp,
mapFrom((src) => src.updatedOn),
),
);
};

Expand Down
19 changes: 17 additions & 2 deletions backend/src/middleware/maps/automapper-entity-to-dto-maps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,10 @@ export const complaintToComplaintDtoMap = (mapper: Mapper) => {
(destination) => destination.isPrivacyRequested,
mapFrom((source) => source.is_privacy_requested),
),
forMember(
(destination) => destination.updatedOn,
mapFrom((source) => source.comp_last_upd_utc_timestamp),
),
);
};

Expand Down Expand Up @@ -722,6 +726,10 @@ export const applyWildlifeComplaintMap = (mapper: Mapper) => {
(destination) => destination.isPrivacyRequested,
mapFrom((source) => source.complaint_identifier.is_privacy_requested),
),
forMember(
(destination) => destination.updatedOn,
mapFrom((source) => source.complaint_identifier.comp_last_upd_utc_timestamp),
),
);
};

Expand Down Expand Up @@ -949,6 +957,10 @@ export const applyAllegationComplaintMap = (mapper: Mapper) => {
(destination) => destination.isPrivacyRequested,
mapFrom((source) => source.complaint_identifier.is_privacy_requested),
),
forMember(
(destination) => destination.updatedOn,
mapFrom((source) => source.complaint_identifier.comp_last_upd_utc_timestamp),
),
);
};
export const applyGeneralInfomationComplaintMap = (mapper: Mapper) => {
Expand Down Expand Up @@ -1152,6 +1164,10 @@ export const applyGeneralInfomationComplaintMap = (mapper: Mapper) => {
(destination) => destination.isPrivacyRequested,
mapFrom((source) => source.complaint_identifier.is_privacy_requested),
),
forMember(
(destination) => destination.updatedOn,
mapFrom((source) => source.complaint_identifier.comp_last_upd_utc_timestamp),
),
);
};

Expand Down Expand Up @@ -1519,7 +1535,7 @@ export const mapAllegationReport = (mapper: Mapper, tz: string = "America/Vancou
),
forMember(
(destination) => destination.updatedOn,
mapFrom((source) => source.complaint_identifier.update_utc_timestamp),
mapFrom((source) => source.complaint_identifier.comp_last_upd_utc_timestamp),
),
forMember(
(destination) => destination.officerAssigned,
Expand Down Expand Up @@ -1732,7 +1748,6 @@ export const mapAllegationReport = (mapper: Mapper, tz: string = "America/Vancou
}
}),
),

//--
forMember(
(destination) => destination.violationType,
Expand Down
6 changes: 6 additions & 0 deletions backend/src/middleware/maps/dto-to-table-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@ export const mapComplaintDtoToComplaintTable = (mapper: Mapper) => {
return src.isPrivacyRequested;
}),
),
forMember(
(dest) => dest.comp_last_upd_utc_timestamp,
mapFrom((src) => {
return src.updatedOn;
}),
),
);
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export interface DeleteEquipmentDto {
id: string;
updateUserId: string;
leadIdentifier: string;
}
7 changes: 7 additions & 0 deletions backend/src/types/models/complaints/update-complaint.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,11 @@ export class UpdateComplaintDto {
"flag to represent that the caller has asked for special care when handling their personal information",
})
is_privacy_requested: string;

@ApiProperty({
example: "true",
description:
"The time the complaint was last updated, or null if the complaint has never been touched. This value might also be updated by business logic that touches sub-tables to indicate that the business object complaint has been updated.",
})
comp_last_upd_utc_timestamp: Date;
}
8 changes: 8 additions & 0 deletions backend/src/v1/case_file/case_file.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,12 @@ export class CaseFileController {
@Token() token,
@Query("id") id: string,
@Query("updateUserId") userId: string,
@Query("leadIdentifier") leadIdentifier: string,
): Promise<boolean> {
const deleteEquipment = {
id: id,
updateUserId: userId,
leadIdentifier: leadIdentifier,
};
return await this.service.deleteEquipment(token, deleteEquipment);
}
Expand Down Expand Up @@ -128,12 +130,14 @@ export class CaseFileController {
async deleteNote(
@Token() token,
@Query("caseIdentifier") caseIdentifier: string,
@Query("leadIdentifier") leadIdentifier: string,
@Query("actor") actor: string,
@Query("updateUserId") updateUserId: string,
@Query("actionId") actionId: string,
): Promise<CaseFileDto> {
const input = {
caseIdentifier,
leadIdentifier,
actor,
updateUserId,
actionId,
Expand All @@ -159,12 +163,14 @@ export class CaseFileController {
async deleteWildlife(
@Token() token,
@Query("caseIdentifier") caseIdentifier: string,
@Query("leadIdentifier") leadIdentifier: string,
@Query("actor") actor: string,
@Query("updateUserId") updateUserId: string,
@Query("outcomeId") outcomeId: string,
): Promise<CaseFileDto> {
const input = {
caseIdentifier,
leadIdentifier,
actor,
updateUserId,
wildlifeId: outcomeId,
Expand Down Expand Up @@ -213,11 +219,13 @@ export class CaseFileController {
async deleteAuthorizationOutcome(
@Token() token,
@Query("caseIdentifier") caseIdentifier: string,
@Query("leadIdentifier") leadIdentifier: string,
@Query("updateUserId") updateUserId: string,
@Query("id") id: string,
): Promise<CaseFileDto> {
const input = {
caseIdentifier,
leadIdentifier,
updateUserId,
id,
};
Expand Down
Loading

0 comments on commit d8606c9

Please sign in to comment.