sunrise-cms/handlers/burialSites-post/doDeleteBurialSiteComment.ts

29 lines
681 B
TypeScript

import type { Request, Response } from 'express'
import { deleteRecord } from '../../database/deleteRecord.js'
import getBurialSiteComments from '../../database/getBurialSiteComments.js'
export default async function handler(
request: Request<
unknown,
unknown,
{ burialSiteId: string; burialSiteCommentId: string }
>,
response: Response
): Promise<void> {
const success = await deleteRecord(
'BurialSiteComments',
request.body.burialSiteCommentId,
request.session.user as User
)
const burialSiteComments = await getBurialSiteComments(
request.body.burialSiteId as string
)
response.json({
success,
burialSiteComments
})
}