Skip to content
Merged

Dev #167

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
servers = {
@Server(url = "http://localhost:8080", description = "로컬 개발 서버"),
@Server(url = "http://valanserver.store:8080", description = "운영 서버 (prod)"),
@Server(url = "http://valanserver.store:8081", description = "개발 서버 (dev)"),
@Server(url = "http://valanserver.store/dev-server", description = "개발 서버 (dev)"),
@Server(url = "https://valanserver.store", description = "HTTPS 배포 서버")
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public ResponseEntity<VoteDetailResponse> getVoteDetail(@PathVariable("voteId")
@Operation(
summary = "투표 생성",
description = "새로운 투표와 해당 투표의 옵션을 생성합니다. 각 투표는 최대 4개의 옵션을 가질 수 있습니다. \n" +
" Category에는 ETC ,FOOD , LOVE 이 3가지만 올 수 있습니다. 내부에서 ENUM으로 처리됩니다."
" Category에는 FOOD, LOVE, BUY, SPORT, WORRY, ETC 이 6가지만 올 수 있습니다. 내부에서 ENUM으로 처리됩니다."
)
@PostMapping
public ResponseEntity<VoteCreateResponse> createVote(
Expand All @@ -169,8 +169,8 @@ public ResponseEntity<VoteCreateResponse> createVote(

@Operation(
summary = "카테고리별/정렬 방식별 투표 목록 조회",
description = "카테고리와 정렬 기준에 따라 투표 목록을 조회합니다. 'category' 파라미터는 'ETC', 'FOOD', 'LOVE', 'ALL' 중 하나를 받을 수 있으며, 'sort' 파라미터는 'popular' (인기순) 또는 'latest' (최신순) 중 하나를 받습니다. 페이징을 지원합니다. \n" +
" ALL은 대소문자 구분없이 String으로 내부에서 처리합니다. LOVE ,FOOD ,ETC는 enum 타입으로 내부에서 처리됩니다. 만약에 category와 sort 파라미터가 없다면 모두 기본값인 ALL 과 latest로 자동 처리됩니다.\n" +
description = "카테고리와 정렬 기준에 따라 투표 목록을 조회합니다. 'category' 파라미터는 'ALL', 'FOOD', 'LOVE', 'BUY', 'SPORT', 'WORRY', 'ETC' 중 하나를 받을 수 있으며, 'sort' 파라미터는 'popular' (인기순) 또는 'latest' (최신순) 중 하나를 받습니다. 페이징을 지원합니다. \n" +
" ALL은 대소문자 구분없이 String으로 내부에서 처리합니다. FOOD, LOVE, BUY, SPORT, WORRY, ETC는 enum 타입으로 내부에서 처리됩니다. 만약에 category와 sort 파라미터가 없다면 모두 기본값인 ALL 과 latest로 자동 처리됩니다.\n" +
" 그러나 category = , sort= 와 같이 =뒤에 비어있는 경우는 불가능합니다. 아예 존재하지 않을 경우만 기본값으로 설정됩니다."
)
@GetMapping
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package com.valanse.valanse.domain.enums;

public enum VoteCategory {
ALL, FOOD, LOVE, ETC // 연애, 음식, 기타
ALL, FOOD, LOVE, BUY, SPORT, WORRY, ETC // 연애, 음식, 살까말까, 스포츠, 고민상담, 기타
}
Original file line number Diff line number Diff line change
Expand Up @@ -458,13 +458,13 @@ private void validateVoteListRequest(String category, String sort, String cursor

private void validateCategory(String category) {
if (category == null || category.isBlank()) {
throw new ApiException("category는 ALL, FOOD, LOVE, ETC 중 하나여야 합니다.", HttpStatus.BAD_REQUEST);
throw new ApiException("category는 ALL, FOOD, LOVE, BUY, SPORT, WORRY, ETC 중 하나여야 합니다.", HttpStatus.BAD_REQUEST);
}

try {
VoteCategory.valueOf(category.toUpperCase());
} catch (IllegalArgumentException e) {
throw new ApiException("category는 ALL, FOOD, LOVE, ETC 중 하나여야 합니다.", HttpStatus.BAD_REQUEST);
throw new ApiException("category는 ALL, FOOD, LOVE, BUY, SPORT, WORRY, ETC 중 하나여야 합니다.", HttpStatus.BAD_REQUEST);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ void getVotes_InvalidCategory_ReturnsBadRequest() throws Exception {
.param("category", "INVALID")
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isBadRequest())
.andExpect(jsonPath("$.error").value("category는 ALL, FOOD, LOVE, ETC 중 하나여야 합니다."))
.andExpect(jsonPath("$.error").value("category는 ALL, FOOD, LOVE, BUY, SPORT, WORRY, ETC 중 하나여야 합니다."))
.andExpect(jsonPath("$.status").value(400));
}

Expand Down
Loading