Skip to content

Commit

Permalink
Merge pull request #189 from THEGOODs-repo/feature/188
Browse files Browse the repository at this point in the history
[Feature/188] ํ…Œ์ŠคํŠธ ๋ฐ์ดํ„ฐ ๋“ฑ๋ก์šฉ API ์ˆ˜์ •
  • Loading branch information
Eunjin3395 authored May 21, 2024
2 parents 135102b + 64eb6d5 commit c240fbf
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
public class SpringSecurityConfig {



private final CustomAccessDeniedHandler accessDeniedHandler;
private final CustomAuthenticationEntryPoint authenticationEntryPoint;
private final JwtAuthenticationExceptionHandler exceptionFilter;
Expand All @@ -36,8 +35,9 @@ public class SpringSecurityConfig {
private String secretKey;

private final UrlBasedCorsConfigurationSource corsConfigurationSource;

@Bean
public WebSecurityCustomizer webSecurityCustomizer(){
public WebSecurityCustomizer webSecurityCustomizer() {
return (web) -> web.ignoring()
.antMatchers(
"/favicon.ico",
Expand All @@ -48,13 +48,16 @@ public WebSecurityCustomizer webSecurityCustomizer(){
"/swagger-resources/**",
"/v3/api-docs/**",
"/api/members/login", "/api/members/token/regenerate", "/api/members/join",
"/api/members/email/auth","/api/members/email/auth/verify","/api/members/email/duplicate",
"/api/members/kakao/callback","/api/members/naver/callback", "/api/members/nickname/duplicate",
"/api/members/password/update","/api/members/phone/auth","/api/members/phone/auth/**",
"/api/item/today", "/api/item/topsale","/api/item/steady", "/api/count/tags/item",
"/api/delivery-date/item" ,"/api/item/main", "/api/item/{itemId}/related" ,"/api/order/api/nologin/order"
"/api/members/email/auth", "/api/members/email/auth/verify", "/api/members/email/duplicate",
"/api/members/kakao/callback", "/api/members/naver/callback", "/api/members/nickname/duplicate",
"/api/members/password/update", "/api/members/phone/auth", "/api/members/phone/auth/**",
"/api/item/today", "/api/item/topsale", "/api/item/steady", "/api/count/tags/item",
"/api/delivery-date/item", "/api/item/main", "/api/item/{itemId}/related", "/api/order/api/nologin/order",
"/api/seller/item/{itemId}",
"/api/setItemData", "/api/search/item"
);
}

@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity httpSecurity) throws Exception {

Expand Down
13 changes: 7 additions & 6 deletions src/main/java/com/umc/TheGoods/test/TestController.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public class TestController {
public ApiResponse<TestResponseDTO.addItemDTO> setItemData(
@RequestPart(value = "request") @Valid TestRequestDTO.setItemDTO request,
@RequestPart(value = "itemThumbnail") MultipartFile itemThumbnail,
@RequestPart(value = "itemImgList", required = false) List<MultipartFile> itemImgList,
@RequestPart(value = "sellerProfile") MultipartFile sellerProfile
@RequestPart(value = "itemImgList", required = false) List<MultipartFile> itemImgList
//@RequestPart(value = "sellerProfile") MultipartFile sellerProfile
) {
log.info("=========================== ํšŒ์› ์ฐพ๊ธฐ ์‹œ์ž‘ =======================");

Expand All @@ -52,18 +52,19 @@ public ApiResponse<TestResponseDTO.addItemDTO> setItemData(
termAgreeList.add(true);
termAgreeList.add(true);
termAgreeList.add(true);
termAgreeList.add(true);


// ์„ ํ˜ธ ์นดํ…Œ๊ณ ๋ฆฌ ๋žœ๋ค ์„ค์ •
List<Long> memberCategoryList = new ArrayList<>();
long leftLimit = 1L;
long rightLimit = 6L;
long rightLimit = 4L;
long generatedLong = leftLimit + (long) (Math.random() * (rightLimit - leftLimit));
memberCategoryList.add(generatedLong);

// ํšŒ์› ๊ฐ€์ž…
TestRequestDTO.setMemberDTO sellerDTO = new TestRequestDTO.setMemberDTO(request.sellerName, request.itemUuid, termAgreeList, memberCategoryList);
seller = testCommandService.addMember(sellerDTO, sellerProfile);
seller = testCommandService.addMember(sellerDTO);
} else {
log.info("=========================== ๋‹‰๋„ค์ž„์œผ๋กœ ํšŒ์› ์ฐพ์Œ ================================");

Expand Down Expand Up @@ -97,8 +98,8 @@ public String setTestData() {
List<Boolean> termAgreeList = new ArrayList<>();
termAgreeList.add(true);

MemberRequestDTO.JoinDTO joinBuyerDTO = new MemberRequestDTO.JoinDTO("๊ตฌ๋งค์ž ํ…Œ์ŠคํŠธ ๊ณ„์ •","ํ…Œ์ŠคํŠธ", "12345678", "[email protected]", date, "01012345678", Gender.MALE, termAgreeList);
MemberRequestDTO.JoinDTO noLoginUserDTO = new MemberRequestDTO.JoinDTO("no_login_user","๋น„ํšŒ์›", "12345678", "[email protected]", date, "01087654321", Gender.MALE, termAgreeList);
MemberRequestDTO.JoinDTO joinBuyerDTO = new MemberRequestDTO.JoinDTO("๊ตฌ๋งค์ž ํ…Œ์ŠคํŠธ ๊ณ„์ •", "ํ…Œ์ŠคํŠธ", "12345678", "[email protected]", date, "01012345678", Gender.MALE, termAgreeList);
MemberRequestDTO.JoinDTO noLoginUserDTO = new MemberRequestDTO.JoinDTO("no_login_user", "๋น„ํšŒ์›", "12345678", "[email protected]", date, "01087654321", Gender.MALE, termAgreeList);


memberCommandService.join(joinBuyerDTO);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/umc/TheGoods/test/TestConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static Member toTestMember(TestRequestDTO.setMemberDTO request, BCryptPas
return Member.builder()
.nickname(request.getNickname())
.password(encoder.encode("12345678"))
.email(request.getUuid() + "@gmail.com")
.email(request.getNickname() + "@gmail.com")
.birthday(date)
.gender(Gender.FEMALE)
.phone("01012345678")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

public interface TestCommandService {

Member addMember(TestRequestDTO.setMemberDTO request, MultipartFile multipartFile);
Member addMember(TestRequestDTO.setMemberDTO request);

Item addItem(Member member, TestRequestDTO.setItemDTO request, MultipartFile itemThumbnail, List<MultipartFile> itemImgList);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.umc.TheGoods.converter.item.ItemOptionConverter;
import com.umc.TheGoods.converter.member.MemberConverter;
import com.umc.TheGoods.domain.images.ItemImg;
import com.umc.TheGoods.domain.images.ProfileImg;
import com.umc.TheGoods.domain.item.Category;
import com.umc.TheGoods.domain.item.Item;
import com.umc.TheGoods.domain.item.ItemOption;
Expand Down Expand Up @@ -57,7 +56,7 @@ public class TestCommandServiceImpl implements TestCommandService {


@Override
public Member addMember(TestRequestDTO.setMemberDTO request, MultipartFile multipartFile) {
public Member addMember(TestRequestDTO.setMemberDTO request) {
// userName ์ค‘๋ณต ์ฒดํฌ
memberRepository.findByNickname(request.getNickname())
.ifPresent(user -> {
Expand All @@ -68,7 +67,6 @@ public Member addMember(TestRequestDTO.setMemberDTO request, MultipartFile multi
//์ €์žฅ
Member member = TestConverter.toTestMember(request, encoder);


// ์•ฝ๊ด€๋™์˜ ์ €์žฅ ๋กœ์ง
HashMap<Term, Boolean> termMap = new HashMap<>();
for (int i = 0; i < request.getMemberTerm().size(); i++) {
Expand All @@ -81,12 +79,6 @@ public Member addMember(TestRequestDTO.setMemberDTO request, MultipartFile multi
memberTerm.setMember(member);
});

String profileUrl = utilService.uploadS3Img("member", multipartFile);
ProfileImg profileImg = TestConverter.toProfileImg(profileUrl);
profileImg.setMember(member);

profileImgRepository.save(profileImg);

memberRepository.save(member);
return member;
}
Expand Down

0 comments on commit c240fbf

Please sign in to comment.