Skip to content

Commit

Permalink
Merge pull request #32 from PBTP/fix/profile-update
Browse files Browse the repository at this point in the history
fix: customer update function 파라미터 수정
  • Loading branch information
emibgo2 authored Aug 13, 2024
2 parents 7231d3c + 9852eaf commit cb2ca73
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/customer/application/customer.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class CustomerService implements IUserService {
});
}

async update(dto: CustomerDto): Promise<Customer> {
async update(dto: Partial<CustomerDto>): Promise<Customer> {
return this.findOne(dto).then(async (customer) => {
if (customer) {
customer.customerLocation =
Expand Down
15 changes: 11 additions & 4 deletions src/customer/presentation/customer.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,17 @@ export class CustomerController {
@CurrentCustomer() customer: Customer,
@Body() dto: UpdateProfileDto,
): Promise<Omit<CustomerDto, 'refreshToken'>> {
const updatedCustomer = await this.customerService.update({
...customer,
...dto,
});
customer.customerName = dto.customerName
? dto.customerName
: customer.customerName;
customer.customerPhoneNumber = dto.customerPhoneNumber
? dto.customerPhoneNumber
: customer.customerPhoneNumber;
customer.customerLocation = dto.customerLocation
? dto.customerLocation
: customer.customerLocation;

const updatedCustomer = await this.customerService.update(customer);

return {
customerId: updatedCustomer.customerId,
Expand Down

0 comments on commit cb2ca73

Please sign in to comment.