From 68bd1e948d428f737252444eec753d7220dd1743 Mon Sep 17 00:00:00 2001 From: thguss Date: Thu, 11 Jan 2024 16:46:44 +0900 Subject: [PATCH] =?UTF-8?q?[FIX]=20=ED=85=8C=EC=8A=A4=ED=8A=B8=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EB=88=84=EB=9D=BD=20=ED=95=B4=EA=B2=B0:=20?= =?UTF-8?q?=EC=8B=9D=EB=B3=84=EC=9E=90=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MemberDailyRoutineController.java | 2 +- .../resources/static/docs/open-api-3.0.1.json | 247 ++++++++++++++++-- .../MemberDailyRoutineControllerTest.java | 10 +- .../DailyRoutineControllerTest.java | 6 +- 4 files changed, 240 insertions(+), 25 deletions(-) diff --git a/src/main/java/com/soptie/server/memberRoutine/controller/MemberDailyRoutineController.java b/src/main/java/com/soptie/server/memberRoutine/controller/MemberDailyRoutineController.java index ca546be8..ba36892c 100644 --- a/src/main/java/com/soptie/server/memberRoutine/controller/MemberDailyRoutineController.java +++ b/src/main/java/com/soptie/server/memberRoutine/controller/MemberDailyRoutineController.java @@ -64,7 +64,7 @@ public ResponseEntity achieveMemberDailyRoutine(Principal principal, @ } @GetMapping - public ResponseEntity getMemberDailyRoutine(Principal principal) { + public ResponseEntity getMemberDailyRoutines(Principal principal) { val memberId = Long.parseLong(principal.getName()); val response = memberDailyRoutineService.getMemberDailyRoutines(memberId); return ResponseEntity.ok(success(SUCCESS_GET_ROUTINE.getMessage(), response)); diff --git a/src/main/resources/static/docs/open-api-3.0.1.json b/src/main/resources/static/docs/open-api-3.0.1.json index e4efc692..fccc75a0 100644 --- a/src/main/resources/static/docs/open-api-3.0.1.json +++ b/src/main/resources/static/docs/open-api-3.0.1.json @@ -34,7 +34,7 @@ }, "examples" : { "post-token-docs" : { - "value" : "{\r\n \"socialType\" : \"KAKAO\"\r\n}" + "value" : "{\n \"socialType\" : \"KAKAO\"\n}" } } } @@ -50,7 +50,7 @@ }, "examples" : { "post-token-docs" : { - "value" : "{\r\n \"success\" : true,\r\n \"message\" : \"소셜로그인 성공\",\r\n \"data\" : {\r\n \"accessToken\" : \"softie\",\r\n \"refreshToken\" : \"token\"\r\n }\r\n}" + "value" : "{\n \"success\" : true,\n \"message\" : \"소셜로그인 성공\",\n \"data\" : {\n \"accessToken\" : \"softie\",\n \"refreshToken\" : \"token\"\n }\n}" } } } @@ -84,6 +84,40 @@ } } }, + "/api/v1/routines/daily" : { + "get" : { + "tags" : [ "DAILY ROUTINE" ], + "summary" : "테마 리스트 별 데일리 루틴 리스트 조회", + "description" : "테마 리스트 별 데일리 루틴 리스트 조회", + "operationId" : "get-themes-daily-routines-docs", + "parameters" : [ { + "name" : "themes", + "in" : "query", + "description" : "조회할 테마 id 정보", + "required" : true, + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "200" : { + "description" : "200", + "content" : { + "application/json;charset=UTF-8" : { + "schema" : { + "$ref" : "#/components/schemas/api-v1-routines-daily-54531209" + }, + "examples" : { + "get-themes-daily-routines-docs" : { + "value" : "{\n \"success\" : true,\n \"message\" : \"루틴 조회 성공\",\n \"data\" : {\n \"routines\" : [ {\n \"routineId\" : 0,\n \"content\" : \"content0\"\n }, {\n \"routineId\" : 1,\n \"content\" : \"content1\"\n }, {\n \"routineId\" : 2,\n \"content\" : \"content2\"\n }, {\n \"routineId\" : 3,\n \"content\" : \"content3\"\n }, {\n \"routineId\" : 4,\n \"content\" : \"content4\"\n } ]\n }\n}" + } + } + } + } + } + } + } + }, "/api/v1/dolls/image/{type}" : { "get" : { "tags" : [ "DOLL" ], @@ -109,7 +143,7 @@ }, "examples" : { "get-doll-image-docs" : { - "value" : "{\r\n \"success\" : true,\r\n \"message\" : \"인형 이미지 조회 성공\",\r\n \"data\" : {\r\n \"faceImageUrl\" : \"face-image-url\"\r\n }\r\n}" + "value" : "{\n \"success\" : true,\n \"message\" : \"인형 이미지 조회 성공\",\n \"data\" : {\n \"faceImageUrl\" : \"face-image-url\"\n }\n}" } } } @@ -119,11 +153,34 @@ } }, "/api/v1/routines/daily/member" : { + "get" : { + "tags" : [ "MEMBER DAILY ROUTINE" ], + "summary" : "회원 별 데일리 루틴 리스트 조회", + "description" : "회원 별 데일리 루틴 리스트 조회", + "operationId" : "get-member-daily-routines-docs", + "responses" : { + "200" : { + "description" : "200", + "content" : { + "application/json;charset=UTF-8" : { + "schema" : { + "$ref" : "#/components/schemas/api-v1-routines-daily-member-336344243" + }, + "examples" : { + "get-member-daily-routines-docs" : { + "value" : "{\n \"success\" : true,\n \"message\" : \"루틴 조회 성공\",\n \"data\" : {\n \"routines\" : [ {\n \"routineId\" : 1,\n \"content\" : \"content-test\",\n \"iconImageUrl\" : \"image-url\",\n \"achieveCount\" : 1,\n \"isAchieve\" : false\n }, {\n \"routineId\" : 2,\n \"content\" : \"content-test\",\n \"iconImageUrl\" : \"image-url\",\n \"achieveCount\" : 2,\n \"isAchieve\" : true\n }, {\n \"routineId\" : 3,\n \"content\" : \"content-test\",\n \"iconImageUrl\" : \"image-url\",\n \"achieveCount\" : 3,\n \"isAchieve\" : false\n }, {\n \"routineId\" : 4,\n \"content\" : \"content-test\",\n \"iconImageUrl\" : \"image-url\",\n \"achieveCount\" : 4,\n \"isAchieve\" : true\n }, {\n \"routineId\" : 5,\n \"content\" : \"content-test\",\n \"iconImageUrl\" : \"image-url\",\n \"achieveCount\" : 5,\n \"isAchieve\" : false\n } ]\n }\n}" + } + } + } + } + } + } + }, "post" : { "tags" : [ "MEMBER DAILY ROUTINE" ], "summary" : "회원 데일리 루틴 추가 성공", "description" : "회원 데일리 루틴 추가 성공", - "operationId" : "post-routine-docs", + "operationId" : "post-member-daily-routine-docs", "requestBody" : { "content" : { "application/json;charset=UTF-8" : { @@ -131,8 +188,8 @@ "$ref" : "#/components/schemas/api-v1-routines-daily-member1721287602" }, "examples" : { - "post-routine-docs" : { - "value" : "{\r\n \"routineId\" : 1\r\n}" + "post-member-daily-routine-docs" : { + "value" : "{\n \"routineId\" : 1\n}" } } } @@ -155,8 +212,8 @@ "$ref" : "#/components/schemas/api-v1-routines-daily-member1327124516" }, "examples" : { - "post-routine-docs" : { - "value" : "{\r\n \"success\" : true,\r\n \"message\" : \"루틴 추가 성공\",\r\n \"data\" : {\r\n \"routineId\" : 1\r\n }\r\n}" + "post-member-daily-routine-docs" : { + "value" : "{\n \"success\" : true,\n \"message\" : \"루틴 추가 성공\",\n \"data\" : {\n \"routineId\" : 1\n }\n}" } } } @@ -170,7 +227,7 @@ "tags" : [ "DAILY ROUTINE" ], "summary" : "데일리 루틴 테마 리스트 조회", "description" : "데일리 루틴 테마 리스트 조회", - "operationId" : "get-themes-docs", + "operationId" : "get-daily-themes-docs", "responses" : { "200" : { "description" : "200", @@ -180,8 +237,8 @@ "$ref" : "#/components/schemas/api-v1-routines-daily-themes1975236624" }, "examples" : { - "get-themes-docs" : { - "value" : "{\r\n \"success\" : true,\r\n \"message\" : \"테마 조회 성공\",\r\n \"data\" : {\r\n \"themes\" : [ {\r\n \"themeId\" : 0,\r\n \"name\" : \"Daily routine Theme0\",\r\n \"iconImageUrl\" : \"icon_image_url0\",\r\n \"backgroundImageUrl\" : \"background_image_url0\"\r\n }, {\r\n \"themeId\" : 1,\r\n \"name\" : \"Daily routine Theme1\",\r\n \"iconImageUrl\" : \"icon_image_url1\",\r\n \"backgroundImageUrl\" : \"background_image_url1\"\r\n }, {\r\n \"themeId\" : 2,\r\n \"name\" : \"Daily routine Theme2\",\r\n \"iconImageUrl\" : \"icon_image_url2\",\r\n \"backgroundImageUrl\" : \"background_image_url2\"\r\n }, {\r\n \"themeId\" : 3,\r\n \"name\" : \"Daily routine Theme3\",\r\n \"iconImageUrl\" : \"icon_image_url3\",\r\n \"backgroundImageUrl\" : \"background_image_url3\"\r\n }, {\r\n \"themeId\" : 4,\r\n \"name\" : \"Daily routine Theme4\",\r\n \"iconImageUrl\" : \"icon_image_url4\",\r\n \"backgroundImageUrl\" : \"background_image_url4\"\r\n } ]\r\n }\r\n}" + "get-daily-themes-docs" : { + "value" : "{\n \"success\" : true,\n \"message\" : \"테마 조회 성공\",\n \"data\" : {\n \"themes\" : [ {\n \"themeId\" : 0,\n \"name\" : \"Daily routine Theme0\",\n \"iconImageUrl\" : \"icon_image_url0\",\n \"backgroundImageUrl\" : \"background_image_url0\"\n }, {\n \"themeId\" : 1,\n \"name\" : \"Daily routine Theme1\",\n \"iconImageUrl\" : \"icon_image_url1\",\n \"backgroundImageUrl\" : \"background_image_url1\"\n }, {\n \"themeId\" : 2,\n \"name\" : \"Daily routine Theme2\",\n \"iconImageUrl\" : \"icon_image_url2\",\n \"backgroundImageUrl\" : \"background_image_url2\"\n }, {\n \"themeId\" : 3,\n \"name\" : \"Daily routine Theme3\",\n \"iconImageUrl\" : \"icon_image_url3\",\n \"backgroundImageUrl\" : \"background_image_url3\"\n }, {\n \"themeId\" : 4,\n \"name\" : \"Daily routine Theme4\",\n \"iconImageUrl\" : \"icon_image_url4\",\n \"backgroundImageUrl\" : \"background_image_url4\"\n } ]\n }\n}" } } } @@ -195,7 +252,7 @@ "tags" : [ "DAILY ROUTINE" ], "summary" : "테마 별 데일리 루틴 리스트 조회", "description" : "테마 별 데일리 루틴 리스트 조회", - "operationId" : "get-routines-docs", + "operationId" : "get-theme-daily-routines-docs", "parameters" : [ { "name" : "themeId", "in" : "path", @@ -211,11 +268,77 @@ "content" : { "application/json;charset=UTF-8" : { "schema" : { - "$ref" : "#/components/schemas/api-v1-routines-daily-themeId-54531209" + "$ref" : "#/components/schemas/api-v1-routines-daily-54531209" + }, + "examples" : { + "get-theme-daily-routines-docs" : { + "value" : "{\n \"success\" : true,\n \"message\" : \"루틴 조회 성공\",\n \"data\" : {\n \"routines\" : [ {\n \"routineId\" : 0,\n \"content\" : \"content0\"\n }, {\n \"routineId\" : 1,\n \"content\" : \"content1\"\n }, {\n \"routineId\" : 2,\n \"content\" : \"content2\"\n }, {\n \"routineId\" : 3,\n \"content\" : \"content3\"\n }, {\n \"routineId\" : 4,\n \"content\" : \"content4\"\n } ]\n }\n}" + } + } + } + } + } + } + } + }, + "/api/v1/routines/daily/member/routine/{routineId}" : { + "delete" : { + "tags" : [ "MEMBER DAILY ROUTINE" ], + "summary" : "회원 데일리 루틴 삭제 성공", + "description" : "회원 데일리 루틴 삭제 성공", + "operationId" : "delete-member-daily-routine-docs", + "parameters" : [ { + "name" : "routineId", + "in" : "path", + "description" : "루틴 id", + "required" : true, + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "200" : { + "description" : "200", + "content" : { + "application/json;charset=UTF-8" : { + "schema" : { + "$ref" : "#/components/schemas/api-v1-routines-daily-member-routine-routineId594740350" + }, + "examples" : { + "delete-member-daily-routine-docs" : { + "value" : "{\n \"success\" : true,\n \"message\" : \"루틴 삭제 성공\",\n \"data\" : null\n}" + } + } + } + } + } + } + }, + "patch" : { + "tags" : [ "MEMBER DAILY ROUTINE" ], + "summary" : "회원 데일리 루틴 달성 성공", + "description" : "회원 데일리 루틴 달성 성공", + "operationId" : "achieve-member-daily-routine-docs", + "parameters" : [ { + "name" : "routineId", + "in" : "path", + "description" : "루틴 id", + "required" : true, + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "200" : { + "description" : "200", + "content" : { + "application/json;charset=UTF-8" : { + "schema" : { + "$ref" : "#/components/schemas/api-v1-routines-daily-member-routine-routineId-2021368021" }, "examples" : { - "get-routines-docs" : { - "value" : "{\r\n \"success\" : true,\r\n \"message\" : \"루틴 조회 성공\",\r\n \"data\" : {\r\n \"routines\" : [ {\r\n \"routineId\" : 0,\r\n \"content\" : \"content0\"\r\n }, {\r\n \"routineId\" : 1,\r\n \"content\" : \"content1\"\r\n }, {\r\n \"routineId\" : 2,\r\n \"content\" : \"content2\"\r\n }, {\r\n \"routineId\" : 3,\r\n \"content\" : \"content3\"\r\n }, {\r\n \"routineId\" : 4,\r\n \"content\" : \"content4\"\r\n } ]\r\n }\r\n}" + "achieve-member-daily-routine-docs" : { + "value" : "{\n \"success\" : true,\n \"message\" : \"루틴 달성 성공\",\n \"data\" : {\n \"routineId\" : 1,\n \"isAchieve\" : true,\n \"achieveCount\" : 1\n }\n}" } } } @@ -254,7 +377,7 @@ } } }, - "api-v1-routines-daily-themeId-54531209" : { + "api-v1-routines-daily-54531209" : { "type" : "object", "properties" : { "data" : { @@ -343,6 +466,19 @@ } } }, + "api-v1-routines-daily-member-routine-routineId594740350" : { + "type" : "object", + "properties" : { + "success" : { + "type" : "boolean", + "description" : "응답 성공 여부" + }, + "message" : { + "type" : "string", + "description" : "응답 메시지" + } + } + }, "api-v1-dolls-image-type-1785135499" : { "type" : "object", "properties" : { @@ -389,6 +525,54 @@ } } }, + "api-v1-routines-daily-member-336344243" : { + "type" : "object", + "properties" : { + "data" : { + "type" : "object", + "properties" : { + "routines" : { + "type" : "array", + "description" : "루틴 정보 리스트", + "items" : { + "type" : "object", + "properties" : { + "achieveCount" : { + "type" : "number", + "description" : "달성 횟수" + }, + "iconImageUrl" : { + "type" : "string", + "description" : "아이콘 이미지 url" + }, + "routineId" : { + "type" : "number", + "description" : "루틴 id" + }, + "content" : { + "type" : "string", + "description" : "테마 내용" + }, + "isAchieve" : { + "type" : "boolean", + "description" : "달성 여부" + } + } + } + } + }, + "description" : "응답 데이터" + }, + "success" : { + "type" : "boolean", + "description" : "응답 성공 여부" + }, + "message" : { + "type" : "string", + "description" : "응답 메시지" + } + } + }, "api-v1-auth-1040425838" : { "type" : "object", "properties" : { @@ -400,6 +584,37 @@ }, "api-v1-test486549215" : { "type" : "object" + }, + "api-v1-routines-daily-member-routine-routineId-2021368021" : { + "type" : "object", + "properties" : { + "data" : { + "type" : "object", + "properties" : { + "achieveCount" : { + "type" : "number", + "description" : "달성 횟수" + }, + "routineId" : { + "type" : "number", + "description" : "루틴 id" + }, + "isAchieve" : { + "type" : "boolean", + "description" : "달성 여부" + } + }, + "description" : "응답 데이터" + }, + "success" : { + "type" : "boolean", + "description" : "응답 성공 여부" + }, + "message" : { + "type" : "string", + "description" : "응답 메시지" + } + } } } } diff --git a/src/test/java/com/soptie/server/memberRoutine/controller/MemberDailyRoutineControllerTest.java b/src/test/java/com/soptie/server/memberRoutine/controller/MemberDailyRoutineControllerTest.java index 6ae41e6c..70aa621a 100644 --- a/src/test/java/com/soptie/server/memberRoutine/controller/MemberDailyRoutineControllerTest.java +++ b/src/test/java/com/soptie/server/memberRoutine/controller/MemberDailyRoutineControllerTest.java @@ -66,7 +66,7 @@ void success_createMemberDailyRoutine() throws Exception { .content(objectMapper.writeValueAsString(request)) ) .andDo( - document("post-routine-docs", + document("post-member-daily-routine-docs", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()), resource(ResourceSnippetParameters.builder() @@ -106,7 +106,7 @@ void success_deleteMemberDailyRoutine() throws Exception { .accept(APPLICATION_JSON) .principal(principal)) .andDo( - document("delete-routine-docs", + document("delete-member-daily-routine-docs", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()), resource(ResourceSnippetParameters.builder() @@ -144,7 +144,7 @@ void success_achieveMemberDailyRoutine() throws Exception { .accept(APPLICATION_JSON) .principal(principal)) .andDo( - document("ahieve-routine-docs", + document("achieve-member-daily-routine-docs", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()), resource(ResourceSnippetParameters.builder() @@ -175,7 +175,7 @@ void success_getMemberDailyRoutines() throws Exception { ResponseEntity response = ResponseEntity.ok(Response.success("루틴 조회 성공", routines)); // when - when(controller.getMemberDailyRoutine(principal)).thenReturn(response); + when(controller.getMemberDailyRoutines(principal)).thenReturn(response); // then mockMvc @@ -186,7 +186,7 @@ void success_getMemberDailyRoutines() throws Exception { .principal(principal)) .andDo( MockMvcRestDocumentation.document( - "get-routines-docs", + "get-member-daily-routines-docs", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()), resource( diff --git a/src/test/java/com/soptie/server/routine/controller/DailyRoutineControllerTest.java b/src/test/java/com/soptie/server/routine/controller/DailyRoutineControllerTest.java index 524dd3e6..f6c40cf1 100644 --- a/src/test/java/com/soptie/server/routine/controller/DailyRoutineControllerTest.java +++ b/src/test/java/com/soptie/server/routine/controller/DailyRoutineControllerTest.java @@ -53,7 +53,7 @@ void success_getDailyThemes() throws Exception { .accept(MediaType.APPLICATION_JSON)) .andDo( MockMvcRestDocumentation.document( - "get-themes-docs", + "get-daily-themes-docs", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()), resource( @@ -98,7 +98,7 @@ void success_getDailyRoutinesByThemes() throws Exception { .params(queries)) .andDo( MockMvcRestDocumentation.document( - "get-routines-docs", + "get-themes-daily-routines-docs", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()), resource( @@ -139,7 +139,7 @@ void success_getDailyRoutinesByTheme() throws Exception { .accept(MediaType.APPLICATION_JSON)) .andDo( MockMvcRestDocumentation.document( - "get-routines-docs", + "get-theme-daily-routines-docs", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()), resource(