import { APIPathsCrudParams, APIResponseObject } from "../../types"; import dsqlCrud from "../../utils/data-fetching/crud"; export default async function < T extends { [k: string]: any } = { [k: string]: any } >({ table, body, targetId, }: APIPathsCrudParams): Promise { if (!targetId && !body?.searchQuery) { throw new Error( `Target ID or \`searchQuery\` field is required to delete Data.` ); } const DELETE_RESLT = await dsqlCrud({ ...body?.crudParams, action: "delete", table, query: body?.searchQuery, targetId, }); return DELETE_RESLT; }