-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[FEAT] 캘린더 조회
- Loading branch information
Showing
35 changed files
with
727 additions
and
55 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
src/main/java/com/soptie/server/api/controller/CalendarApi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.soptie.server.api.controller; | ||
|
||
import java.security.Principal; | ||
import java.time.LocalDate; | ||
import java.util.Map; | ||
|
||
import org.springframework.http.HttpStatus; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.ResponseStatus; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import com.soptie.server.api.controller.docs.CalendarApiDocs; | ||
import com.soptie.server.api.controller.dto.response.SuccessResponse; | ||
import com.soptie.server.api.controller.dto.response.calendar.DateHistoryResponse; | ||
import com.soptie.server.api.controller.generic.SuccessMessage; | ||
import com.soptie.server.domain.calendar.CalendarService; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import lombok.val; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/api/v3/calendar") | ||
public class CalendarApi implements CalendarApiDocs { | ||
|
||
private final CalendarService calendarService; | ||
|
||
@ResponseStatus(HttpStatus.OK) | ||
@GetMapping | ||
public SuccessResponse<Map<LocalDate, DateHistoryResponse>> getCalendar( | ||
final Principal principal, | ||
@RequestParam final int year, | ||
@RequestParam final int month | ||
) { | ||
val memberId = Long.parseLong(principal.getName()); | ||
val response = calendarService.getCalendar(memberId, year, month); | ||
return SuccessResponse.success(SuccessMessage.GET_CALENDAR.getMessage(), response); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
src/main/java/com/soptie/server/api/controller/docs/CalendarApiDocs.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package com.soptie.server.api.controller.docs; | ||
|
||
import java.security.Principal; | ||
import java.time.LocalDate; | ||
import java.util.Map; | ||
|
||
import org.springframework.web.bind.annotation.RequestParam; | ||
|
||
import com.soptie.server.api.controller.dto.response.ErrorResponse; | ||
import com.soptie.server.api.controller.dto.response.SuccessResponse; | ||
import com.soptie.server.api.controller.dto.response.calendar.DateHistoryResponse; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.Parameter; | ||
import io.swagger.v3.oas.annotations.enums.ParameterIn; | ||
import io.swagger.v3.oas.annotations.media.Content; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
|
||
@Tag(name = "[Calendar] 캘린더 API Version3", description = "캘린더 API Version3") | ||
public interface CalendarApiDocs { | ||
|
||
@Operation( | ||
summary = "캘린더 조회", | ||
description = "루틴 달성 기록, 메모가 포함되어있는 캘린더를 조회한다.", | ||
responses = { | ||
@ApiResponse(responseCode = "200", description = "성공"), | ||
@ApiResponse( | ||
responseCode = "4xx", | ||
description = "클라이언트(요청) 오류", | ||
content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse( | ||
responseCode = "500", | ||
description = "서버 내부 오류", | ||
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))} | ||
) | ||
SuccessResponse<Map<LocalDate, DateHistoryResponse>> getCalendar( | ||
@Parameter(hidden = true) Principal principal, | ||
@Parameter( | ||
name = "year", | ||
description = "조회할 캘린더의 년도", | ||
in = ParameterIn.QUERY, | ||
required = true, | ||
example = "2024" | ||
) @RequestParam int year, | ||
@Parameter( | ||
name = "month", | ||
description = "조회할 캘린더의 월", | ||
in = ParameterIn.QUERY, | ||
required = true, | ||
example = "12" | ||
) @RequestParam int month | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 92 additions & 0 deletions
92
src/main/java/com/soptie/server/api/controller/docs/MemoApiDocs.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
package com.soptie.server.api.controller.docs; | ||
|
||
import java.security.Principal; | ||
|
||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
|
||
import com.soptie.server.api.controller.dto.request.memo.CreateMemoRequest; | ||
import com.soptie.server.api.controller.dto.request.memo.ModifyMemoRequest; | ||
import com.soptie.server.api.controller.dto.response.ErrorResponse; | ||
import com.soptie.server.api.controller.dto.response.SuccessResponse; | ||
import com.soptie.server.api.controller.dto.response.memo.CreateMemoResponse; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.Parameter; | ||
import io.swagger.v3.oas.annotations.enums.ParameterIn; | ||
import io.swagger.v3.oas.annotations.media.Content; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
|
||
@Tag(name = "[Memo] 메모 API Version3", description = "메모 API Version3") | ||
public interface MemoApiDocs { | ||
|
||
@Operation( | ||
summary = "메모 생성", | ||
description = "메모를 생성한다.", | ||
responses = { | ||
@ApiResponse(responseCode = "201", description = "CREATED Success"), | ||
@ApiResponse( | ||
responseCode = "4xx", | ||
description = "클라이언트(요청) 오류", | ||
content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse( | ||
responseCode = "500", | ||
description = "서버 내부 오류", | ||
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))} | ||
) | ||
SuccessResponse<CreateMemoResponse> createMemo( | ||
@Parameter(hidden = true) Principal principal, | ||
@RequestBody CreateMemoRequest request | ||
); | ||
|
||
@Operation( | ||
summary = "메모 수정", | ||
description = "메모를 수정한다.", | ||
responses = { | ||
@ApiResponse(responseCode = "200", description = "성공"), | ||
@ApiResponse( | ||
responseCode = "4xx", | ||
description = "클라이언트(요청) 오류", | ||
content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse( | ||
responseCode = "500", | ||
description = "서버 내부 오류", | ||
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))} | ||
) | ||
SuccessResponse<?> modifyMemo( | ||
@Parameter(hidden = true) Principal principal, | ||
@Parameter( | ||
name = "memoId", | ||
description = "수정할 메모 id", | ||
in = ParameterIn.PATH, | ||
example = "1" | ||
) @PathVariable final long memoId, | ||
@RequestBody ModifyMemoRequest request | ||
); | ||
|
||
@Operation( | ||
summary = "메모 삭제", | ||
description = "메모를 삭제한다.", | ||
responses = { | ||
@ApiResponse(responseCode = "200", description = "성공"), | ||
@ApiResponse( | ||
responseCode = "4xx", | ||
description = "클라이언트(요청) 오류", | ||
content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse( | ||
responseCode = "500", | ||
description = "서버 내부 오류", | ||
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))} | ||
) | ||
SuccessResponse<?> deleteMemo( | ||
@Parameter(hidden = true) Principal principal, | ||
@Parameter( | ||
name = "memoId", | ||
description = "삭제할 메모 id", | ||
in = ParameterIn.PATH, | ||
example = "1" | ||
) @PathVariable final long memoId | ||
); | ||
} |
Oops, something went wrong.