fix(customer-vue): mypage 개발
- customer mypage 개발
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user