32 lines
887 B
TypeScript
32 lines
887 B
TypeScript
import { Column, CreateDateColumn, Entity, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm';
|
|
import type { Relation } from 'typeorm';
|
|
import { User } from './User.js';
|
|
import { dateTimeColumnType } from '../utils/db-column-types.js';
|
|
|
|
@Entity('merchants')
|
|
export class Merchant {
|
|
@PrimaryGeneratedColumn('uuid')
|
|
id!: string;
|
|
|
|
@Column({ type: 'varchar', length: 120 })
|
|
name!: string;
|
|
|
|
@Column({ type: 'varchar', length: 30, default: 'MERCHANT' })
|
|
kind!: 'MERCHANT' | 'SERVICE_PROVIDER' | 'OTHER';
|
|
|
|
@Column({ type: 'text', nullable: true })
|
|
notes!: string | null;
|
|
|
|
@Column({ type: 'boolean', default: true })
|
|
isActive!: boolean;
|
|
|
|
@CreateDateColumn({ type: dateTimeColumnType })
|
|
createdAt!: Date;
|
|
|
|
@UpdateDateColumn({ type: dateTimeColumnType })
|
|
updatedAt!: Date;
|
|
|
|
@ManyToOne(() => User, { onDelete: 'CASCADE' })
|
|
user!: Relation<User>;
|
|
}
|