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