Skip to content

Commit

Permalink
refactor: Update UpdateActivityEventPresenter to handle activity stat…
Browse files Browse the repository at this point in the history
…us updates and trigger event deletion
  • Loading branch information
FelipeCarillo committed May 21, 2024
1 parent e9d7587 commit f349ad6
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ const repository = new Repository({ activity_repo: true });
export const handler = async (event: any, context: any) => {
const event_bridge = new EventBridgeManager();
console.log("Event: ", event);
const body: { activity_id: string; status: ActivityStatusEnum } = event.body;
console.log("Activity ID: ", body.activity_id + " Status: " + body.status);
const resp = await repository.ActivityRepo.update_activity_status(body.activity_id, body.status);
const body: { activity_id: string; status_activity: ActivityStatusEnum } = event.body;
console.log("Activity ID: ", body.activity_id + " Status: " + body.status_activity);
const resp = await repository.ActivityRepo.update_activity_status(body.activity_id, body.status_activity);
if (resp) {
console.log("Activity updated successfully");
let event_name = body.status === ActivityStatusEnum.ACTIVE ? "START_ACTIVITY_" : "END_ACTIVITY_";
let event_name = body.status_activity === ActivityStatusEnum.ACTIVE ? "START_ACTIVITY_" : "END_ACTIVITY_";
await event_bridge.delete_trigger(event_name + body.activity_id, "Update_Activity_Event");
} else {
console.log("Activity not found");
Expand Down

0 comments on commit f349ad6

Please sign in to comment.