mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-27 01:04:54 +00:00
Added subspace entity
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import { Column, Entity, ManyToOne, OneToMany, Unique, Index } from 'typeorm';
|
||||
import { Column, Entity, ManyToOne, OneToMany, Unique, Index, JoinColumn } from 'typeorm';
|
||||
import { AbstractEntity } from '../../abstract/entities/abstract.entity';
|
||||
import { DeviceDto, DeviceUserPermissionDto } from '../dtos/device.dto';
|
||||
import { SpaceEntity } from '../../space/entities';
|
||||
import { SpaceEntity, SubspaceEntity } from '../../space/entities';
|
||||
import { ProductEntity } from '../../product/entities';
|
||||
import { UserEntity } from '../../user/entities';
|
||||
import { DeviceNotificationDto } from '../dtos';
|
||||
@ -52,6 +52,12 @@ export class DeviceEntity extends AbstractEntity<DeviceDto> {
|
||||
})
|
||||
productDevice: ProductEntity;
|
||||
|
||||
@ManyToOne(() => SubspaceEntity, (subspace) => subspace.devices, {
|
||||
nullable: true,
|
||||
})
|
||||
@JoinColumn({ name: 'subspace_id' })
|
||||
subspace: SubspaceEntity;
|
||||
|
||||
@Index()
|
||||
@Column({ nullable: false })
|
||||
uuid: string;
|
||||
|
||||
Reference in New Issue
Block a user