Pull Request branch dev-clone to main #1

Merged
gitea merged 429 commits from dev-clone into main 2024-12-23 09:31:34 +00:00
Showing only changes of commit c0e28b1019 - Show all commits

View File

@ -384,8 +384,6 @@ const assessmentsRoute = new Hono<HonoEnv>()
const answerId = c.req.param("id"); const answerId = c.req.param("id");
const answerData = c.req.valid("json"); const answerData = c.req.valid("json");
let response;
let statusCode;
const updatedAnswer = await db const updatedAnswer = await db
.update(answers) .update(answers)
.set({ .set({
@ -395,24 +393,15 @@ const assessmentsRoute = new Hono<HonoEnv>()
.returning(); .returning();
if (!updatedAnswer.length) { if (!updatedAnswer.length) {
response = { throw notFound({
message: "Answer not found or update failed", message: "Answer not found or update failed"
}; })
statusCode = 404;
} else {
response = {
message: "Answer updated successfully",
answer: updatedAnswer[0],
};
statusCode = 200;
} }
return c.json( return c.json({
response, message: "Answer updated successfully",
{ answer: updatedAnswer[0],
status: statusCode });
}
);
} }
) )