mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-08-26 04:19:39 +00:00

* refactor: reducing used queries on get communities (#385) * refactor: fix create space logic (#394) * Remove unique constraint on subspace and product in SubspaceProductAllocationEntity; update product relation to nullable in NewTagEntity * refactor: fix create space logic * device model updated to include the fixes and final columns * updated space models to include suggested fixes, update final logic and column names * task: removing old references of the old tag-product relation * task: remove old use of tags * task: remove old tag & tag model usage * refactor: delete space * task: remove unused functions * fix lint rule
38 lines
829 B
TypeScript
38 lines
829 B
TypeScript
import { Column, Entity, OneToMany } from 'typeorm';
|
|
import { AbstractEntity } from '../../abstract/entities/abstract.entity';
|
|
import { DeviceEntity } from '../../device/entities';
|
|
import { ProductDto } from '../dtos';
|
|
@Entity({ name: 'product' })
|
|
export class ProductEntity extends AbstractEntity<ProductDto> {
|
|
@Column({
|
|
nullable: false,
|
|
})
|
|
catName: string;
|
|
|
|
@Column({
|
|
nullable: false,
|
|
unique: true,
|
|
})
|
|
public prodId: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
})
|
|
public name: string;
|
|
|
|
@Column({
|
|
nullable: false,
|
|
})
|
|
public prodType: string;
|
|
|
|
@OneToMany(
|
|
() => DeviceEntity,
|
|
(devicesProductEntity) => devicesProductEntity.productDevice,
|
|
)
|
|
devicesProductEntity: DeviceEntity[];
|
|
constructor(partial: Partial<ProductEntity>) {
|
|
super();
|
|
Object.assign(this, partial);
|
|
}
|
|
}
|