-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8fd015c
commit c544f31
Showing
3 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
src/main/java/com/kakaoteck/golagola/domain/seller/controller/SellerController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.kakaoteck.golagola.domain.seller.controller; | ||
|
||
import com.kakaoteck.golagola.domain.seller.dto.SellerResponse; | ||
import com.kakaoteck.golagola.domain.seller.entity.Seller; | ||
import com.kakaoteck.golagola.domain.seller.service.SellerService; | ||
import com.kakaoteck.golagola.global.common.ApiResponse; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.security.core.annotation.AuthenticationPrincipal; | ||
import org.springframework.web.bind.annotation.CrossOrigin; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/api/v1/seller") | ||
@CrossOrigin("*") | ||
public class SellerController { | ||
|
||
private final SellerService sellerService; | ||
|
||
@Operation(summary = "판매자 마이페이지 조회", description = "판매자의 정보를 조회합니다.") | ||
@GetMapping("/mypage") | ||
public ApiResponse<SellerResponse> getMyPage( | ||
@AuthenticationPrincipal Seller seller | ||
) { | ||
return ApiResponse.onSuccess(sellerService.getMyPage(seller)); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/com/kakaoteck/golagola/domain/seller/dto/SellerResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.kakaoteck.golagola.domain.seller.dto; | ||
|
||
import com.kakaoteck.golagola.global.common.enums.Gender; | ||
import com.kakaoteck.golagola.global.common.enums.Role; | ||
import lombok.Builder; | ||
|
||
import java.time.LocalDate; | ||
|
||
@Builder | ||
public record SellerResponse( | ||
String nickname, | ||
String realName, | ||
Gender gender, | ||
String email, | ||
String address, | ||
String phoneNum, | ||
Role role, | ||
LocalDate registerDate | ||
) { | ||
} |
31 changes: 31 additions & 0 deletions
31
src/main/java/com/kakaoteck/golagola/domain/seller/service/SellerService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.kakaoteck.golagola.domain.seller.service; | ||
|
||
import com.kakaoteck.golagola.domain.seller.dto.SellerResponse; | ||
import com.kakaoteck.golagola.domain.seller.entity.Seller; | ||
import com.kakaoteck.golagola.domain.seller.repository.SellerRepository; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
@Transactional | ||
@Slf4j | ||
public class SellerService { | ||
|
||
private final SellerRepository sellerRepository; | ||
|
||
public SellerResponse getMyPage(Seller seller) { | ||
return SellerResponse.builder() | ||
.email(seller.getEmail()) | ||
.role(seller.getRole()) | ||
.address(seller.getAddress()) | ||
.registerDate(seller.getRegisterDate()) | ||
.realName(seller.getRealName()) | ||
.gender(seller.getGender()) | ||
.phoneNum(seller.getPhoneNum()) | ||
.nickname(seller.getNickname()) | ||
.build(); | ||
} | ||
} |