cityssm/corporate-records-manager

View on GitHub
handlers/view/doGetComments.ts

Summary

Maintainability
A
3 hrs
Test Coverage
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;