mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-15 10:25:23 +00:00
Add UUID index to DeviceEntity and set productDevice to lazy loading
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { Column, Entity, ManyToOne, OneToMany, Unique } from 'typeorm';
|
||||
import { Column, Entity, ManyToOne, OneToMany, Unique, Index } from 'typeorm';
|
||||
import { AbstractEntity } from '../../abstract/entities/abstract.entity';
|
||||
import { DeviceDto } from '../dtos/device.dto';
|
||||
import { SpaceEntity } from '../../space/entities';
|
||||
@ -48,8 +48,14 @@ export class DeviceEntity extends AbstractEntity<DeviceDto> {
|
||||
|
||||
@ManyToOne(() => ProductEntity, (product) => product.devicesProductEntity, {
|
||||
nullable: false,
|
||||
lazy: true,
|
||||
})
|
||||
productDevice: ProductEntity;
|
||||
|
||||
@Index()
|
||||
@Column({ nullable: false })
|
||||
uuid: string;
|
||||
|
||||
constructor(partial: Partial<DeviceEntity>) {
|
||||
super();
|
||||
Object.assign(this, partial);
|
||||
|
Reference in New Issue
Block a user