mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-27 10:24:55 +00:00
added tag relation to project and product
This commit is contained in:
@ -4,6 +4,7 @@ import { AbstractEntity } from '../../abstract/entities/abstract.entity';
|
|||||||
import { DeviceEntity } from '../../device/entities';
|
import { DeviceEntity } from '../../device/entities';
|
||||||
import { TagModel } from '../../space-model';
|
import { TagModel } from '../../space-model';
|
||||||
import { TagEntity } from '../../space/entities/tag.entity';
|
import { TagEntity } from '../../space/entities/tag.entity';
|
||||||
|
import { NewTagEntity } from '../../tag/entities';
|
||||||
@Entity({ name: 'product' })
|
@Entity({ name: 'product' })
|
||||||
export class ProductEntity extends AbstractEntity<ProductDto> {
|
export class ProductEntity extends AbstractEntity<ProductDto> {
|
||||||
@Column({
|
@Column({
|
||||||
@ -27,6 +28,9 @@ export class ProductEntity extends AbstractEntity<ProductDto> {
|
|||||||
})
|
})
|
||||||
public prodType: string;
|
public prodType: string;
|
||||||
|
|
||||||
|
@OneToMany(() => NewTagEntity, (tag) => tag.product, { cascade: true })
|
||||||
|
public newTags: NewTagEntity[];
|
||||||
|
|
||||||
@OneToMany(() => TagModel, (tag) => tag.product)
|
@OneToMany(() => TagModel, (tag) => tag.product)
|
||||||
tagModels: TagModel[];
|
tagModels: TagModel[];
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import { CommunityEntity } from '../../community/entities';
|
|||||||
import { SpaceModelEntity } from '../../space-model';
|
import { SpaceModelEntity } from '../../space-model';
|
||||||
import { UserEntity } from '../../user/entities';
|
import { UserEntity } from '../../user/entities';
|
||||||
import { InviteUserEntity } from '../../Invite-user/entities';
|
import { InviteUserEntity } from '../../Invite-user/entities';
|
||||||
|
import { NewTagEntity } from '../../tag/entities';
|
||||||
|
|
||||||
@Entity({ name: 'project' })
|
@Entity({ name: 'project' })
|
||||||
@Unique(['name'])
|
@Unique(['name'])
|
||||||
@ -36,6 +37,9 @@ export class ProjectEntity extends AbstractEntity<ProjectDto> {
|
|||||||
@OneToMany(() => InviteUserEntity, (inviteUser) => inviteUser.project)
|
@OneToMany(() => InviteUserEntity, (inviteUser) => inviteUser.project)
|
||||||
public invitedUsers: InviteUserEntity[];
|
public invitedUsers: InviteUserEntity[];
|
||||||
|
|
||||||
|
@OneToMany(() => NewTagEntity, (tag) => tag.project, { cascade: true })
|
||||||
|
public tags: NewTagEntity[];
|
||||||
|
|
||||||
constructor(partial: Partial<ProjectEntity>) {
|
constructor(partial: Partial<ProjectEntity>) {
|
||||||
super();
|
super();
|
||||||
Object.assign(this, partial);
|
Object.assign(this, partial);
|
||||||
|
|||||||
Reference in New Issue
Block a user