Skip to content

Commit

Permalink
Merge branch 'develop' into feature_add_withdraw_member_history
Browse files Browse the repository at this point in the history
  • Loading branch information
gunsight1 authored Feb 27, 2024
2 parents b0d7a9e + c2b64b9 commit ea8643f
Show file tree
Hide file tree
Showing 24 changed files with 581 additions and 344 deletions.
152 changes: 152 additions & 0 deletions controllerTester.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@


# Main-Controller API

### 배너정보조회
GET http://localhost:8080/banner


### 추천제품조회
GET http://localhost:8080/recommend-products


### 조회순
GET http://localhost:8080/products/rank?sortType=viewCnt-order



### 위반제품목록
GET http://localhost:8080/products/rank?sortType=violation-products

<> 2024-02-23T161552-3.200.json


### 추천순
GET http://localhost:8080/products/rank?sortType=recommend-order

<> 2024-02-23T161552-4.200.json


### 최신순
GET http://localhost:8080/products/rank?sortType=recent-order

<> 2024-02-23T161552-5.200.json


## Product API Test

### 제품리스트 조회
GET http://localhost:8080/products

<> 2024-02-23T161552-6.200.json


### 제품아이디로 제품조회
GET http://localhost:8080/product/5

<> 2024-02-23T161552-7.200.json

### 키워드로 제품 조회
GET http://localhost:8080/products/search?keyword=더클래스

<> 2024-02-23T161553.200.json
<> 2024-02-23T164752.201.json
<> 2024-02-23T163943.201.json


### 마이페이지 회원비밀번호 검증요청
GET http://localhost:8080/mypage/member/validate
Content-Type: application/json
Authorization: {{ authorization }}

{
"password": "zxcv1234"
}

<> 2024-02-23T164933.200.json


### 마이페이지 회원정보 수정요청
PUT http://localhost:8080/mypage/member
Authorization: {{ authorization }}
Content-Type: application/json

{
"gender": 2,
"age": 30
}

### 회원 세차정보(부가정보) 입력
POST http://localhost:8080/member/wash
Authorization: {{ authorization}}
Content-Type: application/json

{
"washCount": 59,
"monthlyExpense": 63,
"interest": 44
}

### 회원 차량정보(부가정보) 입력
POST http://localhost:8080/member/car
Content-Type: application/json
Authorization: {{ authorization }}

{
"carType": 11,
"carSize": 16,
"carColor": 21,
"drivingEnv": 36,
"parkingEnv": 40
}

### 마이페이지 차량정보 요청
GET http://localhost:8080/mypage/car
Authorization: {{ authorization }}


### 마이페이지 세차정보 요청
GET http://localhost:8080/mypage/wash
Authorization: {{authorization}}


### 세차장 정보조회

GET http://localhost:8080/washzones?minX=36.12&maxX= 36.88&minY=127.1&maxY=127.8&level=2

<> 2024-02-23T161554.201.json


### 세차장 키워드 검색
GET http://localhost:8080/washzones/search?keyword=워시존

<> 2024-02-23T161554-1.201.json


### 세차장 정보 등록

POST http://127.0.0.1:8080/washzones
Content-Type: application/json

{
"name" : "샘플 세차장",
"address": "서울특별시 봉은사역",
"latitude": 37.777,
"longitude": 127.0808
}


<> 2024-02-23T161554-2.201.json


### OCR 검색 기능

GET http://127.0.0.1:8080/products/CB19-12-1034

<> 2024-02-23T161554.200.json


#### 마이페이지 회원탈퇴 요청

DELETE http://localhost:8080/mypage/member
Authorization: {{authorization}}
5 changes: 5 additions & 0 deletions http-client.env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"dev": {
"authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3YXNocGVkaWEiLCJqdGkiOiJ0ZXN0MSIsImlhdCI6MTcwODkzNzM5NSwiZXhwIjoxNzA4OTk3Mzk1fQ.9wE0gyuTUxFdPYigLWprEiI35P0BbCvI49irZ3Gfp3E"
}}

34 changes: 34 additions & 0 deletions memberSetting.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
## MyPage API

### 마이페이지 테스트를 위한 회원가입#
POST http://localhost:8080/member/join
Content-Type: application/json

{
"id": "test1",
"password": "zxcv1234",
"email": "[email protected]",
"gender": "MALE",
"age": "AGE_20"
}

### 마이페이지 검증을 위한 로그인 #1
POST http://localhost:8080/member/login
Content-Type: application/json

