feat: soft delete (#6576)

Implement soft delete on standards and custom objects.
This is a temporary solution, when we drop `pg_graphql` we should rely
on the `softDelete` functions of TypeORM.

---------

Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
This commit is contained in:
Jérémy M
2024-08-16 21:20:02 +02:00
committed by GitHub
parent 20d84755bb
commit db54469c8a
118 changed files with 1675 additions and 492 deletions

View File

@ -53,6 +53,7 @@ export const BASE_OBJECT_STANDARD_FIELD_IDS = {
id: '20202020-eda0-4cee-9577-3eb357e3c22b',
createdAt: '20202020-66ac-4502-9975-e4d959c50311',
updatedAt: '20202020-d767-4622-bdcf-d8a084834d86',
deletedAt: '20202020-b9a7-48d8-8387-b9a3090a50ec',
};
export const BLOCKLIST_STANDARD_FIELD_IDS = {

View File

@ -150,6 +150,14 @@ export class StandardFieldFactory {
return [];
}
if (
workspaceFieldMetadataArgs.name === 'deletedAt' &&
workspaceEntityMetadataArgs &&
!workspaceEntityMetadataArgs.softDelete
) {
return [];
}
return [
{
type: workspaceFieldMetadataArgs.type,

View File

@ -54,6 +54,7 @@ export class StandardObjectFactory {
isCustom: false,
isRemote: false,
isSystem: workspaceEntityMetadataArgs.isSystem ?? false,
isSoftDeletable: workspaceEntityMetadataArgs.softDelete ?? false,
};
}
}