Remove objectMetadata isSoftDeletable
This commit is contained in:
@ -21,9 +21,7 @@ import { NoteTargetWorkspaceEntity } from 'src/modules/note/standard-objects/not
|
||||
import { TaskTargetWorkspaceEntity } from 'src/modules/task/standard-objects/task-target.workspace-entity';
|
||||
import { TimelineActivityWorkspaceEntity } from 'src/modules/timeline/standard-objects/timeline-activity.workspace-entity';
|
||||
|
||||
@WorkspaceCustomEntity({
|
||||
softDelete: true,
|
||||
})
|
||||
@WorkspaceCustomEntity()
|
||||
export class CustomWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
@WorkspaceField({
|
||||
standardId: CUSTOM_OBJECT_STANDARD_FIELD_IDS.name,
|
||||
|
||||
@ -1,13 +1,7 @@
|
||||
import { metadataArgsStorage } from 'src/engine/twenty-orm/storage/metadata-args.storage';
|
||||
import { TypedReflect } from 'src/utils/typed-reflect';
|
||||
|
||||
interface WorkspaceCustomEntityOptions {
|
||||
softDelete?: boolean;
|
||||
}
|
||||
|
||||
export function WorkspaceCustomEntity(
|
||||
options: WorkspaceCustomEntityOptions = {},
|
||||
): ClassDecorator {
|
||||
export function WorkspaceCustomEntity(options = {}): ClassDecorator {
|
||||
return (target) => {
|
||||
const gate = TypedReflect.getMetadata(
|
||||
'workspace:gate-metadata-args',
|
||||
@ -17,7 +11,6 @@ export function WorkspaceCustomEntity(
|
||||
metadataArgsStorage.addExtendedEntities({
|
||||
target,
|
||||
gate,
|
||||
softDelete: options.softDelete,
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
@ -12,7 +12,6 @@ interface WorkspaceEntityOptions {
|
||||
icon?: string;
|
||||
labelIdentifierStandardId?: string;
|
||||
imageIdentifierStandardId?: string;
|
||||
softDelete?: boolean;
|
||||
}
|
||||
|
||||
export function WorkspaceEntity(
|
||||
@ -48,7 +47,6 @@ export function WorkspaceEntity(
|
||||
isAuditLogged,
|
||||
isSystem,
|
||||
gate,
|
||||
softDelete: options.softDelete ?? true,
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
@ -20,10 +20,7 @@ type EntitySchemaColumnMap = {
|
||||
|
||||
@Injectable()
|
||||
export class EntitySchemaColumnFactory {
|
||||
create(
|
||||
fieldMetadataMap: FieldMetadataMap,
|
||||
softDelete: boolean,
|
||||
): EntitySchemaColumnMap {
|
||||
create(fieldMetadataMap: FieldMetadataMap): EntitySchemaColumnMap {
|
||||
let entitySchemaColumnMap: EntitySchemaColumnMap = {};
|
||||
|
||||
const fieldMetadataCollection = Object.values(fieldMetadataMap);
|
||||
@ -31,11 +28,6 @@ export class EntitySchemaColumnFactory {
|
||||
for (const fieldMetadata of fieldMetadataCollection) {
|
||||
const key = fieldMetadata.name;
|
||||
|
||||
// Skip deletedAt column if soft delete is not enabled
|
||||
if (!softDelete && key === 'deletedAt') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isRelationFieldMetadataType(fieldMetadata.type)) {
|
||||
const relationMetadata =
|
||||
fieldMetadata.fromRelationMetadata ??
|
||||
|
||||
@ -26,7 +26,6 @@ export class EntitySchemaFactory {
|
||||
): Promise<EntitySchema> {
|
||||
const columns = this.entitySchemaColumnFactory.create(
|
||||
objectMetadata.fields,
|
||||
objectMetadata.isSoftDeletable ?? false,
|
||||
);
|
||||
|
||||
const relations = await this.entitySchemaRelationFactory.create(
|
||||
|
||||
@ -60,9 +60,4 @@ export interface WorkspaceEntityMetadataArgs {
|
||||
* Image identifier.
|
||||
*/
|
||||
readonly imageIdentifierStandardId: string | null;
|
||||
|
||||
/**
|
||||
* Enable soft delete.
|
||||
*/
|
||||
readonly softDelete: boolean;
|
||||
}
|
||||
|
||||
@ -13,9 +13,4 @@ export interface WorkspaceExtendedEntityMetadataArgs {
|
||||
* Entity gate.
|
||||
*/
|
||||
readonly gate?: Gate;
|
||||
|
||||
/**
|
||||
* Enable soft delete.
|
||||
*/
|
||||
readonly softDelete?: boolean;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user