diff --git a/src/modules/customers/customers.controller.ts b/src/modules/customers/customers.controller.ts index 4268e6a..7afc3fb 100644 --- a/src/modules/customers/customers.controller.ts +++ b/src/modules/customers/customers.controller.ts @@ -59,9 +59,21 @@ export class CustomersController { this.logger.info('saveCustomertheme', JSON.stringify({ id, theme: data })); - const theme = await this.customersService.createThemeByCustomer(id, data); - return theme; + try { + // const theme = await this.customersService.createThemeByCustomer(id, data); + this.logger.info('saveCustomertheme', JSON.stringify(data)); + return { theme: null }; + } catch (err) { + if (err.details === ErrorCodes.CUSTOMER.NOT_FOUND) { + this.logger.error('Error - saveCustomertheme - Expect CUSTOMER.NOT_FOUND'); + throw new HttpException(err.details, HttpStatus.NOT_FOUND); + } else { + this.logger.error('Error - saveCustomertheme Unknown Error:' + err?.message); + return { theme: null }; + }; + } + } @Get(':id/theme') diff --git a/src/modules/customers/customers.service.ts b/src/modules/customers/customers.service.ts index 5dc43f3..4e2ce3a 100644 --- a/src/modules/customers/customers.service.ts +++ b/src/modules/customers/customers.service.ts @@ -96,32 +96,23 @@ export class CustomersService implements OnModuleInit { throw new HttpException(null, HttpStatus.BAD_REQUEST); } - try { - const result = await firstValueFrom( - this.customerService.CustomerCreateTheme({ - customerId: id, - theme - }), - ); - return { theme: result }; - } catch (err) { - if (err.details === ErrorCodes.CUSTOMER.NOT_FOUND) { - this.logger.error('Error - saveCustomertheme - Expect CUSTOMER.NOT_FOUND'); - throw new HttpException(err.details, HttpStatus.NOT_FOUND); - } else { - this.logger.error('Error - saveCustomertheme Unknown Error:' + err?.message); - throw err - }; - } + const result = await firstValueFrom( + this.customerService.CustomerCreateTheme({ + customerId: id, + theme + }), + ); + return { theme: result }; + } - async getThemeByCustomer(id: string): Promise { + async getThemeByCustomer(id: string): Promise { if (!id) { this.logger.error('Error - getCustomerTheme - not found id:' + id); throw new HttpException(null, HttpStatus.BAD_REQUEST); } - const result = await firstValueFrom( + const result = await firstValueFrom( this.customerService.CustomerGetTheme({ id }),