{
"id": "test1",
"password": "zxcv1234"
}

<> 2024-02-23T164810.200.json
<> 2024-02-23T163953.200.json
<> 2024-02-23T161553-1.200.json


### 마이페이지 회원(내)정보
GET http://localhost:8080/mypage/member
Authorization: {{ authorization }}

<> 2024-02-23T164831.200.json
<> 2024-02-23T164011.200.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class AuthController {
@GetMapping("/reissuanceJWT")
public ResponseEntity<ApiResponse<AuthDto>> reissuanceJWT(HttpServletRequest request){

return ApiResponse.toResponseEntity(SUCCESS_REQUEST_REGENERATED_JWT, AuthDto.of(authService.generateTokenAndSaveAuth(request.getHeader("Authorization"))));
return ApiResponse.toResponseEntity(SUCCESS_REQUEST_REGENERATED_JWT,
AuthDto.of(authService.generateTokenAndSaveAuth(request.getHeader("Authorization"))));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import org.springframework.web.servlet.HandlerInterceptor;

@Component
Expand All @@ -19,11 +20,11 @@ public boolean preHandle(HttpServletRequest request, HttpServletResponse respons
boolean result = true;
String requestToken = request.getHeader("Authorization");

if (requestToken.length() == 0) { throw new BusinessException(AcceptInterceptorErrorCode.DOSE_NOT_EXIST_REQUEST_TOKEN); }
if (!StringUtils.hasLength(requestToken)) { throw new BusinessException(AcceptInterceptorErrorCode.DOSE_NOT_EXIST_REQUEST_TOKEN); }

if (!authService.validRequestToken(requestToken)) { throw new BusinessException(AcceptInterceptorErrorCode.FAILED_VALID_REQUEST_TOKEN); }

//IP수집 후 테이블에 저장
// TODO:: IP 수집 후 테이블에 저장 -> 토큰 갱신 요청시 확인해서 토큰 재발급

return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class InterceptorConfig implements WebMvcConfigurer {
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(acceptInterceptor)
.addPathPatterns("/auth/validToken");
.addPathPatterns("/auth/**");
// .addPathPatterns("/mypage/**");
//.excludePathPatterns("/public/**"); // 제외할 URL 패턴
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import com.kernel360.likes.code.LikeErrorCode;
import com.kernel360.likes.entity.Like;
import com.kernel360.likes.repository.LikeRepository;
import com.kernel360.main.code.ProductsErrorCode;
import com.kernel360.member.service.MemberService;
import com.kernel360.product.code.ProductsErrorCode;
import com.kernel360.product.dto.ProductDto;
import com.kernel360.product.entity.Product;
import com.kernel360.product.repository.ProductRepository;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.kernel360.main.controller;

import com.kernel360.main.code.BannerBusinessCode;
import com.kernel360.main.code.ProductsBusinessCode;
import com.kernel360.main.dto.BannerDto;
import com.kernel360.main.dto.RecommendProductsDto;
import com.kernel360.main.service.MainService;
import com.kernel360.product.code.ProductsBusinessCode;
import com.kernel360.product.dto.ProductDto;
import com.kernel360.product.service.ProductService;
import com.kernel360.response.ApiResponse;
Expand All @@ -21,7 +21,7 @@
@RestController
@RequestMapping
@RequiredArgsConstructor
public class MainContoller {
public class MainController {
private final ProductService productService;
private final MainService mainService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public enum MemberBusinessCode implements BusinessCode {
SUCCESS_REQUEST_RESET_PASSWORD(HttpStatus.OK.value(), "BMC014", "비밀번호가 초기화되었습니다."),
SUCCESS_REQUEST_LOGIN_MEMBER_KAKAO(HttpStatus.OK.value(), "BMC015", "로그인 성공"),
SUCCESS_REQUEST_SIGN_OUT_MEMBER(HttpStatus.OK.value(), "BMC016", "회원탈퇴 성공");

SUCCESS_FIND_WASH_INFO_IN_MEMBER(HttpStatus.OK.value(), "BMC017","세차정보 조회 성공");

private final int status;
private final String code;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,24 @@
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;

import java.util.EnumSet;

@RequiredArgsConstructor
public enum MemberErrorCode implements ErrorCode {

FAILED_NOT_MAPPING_ORDINAL_TO_NAME(HttpStatus.INTERNAL_SERVER_ERROR.value(), "EMC001", "DB값과 ENUM의 ORDINAL이 불일치하여 NAME을 찾을 수 없음."),
FAILED_NOT_MAPPING_ORDINAL_TO_VALUE(HttpStatus.INTERNAL_SERVER_ERROR.value(), "EMC002", "DB값과 ENUM의 VALUE가 불일치하여 VALUE을 찾을 수 없음."),
FAILED_NOT_MAPPING_ENUM_VALUEOF(HttpStatus.INTERNAL_SERVER_ERROR.value(), "EMC003", "PARAMETER 값과 ENUM의 NAME이 불일치함."),
FAILED_NOT_MAPPING_ENUM_VALUE_OF(HttpStatus.INTERNAL_SERVER_ERROR.value(), "EMC003", "PARAMETER 값과 ENUM의 NAME이 불일치함."),
FAILED_GENERATE_JOIN_MEMBER_INFO(HttpStatus.INTERNAL_SERVER_ERROR.value(), "EMC004", "회원가입에 필요한 정보 생성 실패"),
FAILED_GENERATE_LOGIN_REQUEST_INFO(HttpStatus.INTERNAL_SERVER_ERROR.value(), "EMC005", "정보 불일치로 인한 로그인 정보 생성 실패"),
FAILED_REQUEST_LOGIN(HttpStatus.BAD_REQUEST.value(), "EMC006", "정보 불일치로 인한 로그인 실패"),
FAILED_FIND_MEMBER_INFO(HttpStatus.BAD_REQUEST.value(), "EMC007", "요청 회원정보가 존재하지 않습니다."),
EXPIRED_PASSWORD_RESET_TOKEN(HttpStatus.NOT_FOUND.value(), "EMC008", "유효하지 않은 비밀번호 초기화 토큰입니다"),
FAILED_REQUEST_LOGIN_FOR_KAKAO(HttpStatus.BAD_REQUEST.value(), "EMC009", "카카오 로그인 정보를 찾을 수 없습니다.");
FAILED_REQUEST_LOGIN_FOR_KAKAO(HttpStatus.BAD_REQUEST.value(), "EMC009", "카카오 로그인 정보를 찾을 수 없습니다."),
FAILED_FIND_MEMBER_CAR_INFO(HttpStatus.BAD_REQUEST.value(), "EMC010", "요청 회원의 차량정보가 존재하지 않습니다."),
FAILED_FIND_MEMBER_WASH_INFO(HttpStatus.BAD_REQUEST.value(), "EMC011", "요청 회원의 세차정보가 존재하지 않습니다."),
WRONG_PASSWORD_REQUEST(HttpStatus.BAD_REQUEST.value(), "EMC012", "잘못된 비밀번호 입니다."),
FAILED_DUPLICATED_JOIN_MEMBER_INFO(HttpStatus.BAD_REQUEST.value(), "EMC013", "동일한 아이디로 가입한 회원이 이미 존재합니다.");

private final int status;
private final String code;
Expand Down
24 changes: 3 additions & 21 deletions module-api/src/main/java/com/kernel360/member/dto/MemberInfo.java
Original file line number Diff line number Diff line change
@@ -1,28 +1,10 @@
package com.kernel360.member.dto;

import com.kernel360.member.entity.Member;

public record MemberInfo(String id,
String email,


public record MemberInfo(
int gender,
int age
) {
static MemberInfo of(
String id,
String email,
int gender,
int age
) {
return new MemberInfo(id, email, gender, age);
}

public Member toEntity() {
return Member.of(
this.id,
this.email,
this.gender,
this.age

);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.kernel360.member.dto;

public record PasswordDto(
String password
) {
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package com.kernel360.member.dto;


import com.kernel360.carinfo.entity.CarInfo;
import com.kernel360.member.entity.Member;
import com.kernel360.washinfo.entity.WashInfo;


public record WashInfoDto(
Integer washNo,
Integer washCount,
Expand Down Expand Up @@ -34,13 +33,13 @@ public WashInfo toEntity() {
);
}

public CarInfoDto from(CarInfo entity) {
return CarInfoDto.of(
entity.getCarType(),
entity.getCarSize(),
entity.getCarColor(),
entity.getDrivingEnv(),
entity.getParkingEnv()
public static WashInfoDto from(WashInfo entity) {

return WashInfoDto.of(
entity.getWashNo(),
entity.getWashCount(),
entity.getMonthlyExpense(),
entity.getInterest()
);
}
}
Loading

0 comments on commit ea8643f

Please sign in to comment.