This commit is contained in:
2026-01-04 12:41:19 +01:00
parent def2f2f057
commit 18e29fa413
8 changed files with 39 additions and 9 deletions
@@ -18,6 +18,7 @@ type Param<T extends { [k: string]: any } = any, K extends string = string> = {
identifierValue?: string | number;
forceLocal?: boolean;
whereClauseObject?: DsqlCrudParamWhereClause;
targetIds?: (string | number)[];
};
/**
@@ -35,6 +36,7 @@ export default async function deleteDbEntry<
identifierValue,
forceLocal,
whereClauseObject,
targetIds,
}: Param<T, K>): Promise<APIResponseObject<PostInsertReturn>> {
try {
const isMaster = forceLocal
@@ -52,7 +54,10 @@ export default async function deleteDbEntry<
let values: any[] = [];
if (whereClauseObject) {
if (targetIds) {
query += ` WHERE id IN (${targetIds.map((id) => "?").join(",")})`;
values = targetIds;
} else if (whereClauseObject) {
query += ` ${whereClauseObject.clause}`;
values.push(...(whereClauseObject.params || []));
} else if (identifierColumnName && identifierValue) {