feat: add validation for documents

This commit is contained in:
Abdalhamid Alhamad
2025-01-13 11:43:28 +03:00
parent 756e947c8a
commit 62621c1a15
12 changed files with 195 additions and 13 deletions

View File

@ -0,0 +1,17 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
export class AddCreatedByToDocumentTable1736753223884 implements MigrationInterface {
name = 'AddCreatedByToDocumentTable1736753223884';
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "documents" ADD "created_by_id" uuid `);
await queryRunner.query(
`ALTER TABLE "documents" ADD CONSTRAINT "FK_7f46f4f77acde1dcedba64cb220" FOREIGN KEY ("created_by_id") REFERENCES "users"("id") ON DELETE SET NULL ON UPDATE NO ACTION`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "documents" DROP CONSTRAINT "FK_7f46f4f77acde1dcedba64cb220"`);
await queryRunner.query(`ALTER TABLE "documents" DROP COLUMN "created_by_id"`);
}
}

View File

@ -18,3 +18,4 @@ export * from './1734601976591-create-allowance-entities';
export * from './1734861516657-create-gift-entities';
export * from './1734944692999-create-notification-entity-and-edit-device';
export * from './1736414850257-add-flags-to-user-entity';
export * from './1736753223884-add_created_by_to_document_table';