mirror of
https://github.com/twentyhq/twenty.git
synced 2024-12-27 06:13:16 +03:00
[metadata] fix soft delete for standard objects missing deletedAt fieldMetadata (#7017)
This https://github.com/twentyhq/twenty/pull/7006 introduced a regression. The goal was to set "isSoftDeletable" to all standard objects but it was done at the wrong level, meaning it was setting the boolean correctly but not creating the corresponding fieldMetadata. I took the occasion to update the new graphql query runner to use that boolean and automatically add a filter on soft delete in case it's true. Also adding **IsQueryRunnerTwentyORMEnabled** by default in the seeds
This commit is contained in:
parent
e9f8e6e718
commit
7fd86a860c
@ -55,6 +55,11 @@ export const seedFeatureFlags = async (
|
||||
workspaceId: workspaceId,
|
||||
value: false,
|
||||
},
|
||||
{
|
||||
key: FeatureFlagKey.IsQueryRunnerTwentyORMEnabled,
|
||||
workspaceId: workspaceId,
|
||||
value: true,
|
||||
},
|
||||
])
|
||||
.execute();
|
||||
};
|
||||
|
@ -74,7 +74,7 @@ export class GraphqlQueryFindManyResolverService {
|
||||
);
|
||||
const where = graphqlQueryParser.parseFilter(
|
||||
args.filter ?? ({} as Filter),
|
||||
true,
|
||||
objectMetadataItem.isSoftDeletable ?? false,
|
||||
);
|
||||
|
||||
const cursor = this.getCursor(args);
|
||||
|
@ -56,7 +56,10 @@ export class GraphqlQueryFindOneResolverService {
|
||||
objectMetadataItem,
|
||||
graphqlFields(info),
|
||||
);
|
||||
const where = graphqlQueryParser.parseFilter(args.filter ?? ({} as Filter));
|
||||
const where = graphqlQueryParser.parseFilter(
|
||||
args.filter ?? ({} as Filter),
|
||||
objectMetadataItem.isSoftDeletable ?? false,
|
||||
);
|
||||
|
||||
const objectRecord = await repository.findOne({ where, select, relations });
|
||||
|
||||
|
@ -48,7 +48,7 @@ export function WorkspaceEntity(
|
||||
isAuditLogged,
|
||||
isSystem,
|
||||
gate,
|
||||
softDelete: options.softDelete,
|
||||
softDelete: options.softDelete ?? true,
|
||||
});
|
||||
};
|
||||
}
|
||||
|
@ -64,5 +64,5 @@ export interface WorkspaceEntityMetadataArgs {
|
||||
/**
|
||||
* Enable soft delete.
|
||||
*/
|
||||
readonly softDelete?: boolean;
|
||||
readonly softDelete: boolean;
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ export class StandardObjectFactory {
|
||||
isCustom: false,
|
||||
isRemote: false,
|
||||
isSystem: workspaceEntityMetadataArgs.isSystem ?? false,
|
||||
isSoftDeletable: workspaceEntityMetadataArgs.softDelete ?? true,
|
||||
isSoftDeletable: workspaceEntityMetadataArgs.softDelete,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user