Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] : 회원 가입 API 개선 #60

Merged
merged 10 commits into from
Mar 5, 2024
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ out/
core/src/main/resources/application.yml
application-core.yml
/api/src/main/resources/application.yml
core/src/main/generated/
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import org.springframework.web.bind.annotation.RestController;

import dev.handsup.auth.annotation.NoAuth;
import dev.handsup.user.dto.JoinUserApiRequest;
import dev.handsup.user.dto.UserApiMapper;
import dev.handsup.user.dto.request.EmailAvailibilityRequest;
import dev.handsup.user.dto.request.JoinUserRequest;
import dev.handsup.user.dto.response.EmailAvailabilityResponse;
Expand All @@ -32,10 +30,9 @@ public class UserApiController {
@Operation(summary = "회원가입 API", description = "회원가입을 한다")
@ApiResponse(useReturnTypeSchema = true)
public ResponseEntity<JoinUserResponse> join(
final @Valid @RequestBody JoinUserApiRequest request
final @Valid @RequestBody JoinUserRequest request
) {
JoinUserRequest joinUserRequest = UserApiMapper.toJoinUserRequest(request);
Long userId = userService.join(joinUserRequest);
Long userId = userService.join(request);
JoinUserResponse response = JoinUserResponse.from(userId);
return ResponseEntity.ok(response);
}
Expand Down
21 changes: 0 additions & 21 deletions api/src/main/java/dev/handsup/user/dto/UserApiMapper.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ void getAuctionDetail() throws Exception {
.andExpect(jsonPath("$.sellerId").value(user.getId()))
.andExpect(jsonPath("$.title").value(auction.getTitle()))
.andExpect(
jsonPath("$.productCategory").value(auction.getProduct().getProductCategory().getCategoryValue()))
jsonPath("$.productCategory").value(auction.getProduct().getProductCategory().getValue()))
.andExpect(jsonPath("$.initPrice").value(auction.getInitPrice()))
.andExpect(jsonPath("$.currentBiddingPrice").value(auction.getCurrentBiddingPrice()))
.andExpect(jsonPath("$.endDate").value(auction.getEndDate().toString()))
Expand Down
11 changes: 10 additions & 1 deletion api/src/test/java/dev/handsup/common/support/ApiTestSupport.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.springframework.http.MediaType.*;

import java.util.Arrays;
import java.util.List;

import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -16,7 +17,10 @@
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

import dev.handsup.auction.domain.product.product_category.ProductCategoryValue;
import dev.handsup.auction.domain.product.product_category.ProductCategory;
import dev.handsup.auction.repository.auction.AuctionRepository;
import dev.handsup.auction.repository.product.ProductCategoryRepository;
import dev.handsup.auth.dto.request.LoginRequest;
import dev.handsup.auth.dto.response.LoginSimpleResponse;
import dev.handsup.auth.exception.AuthErrorCode;
Expand Down Expand Up @@ -54,6 +58,8 @@ public abstract class ApiTestSupport extends TestContainerSupport {
protected AuctionRepository auctionRepository;
@Autowired
protected AuthService authService;
@Autowired
protected ProductCategoryRepository productCategoryRepository;

protected String toJson(Object object) throws JsonProcessingException {
return objectMapper.writeValueAsString(object);
Expand All @@ -73,9 +79,12 @@ public void setUpUser() throws Exception {
user.getAddress().getSi(),
user.getAddress().getGu(),
user.getAddress().getDong(),
user.getProfileImageUrl()
user.getProfileImageUrl(),
List.of(1L) // 선호 카테고리 id
);

productCategoryRepository.save(ProductCategory.of(ProductCategoryValue.BEAUTY_COSMETICS.getLabel()));

mockMvc.perform(
MockMvcRequestBuilders
.post("/api/users")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;

import java.util.List;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -27,7 +29,8 @@ class UserApiControllerTest extends ApiTestSupport {
user.getAddress().getSi(),
user.getAddress().getGu(),
user.getAddress().getDong(),
user.getProfileImageUrl()
user.getProfileImageUrl(),
List.of(1L)
);

@Autowired
Expand Down
84 changes: 0 additions & 84 deletions core/src/main/generated/dev/handsup/auction/domain/QAuction.java

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading