Add soft delete to metadata (#2072)

This commit is contained in:
Weiko
2023-10-16 22:04:17 +02:00
committed by GitHub
parent 07ae0fa76c
commit c06a8a9213
10 changed files with 57 additions and 15 deletions

View File

@ -38,7 +38,6 @@ export const objectMetadataAutoResolverOpts: AutoResolverOpts<
update: {
many: { disabled: true },
},
delete: { disabled: true },
guards: [JwtAuthGuard],
},
];

View File

@ -3,6 +3,7 @@ import { ObjectType, ID, Field } from '@nestjs/graphql';
import {
Column,
CreateDateColumn,
DeleteDateColumn,
Entity,
OneToMany,
PrimaryGeneratedColumn,
@ -92,4 +93,7 @@ export class ObjectMetadata {
@Field()
@UpdateDateColumn({ name: 'updated_at' })
updatedAt: Date;
@DeleteDateColumn({ name: 'deleted_at' })
deletedAt?: Date;
}

View File

@ -18,7 +18,7 @@ export class ObjectMetadataService extends TypeOrmQueryService<ObjectMetadata> {
private readonly tenantMigrationService: TenantMigrationService,
private readonly migrationRunnerService: MigrationRunnerService,
) {
super(objectMetadataRepository);
super(objectMetadataRepository, { useSoftDelete: true });
}
override async createOne(record: ObjectMetadata): Promise<ObjectMetadata> {