fix(customer-vue): mypage 개발

- customer mypage 개발
This commit is contained in:
hoon7566
2022-03-16 19:50:43 +09:00
parent 31675ef6d2
commit a3e0a3d6e9
6 changed files with 142 additions and 1 deletions

View File

@@ -16,6 +16,7 @@ public abstract class UserDto {
// == 생성 메소드 == //
public UserDto(Customer customer) {
this.id = customer.getId();
this.email = customer.getEmail();
this.password = customer.getPassword();
this.name = customer.getName();
this.phoneNumber = customer.getPhoneNumber();

View File

@@ -24,6 +24,33 @@ public class UserController {
private final UserService userService;
@GetMapping("/customer/")
public ResponseEntity getCustomerByToken(@Valid @RequestHeader(value = "user-id") String userId ) {
CustomerDto customerDto = userService.findCustomerByUserId(Long.parseLong(userId));
GetCustomerByTokenResponse getCustomerByTokenResponse = new GetCustomerByTokenResponse(customerDto);
return ResponseEntity.status(HttpStatus.OK)
.body(Result.createSuccessResult(getCustomerByTokenResponse));
}
@Data @NoArgsConstructor @AllArgsConstructor
static class GetCustomerByTokenResponse {
private Long userId;
private String email;
private String userName;
private String phoneNumber;
public GetCustomerByTokenResponse(CustomerDto customerDto) {
this.userId = customerDto.getId();
this.email = customerDto.getEmail();
this.userName = customerDto.getName();
this.phoneNumber = customerDto.getPhoneNumber();
}
}
@GetMapping("/customer/{userId}")
public ResponseEntity getCustomer(@Valid @PathVariable("userId") Long userId) {