From 709c994bf828045e9a0be3cb4571dd6be1bff9e5 Mon Sep 17 00:00:00 2001 From: pedroalonsoms Date: Wed, 12 Jun 2024 18:51:17 -0600 Subject: [PATCH] implements rulersurvey sqs for lalo --- handlers/subscriber.ts | 9 ++++++--- services/project.ts | 3 ++- services/rulerSurvey.ts | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/handlers/subscriber.ts b/handlers/subscriber.ts index 09b8eb0..61294bf 100644 --- a/handlers/subscriber.ts +++ b/handlers/subscriber.ts @@ -1,6 +1,10 @@ import db from "@/db/drizzle"; import { finalSurvey, sprintSurvey } from "@/db/schema"; -import { feedbackAnalysis, projectAnalysis } from "@/services/rag"; +import { + feedbackAnalysis, + projectAnalysis, + rulerAnalysis, +} from "@/services/rag"; import { DeleteMessageCommand, SQSClient } from "@aws-sdk/client-sqs"; import { eq } from "drizzle-orm"; import { Resource } from "sst"; @@ -14,8 +18,7 @@ export const handler: SQSHandler = async (event) => { switch (messageBody.type) { case "RULER": try { - console.log("ruler msg bdy", messageBody); - //TODO: lalo implements this + await rulerAnalysis(messageBody.id); } catch (error) { console.log("ERROR:", error); } diff --git a/services/project.ts b/services/project.ts index 4695b10..ad056fa 100644 --- a/services/project.ts +++ b/services/project.ts @@ -242,7 +242,8 @@ export async function getUpdateFeedbackHistory({ } export interface SQSMessageBody { - id: number; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + id: any; type: "RULER" | "SPRINT" | "FINAL"; } diff --git a/services/rulerSurvey.ts b/services/rulerSurvey.ts index 8669812..24e3195 100644 --- a/services/rulerSurvey.ts +++ b/services/rulerSurvey.ts @@ -38,7 +38,7 @@ export async function submitRulerSurveyAnswer(surveyAnswer: RulerSurveyAnswer) { MessageGroupId: messageGroupId, MessageDeduplicationId: crypto.randomUUID(), MessageBody: JSON.stringify({ - id: 1, + id: surveyAnswer.userId, type: "RULER", } as SQSMessageBody), }),