Skip to content

Commit

Permalink
Merge pull request #145 from UMC-CommonPlant/feat/#74_Calendar
Browse files Browse the repository at this point in the history
[Chore] Calendar Swagger 수정
  • Loading branch information
sonshn authored Sep 5, 2024
2 parents 111fd95 + 5950768 commit 46afb37
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.umc.commonplant.domain.user.service.UserService;
import com.umc.commonplant.global.dto.JsonResponse;
import io.swagger.v3.core.util.Json;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
Expand All @@ -27,10 +28,15 @@ public class CalendarController implements CalendarSwagger {
private final JwtService jwtService;
private final UserService userService;

@Operation(hidden = true)
@GetMapping
public ResponseEntity<JsonResponse> getCalendarByDate(@RequestParam("year") String year,
@RequestParam("month") String month,
@RequestParam("day") String day) {
log.info("[API] getCalendarByMonth - 캘린더 조회 (일별)");

String uuid = jwtService.resolveToken();
User user = userService.getUser(uuid);

return ResponseEntity.ok(new JsonResponse(true, 200, "getCalendarByDate", null));
}
Expand All @@ -52,6 +58,7 @@ public ResponseEntity<JsonResponse> getCalendarByMonth(@RequestParam("year") Str
return ResponseEntity.ok(new JsonResponse(true, 200, "getCalendarByMonth", monthlyCalendar));
}

@Operation(hidden = true)
@GetMapping("/place")
public ResponseEntity<JsonResponse> getCalendarByPlace() {
String uuid = jwtService.resolveToken();
Expand All @@ -62,6 +69,7 @@ public ResponseEntity<JsonResponse> getCalendarByPlace() {
return ResponseEntity.ok(new JsonResponse(true, 200, "getPlaceList", placeList));
}

@Operation(hidden = true)
@GetMapping("/place/plant")
public ResponseEntity<JsonResponse> getCalendarByPlaceAndPlant(@RequestParam("code") String code) {
String uuid = jwtService.resolveToken();
Expand All @@ -72,6 +80,7 @@ public ResponseEntity<JsonResponse> getCalendarByPlaceAndPlant(@RequestParam("co
return ResponseEntity.ok(new JsonResponse(true, 200, "getPlantList", plantList));
}

@Operation(hidden = true)
@GetMapping("/place/plant/memo")
public ResponseEntity<JsonResponse> getCalendarByPlaceAndPlantAndMemo(@RequestParam("code") String code,
@RequestParam("plant") Long plantIdx) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,28 @@ public getMyCalendarEventRes(int parsedDate, boolean nextWatered, boolean prevWa
this.writeMemo = writeMemo;
}
}


/**
* 최종 My Calendar (By Date) Response
*/
@AllArgsConstructor
@NoArgsConstructor
@Getter
public static class getMyCalendarByDateRes {
private int year;
private int month;
private int day;

private List<getMyCalendarPlaceListRes> placesByDate;

@Builder
public getMyCalendarByDateRes(int year, int month, int day){
this.year = year;
this.month = month;
this.day = day;
}
}

/**
* My Calendar에 보여줄 Place 리스트
*/
Expand All @@ -61,6 +82,13 @@ public getMyCalendarEventRes(int parsedDate, boolean nextWatered, boolean prevWa
@Getter
public static class getMyCalendarPlaceListRes{
private String name;

private List<getMyCalendarPlantListRes> plantsByPlace;

@Builder
public getMyCalendarPlaceListRes(String name){
this.name = name;
}
}

/**
Expand All @@ -70,12 +98,16 @@ public static class getMyCalendarPlaceListRes{
@NoArgsConstructor
@Getter
public static class getMyCalendarPlantListRes{
private Long plantIdx;
private String plantName;
private String nickname;
private String imgUrl;

private List<getMyCalendarMemoRes> memosByPlant;

@Builder
public getMyCalendarPlantListRes(Plant plant){
this.plantIdx = plant.getPlantIdx();
this.plantName = plant.getPlantName();
this.nickname = plant.getNickname();
this.imgUrl = plant.getImgUrl();
Expand Down

0 comments on commit 46afb37

Please sign in to comment.