Add identifier fields to ObjectMetadata (#2616)
* Add indentifier fields to ObjectMetadata * Add indentifier fields to ObjectMetadata * Add indentifier fields to ObjectMetadata * temporarily block name/label edition
This commit is contained in:
@ -36,6 +36,7 @@ export class RelationMetadataService extends TypeOrmQueryService<RelationMetadat
|
||||
}
|
||||
|
||||
override async deleteOne(id: string): Promise<RelationMetadataEntity> {
|
||||
// TODO: This logic is duplicated with the BeforeDeleteOneRelation hook
|
||||
const relationMetadata = await this.relationMetadataRepository.findOne({
|
||||
where: { id },
|
||||
relations: ['fromFieldMetadata', 'toFieldMetadata'],
|
||||
@ -45,22 +46,9 @@ export class RelationMetadataService extends TypeOrmQueryService<RelationMetadat
|
||||
throw new NotFoundException('Relation does not exist');
|
||||
}
|
||||
|
||||
if (
|
||||
!relationMetadata.toFieldMetadata.isCustom ||
|
||||
!relationMetadata.fromFieldMetadata.isCustom
|
||||
) {
|
||||
throw new BadRequestException("Standard Relations can't be deleted");
|
||||
}
|
||||
|
||||
if (
|
||||
relationMetadata.toFieldMetadata.isActive ||
|
||||
relationMetadata.fromFieldMetadata.isActive
|
||||
) {
|
||||
throw new BadRequestException("Active relations can't be deleted");
|
||||
}
|
||||
|
||||
const deletedRelationMetadata = super.deleteOne(id);
|
||||
|
||||
// TODO: Move to a cdc scheduler
|
||||
this.fieldMetadataService.deleteMany({
|
||||
id: {
|
||||
in: [
|
||||
@ -213,4 +201,14 @@ export class RelationMetadataService extends TypeOrmQueryService<RelationMetadat
|
||||
|
||||
return createdRelationMetadata;
|
||||
}
|
||||
|
||||
public async findOneWithinWorkspace(
|
||||
relationMetadataId: string,
|
||||
workspaceId: string,
|
||||
) {
|
||||
return this.relationMetadataRepository.findOne({
|
||||
where: { id: relationMetadataId, workspaceId },
|
||||
relations: ['fromFieldMetadata', 'toFieldMetadata'],
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user