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

2023 11 04 release #273

Merged
merged 11 commits into from
Nov 4, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,11 @@ public enum CommonStatus implements BaseCode {
//INTERNAL_SERVER_ERROR
INTERNAL_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, 5000, "Internal server Error"),
//INTERNAL_SERVER_ERROR
FEIGN_CLIENT_ERROR_500(HttpStatus.INTERNAL_SERVER_ERROR, 5001, "Inter server Error in feign client");
FEIGN_CLIENT_ERROR_500(HttpStatus.INTERNAL_SERVER_ERROR, 5001, "Inter server Error in feign client"),

RECIPE_NOT_DELETED(HttpStatus.INTERNAL_SERVER_ERROR, 5100, "레시피가 삭제되지 않았습니다."),
COMMENT_NOT_DELETED(HttpStatus.INTERNAL_SERVER_ERROR, 5101, "댓글이 삭제되지 않았습니다."),
TEMP_RECIPE_NOT_DELETED(HttpStatus.INTERNAL_SERVER_ERROR, 5102, "임시저장 레시피가 삭제되지 않았습니다.");

private final HttpStatus httpStatus;
private final Integer code;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ public ResponseEntity onThrowException(GeneralException generalException,
@AuthenticationPrincipal User user, HttpServletRequest request) {
getExceptionStackTrace(generalException, user, request);
Reason errorReasonHttpStatus = generalException.getErrorReasonHttpStatus();
System.out.println(generalException.getMessage());
System.out.println(generalException.getCode());
return handleExceptionInternal(generalException,errorReasonHttpStatus,null,request);
}

