Quick proof of concept for twenty-apps + twenty-cli, with local development / hot reload Let's discuss it! https://github.com/user-attachments/assets/c6789936-cd5f-4110-a265-863a6ac1af2d
25 lines
580 B
TypeScript
25 lines
580 B
TypeScript
const TEST_SCHEMA_NAME = 'workspace_1wgvd1injqtife6y4rvfbu3h5';
|
|
|
|
export const deleteRecordsByIds = async (
|
|
objectNameSingular: string,
|
|
recordIds: string[],
|
|
) => {
|
|
if (!recordIds.length) {
|
|
return;
|
|
}
|
|
|
|
try {
|
|
// Create placeholders for parameterized query: $1, $2, $3, etc.
|
|
const placeholders = recordIds
|
|
.map((_, index) => `$${index + 1}`)
|
|
.join(', ');
|
|
|
|
await global.testDataSource.query(
|
|
`DELETE from "${TEST_SCHEMA_NAME}"."${objectNameSingular}" WHERE id IN (${placeholders})`,
|
|
recordIds,
|
|
);
|
|
} catch {
|
|
/* empty */
|
|
}
|
|
};
|