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, query, allowedTable, url, }: APIPathsCrudParams): Promise { if ( (allowedTable?.allowedFields || allowedTable?.disallowedFields) && !query?.searchQuery?.selectFields?.[0] ) { throw new Error( `Please specify fields to select! Use the \`selectFields\` option in the query object` ); } const GET_RESULT = await dsqlCrud({ ...query?.crudParams, action: "get", table, query: query?.searchQuery, }); return GET_RESULT; }