mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-26 20:04:54 +00:00
added entities for space product item
This commit is contained in:
@ -19,14 +19,13 @@ export class SpaceProductItemModelService {
|
||||
spaceModel: SpaceModelEntity,
|
||||
queryRunner: QueryRunner,
|
||||
) {
|
||||
await this.validateTags(itemModelDtos, spaceModel, queryRunner);
|
||||
await this.validateTags(itemModelDtos, queryRunner, spaceModel);
|
||||
|
||||
try {
|
||||
const productItems = itemModelDtos.map((dto) =>
|
||||
queryRunner.manager.create(this.spaceProductItemRepository.target, {
|
||||
tag: dto.tag,
|
||||
spaceProductModel,
|
||||
spaceModel,
|
||||
}),
|
||||
);
|
||||
|
||||
@ -46,8 +45,8 @@ export class SpaceProductItemModelService {
|
||||
|
||||
private async validateTags(
|
||||
itemModelDtos: CreateSpaceProductItemModelDto[],
|
||||
spaceModel: SpaceModelEntity,
|
||||
queryRunner: QueryRunner,
|
||||
spaceModel: SpaceModelEntity,
|
||||
) {
|
||||
const incomingTags = itemModelDtos.map((item) => item.tag);
|
||||
|
||||
@ -64,7 +63,7 @@ export class SpaceProductItemModelService {
|
||||
const existingTags = await queryRunner.manager.find(
|
||||
this.spaceProductItemRepository.target,
|
||||
{
|
||||
where: { spaceModel },
|
||||
where: { spaceProductModel: { spaceModel } },
|
||||
select: ['tag'],
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user