mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-26 10:44:55 +00:00
Added space model, subspace model, space product model entities
This commit is contained in:
@ -0,0 +1,38 @@
|
||||
import { Entity, Column, OneToMany } from 'typeorm';
|
||||
import { AbstractEntity } from '../../abstract/entities/abstract.entity';
|
||||
import { SpaceModelDto } from '../dtos';
|
||||
import { SubspaceModelEntity } from './subspace-model.entity';
|
||||
import { SpaceProductModelEntity } from './space-product-model.entity';
|
||||
|
||||
@Entity({ name: 'space-model' })
|
||||
export class SpaceModelEntity extends AbstractEntity<SpaceModelDto> {
|
||||
@Column({
|
||||
type: 'uuid',
|
||||
default: () => 'gen_random_uuid()',
|
||||
nullable: false,
|
||||
})
|
||||
public uuid: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
})
|
||||
public modelName: string;
|
||||
|
||||
@OneToMany(
|
||||
() => SubspaceModelEntity,
|
||||
(subspaceModel) => subspaceModel.spaceModel,
|
||||
{
|
||||
cascade: true,
|
||||
},
|
||||
)
|
||||
public subspaceModels: SubspaceModelEntity[];
|
||||
|
||||
@OneToMany(
|
||||
() => SpaceProductModelEntity,
|
||||
(productModel) => productModel.spaceModel,
|
||||
{
|
||||
cascade: true,
|
||||
},
|
||||
)
|
||||
public spaceProductModels: SpaceProductModelEntity[];
|
||||
}
|
||||
Reference in New Issue
Block a user