upd
This commit is contained in:
@ -1,7 +1,8 @@
|
|||||||
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, ManyToOne, JoinColumn } from "typeorm";
|
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, ManyToOne, JoinColumn, ManyToMany } from "typeorm";
|
||||||
|
|
||||||
import { Status } from "../types/status";
|
import { Status } from "../types/status";
|
||||||
import { Poli } from "./poli";
|
import { Poli } from "./poli";
|
||||||
|
import { Service } from "./service";
|
||||||
|
|
||||||
@Entity("rooms")
|
@Entity("rooms")
|
||||||
export class Room {
|
export class Room {
|
||||||
@ -36,6 +37,9 @@ export class Room {
|
|||||||
})
|
})
|
||||||
status: Status;
|
status: Status;
|
||||||
|
|
||||||
|
@ManyToMany(() => Service, (service) => service.rooms)
|
||||||
|
services: Service[];
|
||||||
|
|
||||||
@CreateDateColumn()
|
@CreateDateColumn()
|
||||||
created_at: Date;
|
created_at: Date;
|
||||||
|
|
||||||
|
|||||||
60
src/entity/service.ts
Normal file
60
src/entity/service.ts
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
import {
|
||||||
|
Entity,
|
||||||
|
PrimaryGeneratedColumn,
|
||||||
|
Column,
|
||||||
|
CreateDateColumn,
|
||||||
|
UpdateDateColumn,
|
||||||
|
DeleteDateColumn,
|
||||||
|
ManyToOne,
|
||||||
|
JoinColumn,
|
||||||
|
ManyToMany,
|
||||||
|
JoinTable,
|
||||||
|
} from 'typeorm';
|
||||||
|
|
||||||
|
import { ServiceType } from './service_type';
|
||||||
|
import { Room } from './room';
|
||||||
|
|
||||||
|
@Entity('services')
|
||||||
|
export class Service {
|
||||||
|
@PrimaryGeneratedColumn('uuid')
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 256
|
||||||
|
})
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
@ManyToOne(() => ServiceType, { onDelete: 'NO ACTION' })
|
||||||
|
@JoinColumn()
|
||||||
|
serviceType: ServiceType;
|
||||||
|
|
||||||
|
@ManyToMany(() => Room, (room) => room.services)
|
||||||
|
@JoinTable({
|
||||||
|
name: 'service_rooms',
|
||||||
|
joinColumn: { name: 'service_id', referencedColumnName: 'id' },
|
||||||
|
inverseJoinColumn: { name: 'room_id', referencedColumnName: 'id' },
|
||||||
|
})
|
||||||
|
rooms: Room[];
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
@CreateDateColumn()
|
||||||
|
created_at: Date;
|
||||||
|
|
||||||
|
@Column({ nullable: true, length: 256 })
|
||||||
|
created_by: string;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@UpdateDateColumn()
|
||||||
|
updated_at: Date;
|
||||||
|
|
||||||
|
@Column({ nullable: true, length: 256 })
|
||||||
|
updated_by: string;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@DeleteDateColumn()
|
||||||
|
deleted_at: Date;
|
||||||
|
|
||||||
|
@Column({ nullable: true, length: 256 })
|
||||||
|
deleted_by: string;
|
||||||
|
}
|
||||||
34
src/entity/service_class.ts
Normal file
34
src/entity/service_class.ts
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn } from 'typeorm';
|
||||||
|
|
||||||
|
@Entity('service_classes')
|
||||||
|
export class ServiceClass {
|
||||||
|
@PrimaryGeneratedColumn('uuid')
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 256
|
||||||
|
})
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
@CreateDateColumn()
|
||||||
|
created_at: Date;
|
||||||
|
|
||||||
|
@Column({ nullable: true, length: 256 })
|
||||||
|
created_by: string;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@UpdateDateColumn()
|
||||||
|
updated_at: Date;
|
||||||
|
|
||||||
|
@Column({ nullable: true, length: 256 })
|
||||||
|
updated_by: string;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@DeleteDateColumn()
|
||||||
|
deleted_at: Date;
|
||||||
|
|
||||||
|
@Column({ nullable: true, length: 256 })
|
||||||
|
deleted_by: string;
|
||||||
|
}
|
||||||
57
src/entity/service_fare.ts
Normal file
57
src/entity/service_fare.ts
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
import {
|
||||||
|
Entity,
|
||||||
|
PrimaryGeneratedColumn,
|
||||||
|
Column,
|
||||||
|
CreateDateColumn,
|
||||||
|
UpdateDateColumn,
|
||||||
|
DeleteDateColumn,
|
||||||
|
ManyToOne,
|
||||||
|
JoinColumn,
|
||||||
|
} from 'typeorm';
|
||||||
|
|
||||||
|
import { ServiceClass } from './service_class';
|
||||||
|
import { Service } from './service';
|
||||||
|
|
||||||
|
@Entity('service_fares')
|
||||||
|
export class ServiceFare {
|
||||||
|
@PrimaryGeneratedColumn('uuid')
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@ManyToOne(() => ServiceClass, { onDelete: 'NO ACTION' })
|
||||||
|
@JoinColumn()
|
||||||
|
serviceClass: ServiceClass;
|
||||||
|
|
||||||
|
@ManyToOne(() => Service, { onDelete: 'NO ACTION' })
|
||||||
|
@JoinColumn()
|
||||||
|
service: Service;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
type: 'decimal',
|
||||||
|
precision: 18,
|
||||||
|
scale: 2,
|
||||||
|
nullable: false,
|
||||||
|
default: 0
|
||||||
|
})
|
||||||
|
fare: string;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
@CreateDateColumn()
|
||||||
|
created_at: Date;
|
||||||
|
|
||||||
|
@Column({ nullable: true, length: 256 })
|
||||||
|
created_by: string;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@UpdateDateColumn()
|
||||||
|
updated_at: Date;
|
||||||
|
|
||||||
|
@Column({ nullable: true, length: 256 })
|
||||||
|
updated_by: string;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@DeleteDateColumn()
|
||||||
|
deleted_at: Date;
|
||||||
|
|
||||||
|
@Column({ nullable: true, length: 256 })
|
||||||
|
deleted_by: string;
|
||||||
|
}
|
||||||
69
src/entity/service_package.ts
Normal file
69
src/entity/service_package.ts
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
import {
|
||||||
|
Entity,
|
||||||
|
PrimaryGeneratedColumn,
|
||||||
|
Column,
|
||||||
|
CreateDateColumn,
|
||||||
|
UpdateDateColumn,
|
||||||
|
DeleteDateColumn,
|
||||||
|
ManyToOne,
|
||||||
|
JoinColumn,
|
||||||
|
ManyToMany,
|
||||||
|
JoinTable,
|
||||||
|
} from 'typeorm';
|
||||||
|
|
||||||
|
import { ServiceClass } from './service_class';
|
||||||
|
import { Service } from './service';
|
||||||
|
|
||||||
|
@Entity('service_packages')
|
||||||
|
export class ServicePackage {
|
||||||
|
@PrimaryGeneratedColumn('uuid')
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 256
|
||||||
|
})
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
@ManyToOne(() => ServiceClass, { onDelete: 'NO ACTION' })
|
||||||
|
@JoinColumn()
|
||||||
|
serviceClass: ServiceClass;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
type: 'decimal',
|
||||||
|
precision: 18,
|
||||||
|
scale: 2,
|
||||||
|
nullable: false,
|
||||||
|
default: 0
|
||||||
|
})
|
||||||
|
fare: string;
|
||||||
|
|
||||||
|
@ManyToMany(() => Service)
|
||||||
|
@JoinTable({
|
||||||
|
name: 'service_package_services',
|
||||||
|
joinColumn: { name: 'service_package_id', referencedColumnName: 'id' },
|
||||||
|
inverseJoinColumn: { name: 'service_id', referencedColumnName: 'id' },
|
||||||
|
})
|
||||||
|
services: Service[];
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
@CreateDateColumn()
|
||||||
|
created_at: Date;
|
||||||
|
|
||||||
|
@Column({ nullable: true, length: 256 })
|
||||||
|
created_by: string;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@UpdateDateColumn()
|
||||||
|
updated_at: Date;
|
||||||
|
|
||||||
|
@Column({ nullable: true, length: 256 })
|
||||||
|
updated_by: string;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@DeleteDateColumn()
|
||||||
|
deleted_at: Date;
|
||||||
|
|
||||||
|
@Column({ nullable: true, length: 256 })
|
||||||
|
deleted_by: string;
|
||||||
|
}
|
||||||
42
src/entity/service_type.ts
Normal file
42
src/entity/service_type.ts
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn } from 'typeorm';
|
||||||
|
|
||||||
|
import { Status } from '../types/status';
|
||||||
|
|
||||||
|
@Entity('service_types')
|
||||||
|
export class ServiceType {
|
||||||
|
@PrimaryGeneratedColumn('uuid')
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 256
|
||||||
|
})
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 64
|
||||||
|
})
|
||||||
|
status: Status;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
@CreateDateColumn()
|
||||||
|
created_at: Date;
|
||||||
|
|
||||||
|
@Column({ nullable: true, length: 256 })
|
||||||
|
created_by: string;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@UpdateDateColumn()
|
||||||
|
updated_at: Date;
|
||||||
|
|
||||||
|
@Column({ nullable: true, length: 256 })
|
||||||
|
updated_by: string;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@DeleteDateColumn()
|
||||||
|
deleted_at: Date;
|
||||||
|
|
||||||
|
@Column({ nullable: true, length: 256 })
|
||||||
|
deleted_by: string;
|
||||||
|
}
|
||||||
@ -14,6 +14,11 @@ export * from "../entity/diagnosis"
|
|||||||
export * from "../entity/diagnostic_procedure"
|
export * from "../entity/diagnostic_procedure"
|
||||||
export * from "../entity/poli"
|
export * from "../entity/poli"
|
||||||
export * from "../entity/room"
|
export * from "../entity/room"
|
||||||
|
export * from "../entity/service_type"
|
||||||
|
export * from "../entity/service_class"
|
||||||
|
export * from "../entity/service"
|
||||||
|
export * from "../entity/service_fare"
|
||||||
|
export * from "../entity/service_package"
|
||||||
|
|
||||||
export * from "../types/action";
|
export * from "../types/action";
|
||||||
export * from "../types/error";
|
export * from "../types/error";
|
||||||
|
|||||||
Reference in New Issue
Block a user