add product and entity type
This commit is contained in:
23
server/src/entity/event-type.entity.ts
Normal file
23
server/src/entity/event-type.entity.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { Entity, PrimaryGeneratedColumn, Column } from 'typeorm';
|
||||
import { IsString, IsNumber, IsBoolean, IsDate, IsOptional } from 'class-validator';
|
||||
|
||||
@Entity({ name: 'event_type' })
|
||||
export class EventType {
|
||||
@PrimaryGeneratedColumn()
|
||||
id: number;
|
||||
|
||||
@Column()
|
||||
@IsString()
|
||||
name: string;
|
||||
|
||||
@Column({ type: 'character varying', nullable: true })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
description: string | null;
|
||||
|
||||
@Column({ type: 'character varying', nullable: true })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
color: string | null;
|
||||
|
||||
}
|
||||
23
server/src/entity/product.entity.ts
Normal file
23
server/src/entity/product.entity.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { Entity, PrimaryGeneratedColumn, Column } from 'typeorm';
|
||||
import { IsString, IsNumber, IsBoolean, IsDate, IsOptional } from 'class-validator';
|
||||
|
||||
@Entity({ name: 'products' })
|
||||
export class Product {
|
||||
@PrimaryGeneratedColumn()
|
||||
id: number;
|
||||
|
||||
@Column()
|
||||
@IsString()
|
||||
name: string;
|
||||
|
||||
@Column({ type: 'numeric', nullable: true })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
price: number | null;
|
||||
|
||||
@Column({ type: 'boolean', nullable: true, default: true })
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
is_available: boolean | null = true;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user