Expand Down Expand Up @@ -157,6 +159,7 @@ private void getExceptionStackTrace(Exception e, @AuthenticationPrincipal User u
pw.append("uid: " + user.getUsername() + "\n");
}
pw.append(e.getMessage());
System.out.println(e.getMessage());
pw.append("\n=====================================================================");
log.error(sw.toString());
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/zipdabang/server/domain/member/Terms.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ public class Terms {

@OneToMany(mappedBy = "terms", cascade = CascadeType.ALL)
private List<TermsAgree> termsAgreeList;
}
}
2 changes: 1 addition & 1 deletion src/main/java/zipdabang/server/domain/recipe/Comment.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class Comment extends BaseEntity {
@Column(nullable = false)
private Long id;

@Column(columnDefinition = "TEXT")
@Column(columnDefinition = "TEXT", nullable = false)
private String content;

@ManyToOne(fetch = FetchType.LAZY)
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/zipdabang/server/domain/recipe/Recipe.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class Recipe extends BaseEntity {
@Column(nullable = false)
private Boolean isBarista;

@Column(nullable = false)
@Column(columnDefinition = "boolean default false", nullable = false)
private Boolean isOfficial;

@Column(nullable = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
import zipdabang.server.domain.recipe.RecipeCategory;

import java.util.List;
import java.util.Optional;

public interface RecipeCategoryRepository extends JpaRepository<RecipeCategory,Long> {

List<RecipeCategory> findAllById(Long categoryId);

Optional<RecipeCategory> findById(Long id);
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,16 @@ public List<Category> getAllCategories() {
public Boolean autoLoginService(String authorizationHeader) {

Boolean result = null;

log.info("root service에서 bearer 제거한 토큰 : {}", authorizationHeader);

if(authorizationHeader == null)
result = false;
else{
String token = authorizationHeader.substring(7);
Long memberId = tokenProvider.validateAndReturnSubject(token);

log.info("토큰 파싱 결과 : {}", memberId);
if (memberId.equals(0L))
result = true;
else if (memberId < 0L){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ public ResponseDto<RecipeResponseDto.TempRecipeInfoDto> getTempRecipe(@PathVaria
@ApiResponse(responseCode = "4052", description = "BAD_REQUEST, 사용자가 없습니다. 이 api에서 이거 생기면 백앤드 개발자 호출", content = @Content(schema = @Schema(implementation = ResponseDto.class))),
@ApiResponse(responseCode = "4111", description = "BAD_REQUEST, 해당 임시저장 Id가 존재하지 않습니다.", content = @Content(schema = @Schema(implementation = ResponseDto.class))),
@ApiResponse(responseCode = "5000", description = "SERVER ERROR, 백앤드 개발자에게 알려주세요", content = @Content(schema = @Schema(implementation = ResponseDto.class))),
@ApiResponse(responseCode = "5102", description = "SERVER ERROR, 임시저장 레시피가 삭제되지 않았습니다.", content = @Content(schema = @Schema(implementation = ResponseDto.class))),
})
@Parameters({
@Parameter(name = "member", hidden = true),
Expand All @@ -173,7 +174,7 @@ public ResponseDto<String> deleteTempRecipe(
if (recipeDeleteBoolean)
return ResponseDto.of(tempId + " 임시저장 레시피 삭제 완료");
else
throw new RecipeException(CommonStatus.INTERNAL_ERROR);
throw new RecipeException(CommonStatus.TEMP_RECIPE_NOT_DELETED);
}

@Operation(summary = "레시피 임시저장 ➡ 최종 저장 API 🔑 ✔", description = "\"레시피 임시저장 ➡ 최종 저장 API입니다. ")
Expand Down Expand Up @@ -269,6 +270,7 @@ public ResponseDto<RecipeResponseDto.RecipeInfoDto> recipeDetail(@PathVariable(n
@ApiResponse(responseCode = "4101", description = "BAD_REQUEST, 해당 recipeId를 가진 recipe가 없어요", content = @Content(schema = @Schema(implementation = ResponseDto.class))),
@ApiResponse(responseCode = "4106", description = "BAD_REQUEST, 본인이 작성한 레시피가 아닙니다. 삭제할 수 없습니다", content = @Content(schema = @Schema(implementation = ResponseDto.class))),
@ApiResponse(responseCode = "5000", description = "SERVER ERROR, 백앤드 개발자에게 알려주세요", content = @Content(schema = @Schema(implementation = ResponseDto.class))),
@ApiResponse(responseCode = "5100", description = "SERVER ERROR, 레시피가 삭제되지 않았습니다.", content = @Content(schema = @Schema(implementation = ResponseDto.class))),
})
@Parameters({
@Parameter(name = "member", hidden = true),
Expand All @@ -280,7 +282,7 @@ public ResponseDto<String> deleteRecipe(@PathVariable(name = "recipeId") Long re
if (recipeDeleteBoolean)
return ResponseDto.of(recipeId + " 레시피 삭제 완료");
else
throw new RecipeException(CommonStatus.INTERNAL_ERROR);
throw new RecipeException(CommonStatus.RECIPE_NOT_DELETED);
}

@Operation(summary = "🍹figma 레시피2, 레시피 검색 카테고리 별 preview 화면 API 🔑 ✔", description = "검색한 레시피 카테고리별 조회 화면 API입니다.")
Expand Down Expand Up @@ -837,6 +839,8 @@ else if (pageIndex < 1)
@ApiResponse(responseCode = "4108", description = "BAD_REQUEST, 본인이 작성한 댓글이 아닙니다. 삭제할 수 없습니다", content = @Content(schema = @Schema(implementation = ResponseDto.class))),
@ApiResponse(responseCode = "4112", description = "BAD_REQUEST, 해당 댓글은 넘겨준 레시피 Id에 존재하지 않습니다. 레시피 Id를 올바르게 보내주세요", content = @Content(schema = @Schema(implementation = ResponseDto.class))),
@ApiResponse(responseCode = "5000", description = "SERVER ERROR, 백앤드 개발자에게 알려주세요", content = @Content(schema = @Schema(implementation = ResponseDto.class))),
@ApiResponse(responseCode = "5101", description = "SERVER ERROR, 댓글이 삭제되지 않았습니다.", content = @Content(schema = @Schema(implementation = ResponseDto.class))),

})
@Parameters({
@Parameter(name = "member", hidden = true),
Expand All @@ -848,7 +852,7 @@ public ResponseDto<String> deleteComment(@PathVariable(name = "recipeId") Long r
if (commentDeleteBoolean)
return ResponseDto.of(commentId + " 댓글 삭제 완료");
else
throw new RecipeException(CommonStatus.INTERNAL_ERROR);
throw new RecipeException(CommonStatus.COMMENT_NOT_DELETED);
}

@Operation(summary = "댓글 수정 API 🔑 ✔", description = "댓글 수정 API입니다.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
Expand Down Expand Up @@ -36,6 +37,7 @@
@RestController
@Validated
@RequiredArgsConstructor
@Slf4j
@ApiResponses({
@ApiResponse(responseCode = "2000",description = "OK 성공"),
@ApiResponse(responseCode = "4003",description = "UNAUTHORIZED, 토큰 모양이 이상함, 토큰 제대로 주세요",content = @Content(schema = @Schema(implementation = ResponseDto.class))),
Expand Down Expand Up @@ -80,6 +82,8 @@ public ResponseDto<RootResponseDto.BannerImageDto> showBanners() {
})
@GetMapping("/auto-login")
public ResponseDto<BaseDto.BaseResponseDto> autoLogin(@RequestHeader(value = "Authorization", required = false) String authorizationHeader){

log.info("프론트가 보낸토큰 : {}", authorizationHeader);
Boolean autoResult = rootService.autoLoginService(authorizationHeader);
if(autoResult)
return ResponseDto.of(CommonStatus.AUTO_LOGIN_MAIN,null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,21 @@ public static class MemberInfoDto {

private List<Long> preferBeverages;

@Override
public String toString() {
return "MemberInfoDto{" +
"name='" + name + '\'' +
", birth='" + birth + '\'' +
", email='" + email + '\'' +
", gender='" + gender + '\'' +
", nickname='" + nickname + '\'' +
", phoneNum='" + phoneNum + '\'' +
", fcmToken='" + fcmToken + '\'' +
", serialNumber='" + serialNumber + '\'' +
", agreeTermsIdList=" + agreeTermsIdList +
", preferBeverages=" + preferBeverages +
'}';
}
}

@Getter
Expand Down
8 changes: 4 additions & 4 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ spring:
enabled: always

## # local redis
redis:
host: zipdabang-release.osattk.ng.0001.apn2.cache.amazonaws.com
redis:
host: zipdabang-release.osattk.ng.0001.apn2.cache.amazonaws.com

batch:
jdbc:
Expand All @@ -230,8 +230,8 @@ spring:
hbm2ddl:
auto: update
default_batch_fetch_size: 1000
show_sql: true
format_sql: true
# show_sql: true
# format_sql: true

logging:
level:
Expand Down
Loading