40 lines
797 B
TypeScript
40 lines
797 B
TypeScript
import {
|
|
Column,
|
|
CreateDateColumn,
|
|
Entity,
|
|
JoinColumn,
|
|
ManyToOne,
|
|
PrimaryGeneratedColumn,
|
|
Unique,
|
|
UpdateDateColumn,
|
|
} from 'typeorm';
|
|
import { Salon } from '../../salons/entities/salon.entity';
|
|
import { Service } from './service.entity';
|
|
|
|
@Entity('salon_services')
|
|
@Unique(['salonId', 'serviceId'])
|
|
export class SalonServiceOffering {
|
|
@PrimaryGeneratedColumn('uuid')
|
|
id: string;
|
|
|
|
@Column({ type: 'uuid' })
|
|
salonId: string;
|
|
|
|
@Column({ type: 'uuid' })
|
|
serviceId: string;
|
|
|
|
@ManyToOne(() => Salon, { onDelete: 'CASCADE' })
|
|
@JoinColumn({ name: 'salonId' })
|
|
salon: Salon;
|
|
|
|
@ManyToOne(() => Service, { onDelete: 'CASCADE' })
|
|
@JoinColumn({ name: 'serviceId' })
|
|
service: Service;
|
|
|
|
@CreateDateColumn()
|
|
createdAt: Date;
|
|
|
|
@UpdateDateColumn()
|
|
updatedAt: Date;
|
|
}
|