Skip to content

Commit

Permalink
fix: Customization entry sending null when creating new
Browse files Browse the repository at this point in the history
  • Loading branch information
chavda-bhavik committed Mar 26, 2024
1 parent c41d85d commit 13b596a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion apps/api/src/app/template/template.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ export class TemplateController {
async updateCustomizationRequest(
@Param('templateId', ValidateMongoId) templateId: string,
@Body() body: UpdateCustomizationRequestDto
): Promise<CustomizationResponseDto> {
) {
return this.updateCustomization.execute(templateId, body);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,16 @@ export class UpdateCustomization {
}
}

const customizationResult = await this.customizationRepository.findOneAndUpdate(
let customizationResult = await this.customizationRepository.findOneAndUpdate(
{
_templateId,
},
customizationUpdateData,
{ upsert: true }
);

if (!customizationResult) customizationResult = await this.customizationRepository.findOne({ _templateId });

return Object.assign(customizationResult, customizationUpdateData);
}

Expand Down

0 comments on commit 13b596a

Please sign in to comment.