keys
This commit is contained in:
32
api/src/model/entitites/cylinder.entity.ts
Normal file
32
api/src/model/entitites/cylinder.entity.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import {
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
Entity,
|
||||
ManyToOne,
|
||||
OneToMany,
|
||||
PrimaryGeneratedColumn,
|
||||
UpdateDateColumn,
|
||||
} from 'typeorm';
|
||||
import { Key } from './key.entity';
|
||||
import { KeySystem } from './system.entity';
|
||||
|
||||
@Entity()
|
||||
export class Cylinder {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
@Column({ nullable: false, unique: true })
|
||||
name: string;
|
||||
|
||||
@OneToMany(() => Key, (key) => key.cylinder)
|
||||
keys: Key[];
|
||||
|
||||
@ManyToOne(() => KeySystem, (sys) => sys.cylinders)
|
||||
system: KeySystem;
|
||||
|
||||
@CreateDateColumn({ name: 'created_at' })
|
||||
createdAt: Date;
|
||||
|
||||
@UpdateDateColumn({ name: 'updatet_at' })
|
||||
updatedAt: Date;
|
||||
}
|
||||
Reference in New Issue
Block a user