Files
yunhaifinance/backend/src/modules/customers/customer.entity.ts
T

37 lines
965 B
TypeScript

import { Entity, Column, PrimaryGeneratedColumn, CreateDateColumn, UpdateDateColumn, OneToMany } from 'typeorm';
import { Project } from '../projects/project.entity';
import { Quotation } from '../quotations/quotation.entity';
@Entity('customers')
export class Customer {
@PrimaryGeneratedColumn('uuid')
id: string;
@Column({ type: 'varchar', length: 255, nullable: false })
name: string;
@Column({ type: 'varchar', length: 255, nullable: true })
contact_person: string;
@Column({ type: 'varchar', length: 50, nullable: true })
phone: string;
@Column({ type: 'varchar', length: 255, nullable: true })
email: string;
@Column({ type: 'text', nullable: true })
address: string;
@CreateDateColumn()
created_at: Date;
@UpdateDateColumn()
updated_at: Date;
@OneToMany(() => Project, project => project.customer)
projects: Project[];
@OneToMany(() => Quotation, quotation => quotation.customer)
quotations: Quotation[];
}