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 { AbstractEntity } from '../../abstract/entities/abstract.entity';
|
||||||
import { DeviceDto } from '../dtos/device.dto';
|
import { DeviceDto } from '../dtos/device.dto';
|
||||||
import { SpaceEntity } from '../../space/entities';
|
import { SpaceEntity } from '../../space/entities';
|
||||||
@ -48,8 +48,14 @@ export class DeviceEntity extends AbstractEntity<DeviceDto> {
|
|||||||
|
|
||||||
@ManyToOne(() => ProductEntity, (product) => product.devicesProductEntity, {
|
@ManyToOne(() => ProductEntity, (product) => product.devicesProductEntity, {
|
||||||
nullable: false,
|
nullable: false,
|
||||||
|
lazy: true,
|
||||||
})
|
})
|
||||||
productDevice: ProductEntity;
|
productDevice: ProductEntity;
|
||||||
|
|
||||||
|
@Index()
|
||||||
|
@Column({ nullable: false })
|
||||||
|
uuid: string;
|
||||||
|
|
||||||
constructor(partial: Partial<DeviceEntity>) {
|
constructor(partial: Partial<DeviceEntity>) {
|
||||||
super();
|
super();
|
||||||
Object.assign(this, partial);
|
Object.assign(this, partial);
|
||||||
|
Reference in New Issue
Block a user