From f349ad6ee3c41fc0170e5950a4d2ed647970b6e9 Mon Sep 17 00:00:00 2001 From: FelipeCarillo Date: Tue, 21 May 2024 10:22:14 -0300 Subject: [PATCH] refactor: Update UpdateActivityEventPresenter to handle activity status updates and trigger event deletion --- .../app/update_activity_event_presenter.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/modules/update_activity_event/app/update_activity_event_presenter.ts b/src/modules/update_activity_event/app/update_activity_event_presenter.ts index 1f69877..a8b5f5c 100644 --- a/src/modules/update_activity_event/app/update_activity_event_presenter.ts +++ b/src/modules/update_activity_event/app/update_activity_event_presenter.ts @@ -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");