56 lines
999 B
TypeScript
56 lines
999 B
TypeScript
import { Room } from 'src/objects/building/entities/room.entity';
|
|
import { User } from 'src/objects/user/user.entity';
|
|
import {
|
|
Column,
|
|
CreateDateColumn,
|
|
Entity,
|
|
ManyToOne,
|
|
OneToMany,
|
|
PrimaryGeneratedColumn,
|
|
UpdateDateColumn,
|
|
} from 'typeorm';
|
|
import { StorageSetType } from '../enums/storage-set-type.enum';
|
|
import { Storage } from './storage.entity';
|
|
|
|
@Entity()
|
|
export class StorageSet {
|
|
@PrimaryGeneratedColumn()
|
|
id: number;
|
|
|
|
@Column()
|
|
displayName: string;
|
|
|
|
@ManyToOne(() => Room, {
|
|
onDelete: 'CASCADE',
|
|
onUpdate: 'CASCADE',
|
|
})
|
|
room: Room;
|
|
|
|
@Column({ type: String })
|
|
type: StorageSetType;
|
|
|
|
@Column()
|
|
location: string;
|
|
|
|
@Column()
|
|
locationDescription: string;
|
|
|
|
@Column()
|
|
color: string;
|
|
|
|
@OneToMany(() => Storage, (storage) => storage.set)
|
|
storages: Storage[];
|
|
|
|
@ManyToOne(() => User, {
|
|
onDelete: 'SET NULL',
|
|
nullable: true,
|
|
})
|
|
addedBy: User;
|
|
|
|
@CreateDateColumn()
|
|
createdAt: Date;
|
|
|
|
@UpdateDateColumn()
|
|
updatedAt: Date;
|
|
}
|