fix tag usage

This commit is contained in:
hannathkadher
2025-02-10 13:04:22 +04:00
parent acf8c42170
commit f5f9e9dfe3
4 changed files with 16 additions and 13 deletions

View File

@ -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();

View File

@ -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[];
}

View File

@ -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(),
);
}
}

View File

@ -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',
})