import { Column, CreateDateColumn, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn, } from 'typeorm'; import { City } from '../../provinces/entities/city.entity'; import { Province } from '../../provinces/entities/province.entity'; import { User } from '../../users/entities/user.entity'; @Entity('salons') export class Salon { @PrimaryGeneratedColumn('uuid') id: string; @Column({ length: 200 }) name: string; @Column({ type: 'text', nullable: true }) description: string | null; @Column({ length: 500 }) address: string; @Column({ length: 11 }) phone: string; @Column() ownerId: string; @ManyToOne(() => User, { onDelete: 'CASCADE' }) @JoinColumn({ name: 'ownerId' }) owner: User; @Column({ nullable: true }) provinceId: string | null; @ManyToOne(() => Province, { onDelete: 'SET NULL', nullable: true }) @JoinColumn({ name: 'provinceId' }) province: Province | null; @Column({ nullable: true }) cityId: string | null; @ManyToOne(() => City, { onDelete: 'SET NULL', nullable: true }) @JoinColumn({ name: 'cityId' }) city: City | null; @CreateDateColumn() createdAt: Date; @UpdateDateColumn() updatedAt: Date; }