Pull Request branch dev-clone to main #1
|
|
@ -383,9 +383,7 @@ const assessmentsRoute = new Hono<HonoEnv>()
|
|||
async (c) => {
|
||||
const answerId = c.req.param("id");
|
||||
const answerData = c.req.valid("json");
|
||||
|
||||
let response;
|
||||
let statusCode;
|
||||
|
||||
const updatedAnswer = await db
|
||||
.update(answers)
|
||||
.set({
|
||||
|
|
@ -395,24 +393,15 @@ const assessmentsRoute = new Hono<HonoEnv>()
|
|||
.returning();
|
||||
|
||||
if (!updatedAnswer.length) {
|
||||
response = {
|
||||
message: "Answer not found or update failed",
|
||||
};
|
||||
statusCode = 404;
|
||||
} else {
|
||||
response = {
|
||||
message: "Answer updated successfully",
|
||||
answer: updatedAnswer[0],
|
||||
};
|
||||
statusCode = 200;
|
||||
throw notFound({
|
||||
message: "Answer not found or update failed"
|
||||
})
|
||||
}
|
||||
|
||||
return c.json(
|
||||
response,
|
||||
{
|
||||
status: statusCode
|
||||
}
|
||||
);
|
||||
|
||||
return c.json({
|
||||
message: "Answer updated successfully",
|
||||
answer: updatedAnswer[0],
|
||||
});
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user