handlers/view/doGetComments.ts
import type { RequestHandler } from "express";
import { getRecordComments } from "../../helpers/recordsDB/getRecordComments.js";
export const handler: RequestHandler = async (request, response) => {
const recordID = request.body.recordID;
const comments = await getRecordComments(recordID);
return comments
? response.json({
success: true,
comments
})
: response.json({
success: false,
message: "An unknown error occurred. Please try again."
});
};
export default handler;