Files
twenty/packages/twenty-server/test/integration/utils/delete-records-by-ids.ts
T
Félix MalfaitandGitHub 30a2164980 First Application POC (#14382)
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
2025-09-10 15:12:38 +02:00

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 */
}
};