mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2026-10-26 00:07:56 +00:00
feat: add validation for documents
This commit is contained in:
@@ -1,4 +1,13 @@
|
||||
import { Column, Entity, OneToMany, OneToOne, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm';
|
||||
import {
|
||||
Column,
|
||||
Entity,
|
||||
JoinColumn,
|
||||
ManyToOne,
|
||||
OneToMany,
|
||||
OneToOne,
|
||||
PrimaryGeneratedColumn,
|
||||
UpdateDateColumn,
|
||||
} from 'typeorm';
|
||||
import { Customer } from '~/customer/entities';
|
||||
import { Gift } from '~/gift/entities';
|
||||
import { Junior, Theme } from '~/junior/entities';
|
||||
@@ -22,6 +31,9 @@ export class Document {
|
||||
@Column({ type: 'varchar', length: 255, name: 'document_type' })
|
||||
documentType!: DocumentType;
|
||||
|
||||
@Column({ type: 'uuid', nullable: true, name: 'created_by_id' })
|
||||
createdById!: string;
|
||||
|
||||
@OneToOne(() => Customer, (customer) => customer.profilePicture, { onDelete: 'SET NULL' })
|
||||
customerPicture?: Customer;
|
||||
|
||||
@@ -46,6 +58,10 @@ export class Document {
|
||||
@OneToMany(() => Gift, (gift) => gift.image)
|
||||
gifts?: Gift[];
|
||||
|
||||
@ManyToOne(() => User, (user) => user.createdDocuments, { nullable: true, onDelete: 'SET NULL' })
|
||||
@JoinColumn({ name: 'created_by_id' })
|
||||
createdBy?: User;
|
||||
|
||||
@UpdateDateColumn({ name: 'updated_at', type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' })
|
||||
updatedAt!: Date;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user