mirror of
https://github.com/SyncrowIOT/backend.git
synced 2026-10-26 03:27:54 +00:00
product update
This commit is contained in:
@@ -160,14 +160,21 @@ export class SpaceService {
|
||||
);
|
||||
|
||||
// If a parentId is provided, check if the parent exists
|
||||
const { parentUuid } = updateSpaceDto;
|
||||
const { parentUuid, products } = updateSpaceDto;
|
||||
const parent = parentUuid ? await this.validateSpace(parentUuid) : null;
|
||||
|
||||
// Update other space properties from updateSpaceDto
|
||||
Object.assign(space, updateSpaceDto, { parent });
|
||||
|
||||
// Save the updated space
|
||||
await this.spaceRepository.save(space);
|
||||
const updatedSpace = await this.spaceRepository.save(space);
|
||||
|
||||
if (products && products.length > 0) {
|
||||
await this.spaceProductService.assignProductsToSpace(
|
||||
updatedSpace,
|
||||
products,
|
||||
);
|
||||
}
|
||||
|
||||
return new SuccessResponseDto({
|
||||
message: `Space with ID ${spaceUuid} successfully updated`,
|
||||
|
||||
Reference in New Issue
Block a user