mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-27 02:54:54 +00:00
fix tag usage
This commit is contained in:
@ -5,7 +5,7 @@ import { SubspaceModelEntity } from './subspace-model';
|
||||
import { ProjectEntity } from '../../project/entities';
|
||||
import { SpaceEntity } from '../../space/entities';
|
||||
import { TagModel } from './tag-model.entity';
|
||||
import { SpaceModelProductAllocation } from './space-model-product-allocation.entity';
|
||||
import { SpaceModelProductAllocationEntity } from './space-model-product-allocation.entity';
|
||||
|
||||
@Entity({ name: 'space-model' })
|
||||
export class SpaceModelEntity extends AbstractEntity<SpaceModelDto> {
|
||||
@ -53,11 +53,11 @@ export class SpaceModelEntity extends AbstractEntity<SpaceModelDto> {
|
||||
tags: TagModel[];
|
||||
|
||||
@OneToMany(
|
||||
() => SpaceModelProductAllocation,
|
||||
() => SpaceModelProductAllocationEntity,
|
||||
(allocation) => allocation.spaceModel,
|
||||
{ cascade: true },
|
||||
)
|
||||
public productAllocations: SpaceModelProductAllocation[];
|
||||
public productAllocations: SpaceModelProductAllocationEntity[];
|
||||
|
||||
constructor(partial: Partial<SpaceModelEntity>) {
|
||||
super();
|
||||
|
||||
@ -4,7 +4,7 @@ import { SubSpaceModelDto } from '../../dtos';
|
||||
import { SpaceModelEntity } from '../space-model.entity';
|
||||
import { SubspaceEntity } from '@app/common/modules/space/entities';
|
||||
import { TagModel } from '../tag-model.entity';
|
||||
import { SubspaceModelProductAllocation } from './subspace-model-product-allocation.entity';
|
||||
import { SubspaceModelProductAllocationEntity } from './subspace-model-product-allocation.entity';
|
||||
|
||||
@Entity({ name: 'subspace-model' })
|
||||
export class SubspaceModelEntity extends AbstractEntity<SubSpaceModelDto> {
|
||||
@ -45,9 +45,9 @@ export class SubspaceModelEntity extends AbstractEntity<SubSpaceModelDto> {
|
||||
tags: TagModel[];
|
||||
|
||||
@OneToMany(
|
||||
() => SubspaceModelProductAllocation,
|
||||
() => SubspaceModelProductAllocationEntity,
|
||||
(allocation) => allocation.subspaceModel,
|
||||
{ cascade: true },
|
||||
)
|
||||
public productAllocations: SubspaceModelProductAllocation[];
|
||||
public productAllocations: SubspaceModelProductAllocationEntity[];
|
||||
}
|
||||
|
||||
@ -2,9 +2,9 @@ import { DataSource, Repository } from 'typeorm';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import {
|
||||
SpaceModelEntity,
|
||||
SpaceModelProductAllocation,
|
||||
SpaceModelProductAllocationEntity,
|
||||
SubspaceModelEntity,
|
||||
SubspaceModelProductAllocation,
|
||||
SubspaceModelProductAllocationEntity,
|
||||
TagModel,
|
||||
} from '../entities';
|
||||
|
||||
@ -29,15 +29,18 @@ export class TagModelRepository extends Repository<TagModel> {
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class SpaceModelProductAllocationRepoitory extends Repository<SpaceModelProductAllocation> {
|
||||
export class SpaceModelProductAllocationRepoitory extends Repository<SpaceModelProductAllocationEntity> {
|
||||
constructor(private dataSource: DataSource) {
|
||||
super(SpaceModelProductAllocation, dataSource.createEntityManager());
|
||||
super(SpaceModelProductAllocationEntity, dataSource.createEntityManager());
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class SubspaceModelProductAllocationRepoitory extends Repository<SubspaceModelProductAllocation> {
|
||||
export class SubspaceModelProductAllocationRepoitory extends Repository<SubspaceModelProductAllocationEntity> {
|
||||
constructor(private dataSource: DataSource) {
|
||||
super(SubspaceModelProductAllocation, dataSource.createEntityManager());
|
||||
super(
|
||||
SubspaceModelProductAllocationEntity,
|
||||
dataSource.createEntityManager(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ export class NewTagEntity extends AbstractEntity<NewTagDto> {
|
||||
@Column()
|
||||
name: string;
|
||||
|
||||
@ManyToOne(() => ProductEntity, (product) => product.tags, {
|
||||
@ManyToOne(() => ProductEntity, (product) => product.newTags, {
|
||||
nullable: false,
|
||||
onDelete: 'CASCADE',
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user