From ef09c3b36f5e24e66df3dc52d310b01fdb0300d9 Mon Sep 17 00:00:00 2001 From: choeseungbin Date: Tue, 16 Jan 2024 03:05:49 +0900 Subject: [PATCH 1/3] =?UTF-8?q?[TEST]=20=ED=96=89=EB=B3=B5=20=EB=A3=A8?= =?UTF-8?q?=ED=8B=B4=20=EC=B6=94=EA=B0=80=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/static/docs/open-api-3.0.1.json | 167 +++++++++++------- .../MemberHappinessRoutineControllerTest.java | 80 +++++++-- .../MemberHappinessRoutineFixture.java | 5 + 3 files changed, 176 insertions(+), 76 deletions(-) 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 633433fe..4389d484 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}" } } } @@ -69,11 +69,11 @@ "content" : { "application/json;charset=UTF-8" : { "schema" : { - "$ref" : "#/components/schemas/api-v1-members594740350" + "$ref" : "#/components/schemas/api-v1-auth594740350" }, "examples" : { "delete-withdrawal-docs" : { - "value" : "{\r\n \"success\" : true,\r\n \"message\" : \"회원 탈퇴 성공\",\r\n \"data\" : null\r\n}" + "value" : "{\n \"success\" : true,\n \"message\" : \"회원 탈퇴 성공\",\n \"data\" : null\n}" } } } @@ -98,7 +98,7 @@ }, "examples" : { "get-member-home-screen-docs" : { - "value" : "{\r\n \"success\" : true,\r\n \"message\" : \"홈 화면 불러오기 성공\",\r\n \"data\" : {\r\n \"name\" : \"softie\",\r\n \"dollType\" : \"BROWN\",\r\n \"frameImageUrl\" : \"frameImageUrl\",\r\n \"dailyCottonCount\" : 0,\r\n \"happinessCottonCount\" : 0,\r\n \"conversations\" : [ \"안녕\", \"하이\", \"봉쥬르\" ]\r\n }\r\n}" + "value" : "{\n \"success\" : true,\n \"message\" : \"홈 화면 불러오기 성공\",\n \"data\" : {\n \"name\" : \"softie\",\n \"dollType\" : \"BROWN\",\n \"frameImageUrl\" : \"frameImageUrl\",\n \"dailyCottonCount\" : 0,\n \"happinessCottonCount\" : 0,\n \"conversations\" : [ \"안녕\", \"하이\", \"봉쥬르\" ]\n }\n}" } } } @@ -119,7 +119,7 @@ }, "examples" : { "post-member-profile-docs" : { - "value" : "{\r\n \"dollType\" : \"BROWN\",\r\n \"name\" : \"소프티\",\r\n \"routines\" : [ 1, 2, 3 ]\r\n}" + "value" : "{\n \"dollType\" : \"BROWN\",\n \"name\" : \"소프티\",\n \"routines\" : [ 1, 2, 3 ]\n}" } } } @@ -139,11 +139,11 @@ "content" : { "application/json;charset=UTF-8" : { "schema" : { - "$ref" : "#/components/schemas/api-v1-members594740350" + "$ref" : "#/components/schemas/api-v1-auth594740350" }, "examples" : { "post-member-profile-docs" : { - "value" : "{\r\n \"success\" : true,\r\n \"message\" : \"프로필 생성 성공\",\r\n \"data\" : null\r\n}" + "value" : "{\n \"success\" : true,\n \"message\" : \"프로필 생성 성공\",\n \"data\" : null\n}" } } } @@ -189,11 +189,11 @@ "content" : { "application/json;charset=UTF-8" : { "schema" : { - "$ref" : "#/components/schemas/api-v1-members594740350" + "$ref" : "#/components/schemas/api-v1-auth594740350" }, "examples" : { "post-logout-docs" : { - "value" : "{\r\n \"success\" : true,\r\n \"message\" : \"로그아웃 성공\",\r\n \"data\" : null\r\n}" + "value" : "{\n \"success\" : true,\n \"message\" : \"로그아웃 성공\",\n \"data\" : null\n}" } } } @@ -227,7 +227,7 @@ }, "examples" : { "give-cotton-docs" : { - "value" : "{\r\n \"success\" : true,\r\n \"message\" : \"솜뭉치 주기 성공\",\r\n \"data\" : {\r\n \"cottonCount\" : 0\r\n }\r\n}" + "value" : "{\n \"success\" : true,\n \"message\" : \"솜뭉치 주기 성공\",\n \"data\" : {\n \"cottonCount\" : 0\n }\n}" } } } @@ -261,7 +261,7 @@ }, "examples" : { "get-themes-daily-routines-docs" : { - "value" : "{\r\n \"success\" : true,\r\n \"message\" : \"루틴 조회 성공\",\r\n \"data\" : {\r\n \"routines\" : [ {\r\n \"routineId\" : 1,\r\n \"content\" : \"Daily routine Content1\"\r\n }, {\r\n \"routineId\" : 2,\r\n \"content\" : \"Daily routine Content2\"\r\n }, {\r\n \"routineId\" : 3,\r\n \"content\" : \"Daily routine Content3\"\r\n }, {\r\n \"routineId\" : 4,\r\n \"content\" : \"Daily routine Content4\"\r\n }, {\r\n \"routineId\" : 5,\r\n \"content\" : \"Daily routine Content5\"\r\n } ]\r\n }\r\n}" + "value" : "{\n \"success\" : true,\n \"message\" : \"루틴 조회 성공\",\n \"data\" : {\n \"routines\" : [ {\n \"routineId\" : 1,\n \"content\" : \"Daily routine Content1\"\n }, {\n \"routineId\" : 2,\n \"content\" : \"Daily routine Content2\"\n }, {\n \"routineId\" : 3,\n \"content\" : \"Daily routine Content3\"\n }, {\n \"routineId\" : 4,\n \"content\" : \"Daily routine Content4\"\n }, {\n \"routineId\" : 5,\n \"content\" : \"Daily routine Content5\"\n } ]\n }\n}" } } } @@ -295,7 +295,7 @@ }, "examples" : { "get-theme-happiness-routines-docs" : { - "value" : "{\r\n \"success\" : true,\r\n \"message\" : \"루틴 조회 성공\",\r\n \"data\" : {\r\n \"routines\" : [ {\r\n \"routineId\" : 1,\r\n \"name\" : \"Happiness routine Theme1\",\r\n \"nameColor\" : \"Happiness routine Theme1\",\r\n \"title\" : \"Happiness routine Theme1\",\r\n \"iconImageUrl\" : \"icon_image_url1\"\r\n }, {\r\n \"routineId\" : 2,\r\n \"name\" : \"Happiness routine Theme2\",\r\n \"nameColor\" : \"Happiness routine Theme2\",\r\n \"title\" : \"Happiness routine Theme2\",\r\n \"iconImageUrl\" : \"icon_image_url2\"\r\n }, {\r\n \"routineId\" : 3,\r\n \"name\" : \"Happiness routine Theme3\",\r\n \"nameColor\" : \"Happiness routine Theme3\",\r\n \"title\" : \"Happiness routine Theme3\",\r\n \"iconImageUrl\" : \"icon_image_url3\"\r\n }, {\r\n \"routineId\" : 4,\r\n \"name\" : \"Happiness routine Theme4\",\r\n \"nameColor\" : \"Happiness routine Theme4\",\r\n \"title\" : \"Happiness routine Theme4\",\r\n \"iconImageUrl\" : \"icon_image_url4\"\r\n }, {\r\n \"routineId\" : 5,\r\n \"name\" : \"Happiness routine Theme5\",\r\n \"nameColor\" : \"Happiness routine Theme5\",\r\n \"title\" : \"Happiness routine Theme5\",\r\n \"iconImageUrl\" : \"icon_image_url5\"\r\n } ]\r\n }\r\n}" + "value" : "{\n \"success\" : true,\n \"message\" : \"루틴 조회 성공\",\n \"data\" : {\n \"routines\" : [ {\n \"routineId\" : 1,\n \"name\" : \"Happiness routine Theme1\",\n \"nameColor\" : \"Happiness routine Theme1\",\n \"title\" : \"Happiness routine Theme1\",\n \"iconImageUrl\" : \"icon_image_url1\"\n }, {\n \"routineId\" : 2,\n \"name\" : \"Happiness routine Theme2\",\n \"nameColor\" : \"Happiness routine Theme2\",\n \"title\" : \"Happiness routine Theme2\",\n \"iconImageUrl\" : \"icon_image_url2\"\n }, {\n \"routineId\" : 3,\n \"name\" : \"Happiness routine Theme3\",\n \"nameColor\" : \"Happiness routine Theme3\",\n \"title\" : \"Happiness routine Theme3\",\n \"iconImageUrl\" : \"icon_image_url3\"\n }, {\n \"routineId\" : 4,\n \"name\" : \"Happiness routine Theme4\",\n \"nameColor\" : \"Happiness routine Theme4\",\n \"title\" : \"Happiness routine Theme4\",\n \"iconImageUrl\" : \"icon_image_url4\"\n }, {\n \"routineId\" : 5,\n \"name\" : \"Happiness routine Theme5\",\n \"nameColor\" : \"Happiness routine Theme5\",\n \"title\" : \"Happiness routine Theme5\",\n \"iconImageUrl\" : \"icon_image_url5\"\n } ]\n }\n}" } } } @@ -329,7 +329,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}" } } } @@ -354,7 +354,7 @@ }, "examples" : { "get-member-daily-routines-docs" : { - "value" : "{\r\n \"success\" : true,\r\n \"message\" : \"루틴 조회 성공\",\r\n \"data\" : {\r\n \"routines\" : [ {\r\n \"routineId\" : 1,\r\n \"content\" : \"Daily routine Content1\",\r\n \"iconImageUrl\" : \"icon_image_url1\",\r\n \"achieveCount\" : 1,\r\n \"isAchieve\" : false\r\n }, {\r\n \"routineId\" : 2,\r\n \"content\" : \"Daily routine Content2\",\r\n \"iconImageUrl\" : \"icon_image_url2\",\r\n \"achieveCount\" : 2,\r\n \"isAchieve\" : true\r\n }, {\r\n \"routineId\" : 3,\r\n \"content\" : \"Daily routine Content3\",\r\n \"iconImageUrl\" : \"icon_image_url3\",\r\n \"achieveCount\" : 3,\r\n \"isAchieve\" : false\r\n }, {\r\n \"routineId\" : 4,\r\n \"content\" : \"Daily routine Content4\",\r\n \"iconImageUrl\" : \"icon_image_url4\",\r\n \"achieveCount\" : 4,\r\n \"isAchieve\" : true\r\n }, {\r\n \"routineId\" : 5,\r\n \"content\" : \"Daily routine Content5\",\r\n \"iconImageUrl\" : \"icon_image_url5\",\r\n \"achieveCount\" : 5,\r\n \"isAchieve\" : false\r\n } ]\r\n }\r\n}" + "value" : "{\n \"success\" : true,\n \"message\" : \"루틴 조회 성공\",\n \"data\" : {\n \"routines\" : [ {\n \"routineId\" : 1,\n \"content\" : \"Daily routine Content1\",\n \"iconImageUrl\" : \"icon_image_url1\",\n \"achieveCount\" : 1,\n \"isAchieve\" : false\n }, {\n \"routineId\" : 2,\n \"content\" : \"Daily routine Content2\",\n \"iconImageUrl\" : \"icon_image_url2\",\n \"achieveCount\" : 2,\n \"isAchieve\" : true\n }, {\n \"routineId\" : 3,\n \"content\" : \"Daily routine Content3\",\n \"iconImageUrl\" : \"icon_image_url3\",\n \"achieveCount\" : 3,\n \"isAchieve\" : false\n }, {\n \"routineId\" : 4,\n \"content\" : \"Daily routine Content4\",\n \"iconImageUrl\" : \"icon_image_url4\",\n \"achieveCount\" : 4,\n \"isAchieve\" : true\n }, {\n \"routineId\" : 5,\n \"content\" : \"Daily routine Content5\",\n \"iconImageUrl\" : \"icon_image_url5\",\n \"achieveCount\" : 5,\n \"isAchieve\" : false\n } ]\n }\n}" } } } @@ -375,7 +375,7 @@ }, "examples" : { "post-member-daily-routine-docs" : { - "value" : "{\r\n \"routineId\" : 1\r\n}" + "value" : "{\n \"routineId\" : 1\n}" } } } @@ -399,7 +399,7 @@ }, "examples" : { "post-member-daily-routine-docs" : { - "value" : "{\r\n \"success\" : true,\r\n \"message\" : \"루틴 추가 성공\",\r\n \"data\" : {\r\n \"routineId\" : 1\r\n }\r\n}" + "value" : "{\n \"success\" : true,\n \"message\" : \"루틴 추가 성공\",\n \"data\" : {\n \"routineId\" : 1\n }\n}" } } } @@ -424,7 +424,7 @@ }, "examples" : { "get-daily-themes-docs" : { - "value" : "{\r\n \"success\" : true,\r\n \"message\" : \"테마 조회 성공\",\r\n \"data\" : {\r\n \"themes\" : [ {\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 \"themeId\" : 5,\r\n \"name\" : \"Daily routine Theme5\",\r\n \"iconImageUrl\" : \"icon_image_url5\",\r\n \"backgroundImageUrl\" : \"background_image_url5\"\r\n } ]\r\n }\r\n}" + "value" : "{\n \"success\" : true,\n \"message\" : \"테마 조회 성공\",\n \"data\" : {\n \"themes\" : [ {\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 \"themeId\" : 5,\n \"name\" : \"Daily routine Theme5\",\n \"iconImageUrl\" : \"icon_image_url5\",\n \"backgroundImageUrl\" : \"background_image_url5\"\n } ]\n }\n}" } } } @@ -449,7 +449,52 @@ }, "examples" : { "get-member-happiness-routine-docs" : { - "value" : "{\r\n \"success\" : true,\r\n \"message\" : \"루틴 조회 성공\",\r\n \"data\" : {\r\n \"routineId\" : 1,\r\n \"iconImageUrl\" : \"icon-image-url\",\r\n \"contentImageUrl\" : \"content-image-url\",\r\n \"themeName\" : \"태마 이름\",\r\n \"themeNameColor\" : \"#ffcdc5\",\r\n \"title\" : \"루틴 제목\",\r\n \"content\" : \"routine-content\",\r\n \"detailContent\" : \"routine-detail-content\",\r\n \"place\" : \"루틴 장소\",\r\n \"timeTaken\" : \"5~10분 소요\"\r\n }\r\n}" + "value" : "{\n \"success\" : true,\n \"message\" : \"루틴 조회 성공\",\n \"data\" : {\n \"routineId\" : 1,\n \"iconImageUrl\" : \"icon-image-url\",\n \"contentImageUrl\" : \"content-image-url\",\n \"themeName\" : \"태마 이름\",\n \"themeNameColor\" : \"#ffcdc5\",\n \"title\" : \"루틴 제목\",\n \"content\" : \"routine-content\",\n \"detailContent\" : \"routine-detail-content\",\n \"place\" : \"루틴 장소\",\n \"timeTaken\" : \"5~10분 소요\"\n }\n}" + } + } + } + } + } + } + }, + "post" : { + "tags" : [ "MEMBER HAPPINESS ROUTINE" ], + "summary" : "회원 행복 루틴 추가 성공", + "description" : "회원 행복 루틴 추가 성공", + "operationId" : "post-member-happiness-routine-docs", + "requestBody" : { + "content" : { + "application/json;charset=UTF-8" : { + "schema" : { + "$ref" : "#/components/schemas/api-v1-routines-daily-member1721287602" + }, + "examples" : { + "post-member-happiness-routine-docs" : { + "value" : "{\n \"routineId\" : 1\n}" + } + } + } + } + }, + "responses" : { + "201" : { + "description" : "201", + "headers" : { + "Location" : { + "description" : "Redirect URI", + "schema" : { + "type" : "string" + } + } + }, + "content" : { + "application/json;charset=UTF-8" : { + "schema" : { + "$ref" : "#/components/schemas/api-v1-routines-daily-member1327124516" + }, + "examples" : { + "post-member-happiness-routine-docs" : { + "value" : "{\n \"success\" : true,\n \"message\" : \"루틴 추가 성공\",\n \"data\" : {\n \"routineId\" : 1\n }\n}" } } } @@ -474,7 +519,7 @@ }, "examples" : { "get-happiness-themes-docs" : { - "value" : "{\r\n \"success\" : true,\r\n \"message\" : \"테마 조회 성공\",\r\n \"data\" : {\r\n \"themes\" : [ {\r\n \"themeId\" : 1,\r\n \"name\" : \"Happiness routine Theme1\"\r\n }, {\r\n \"themeId\" : 2,\r\n \"name\" : \"Happiness routine Theme2\"\r\n }, {\r\n \"themeId\" : 3,\r\n \"name\" : \"Happiness routine Theme3\"\r\n }, {\r\n \"themeId\" : 4,\r\n \"name\" : \"Happiness routine Theme4\"\r\n }, {\r\n \"themeId\" : 5,\r\n \"name\" : \"Happiness routine Theme5\"\r\n } ]\r\n }\r\n}" + "value" : "{\n \"success\" : true,\n \"message\" : \"테마 조회 성공\",\n \"data\" : {\n \"themes\" : [ {\n \"themeId\" : 1,\n \"name\" : \"Happiness routine Theme1\"\n }, {\n \"themeId\" : 2,\n \"name\" : \"Happiness routine Theme2\"\n }, {\n \"themeId\" : 3,\n \"name\" : \"Happiness routine Theme3\"\n }, {\n \"themeId\" : 4,\n \"name\" : \"Happiness routine Theme4\"\n }, {\n \"themeId\" : 5,\n \"name\" : \"Happiness routine Theme5\"\n } ]\n }\n}" } } } @@ -508,7 +553,7 @@ }, "examples" : { "get-theme-daily-routines-docs" : { - "value" : "{\r\n \"success\" : true,\r\n \"message\" : \"루틴 조회 성공\",\r\n \"data\" : {\r\n \"routines\" : [ {\r\n \"routineId\" : 1,\r\n \"content\" : \"Daily routine Content1\"\r\n }, {\r\n \"routineId\" : 2,\r\n \"content\" : \"Daily routine Content2\"\r\n }, {\r\n \"routineId\" : 3,\r\n \"content\" : \"Daily routine Content3\"\r\n }, {\r\n \"routineId\" : 4,\r\n \"content\" : \"Daily routine Content4\"\r\n }, {\r\n \"routineId\" : 5,\r\n \"content\" : \"Daily routine Content5\"\r\n } ]\r\n }\r\n}" + "value" : "{\n \"success\" : true,\n \"message\" : \"루틴 조회 성공\",\n \"data\" : {\n \"routines\" : [ {\n \"routineId\" : 1,\n \"content\" : \"Daily routine Content1\"\n }, {\n \"routineId\" : 2,\n \"content\" : \"Daily routine Content2\"\n }, {\n \"routineId\" : 3,\n \"content\" : \"Daily routine Content3\"\n }, {\n \"routineId\" : 4,\n \"content\" : \"Daily routine Content4\"\n }, {\n \"routineId\" : 5,\n \"content\" : \"Daily routine Content5\"\n } ]\n }\n}" } } } @@ -542,7 +587,7 @@ }, "examples" : { "get-sub-happiness-routines-by-routine-of-theme-docs" : { - "value" : "{\r\n \"success\" : true,\r\n \"message\" : \"행복 루틴 별 서브 루틴 리스트 조회 성공\",\r\n \"data\" : {\r\n \"title\" : \"타이틀\",\r\n \"name\" : \"테마\",\r\n \"nameColor\" : \"색깔\",\r\n \"iconImageUrl\" : \"iconImageUrl\",\r\n \"contentImageUrl\" : \"contentImageUrl\",\r\n \"subRoutines\" : [ {\r\n \"subRoutineId\" : 1,\r\n \"content\" : \"소프티숙소\",\r\n \"detailContent\" : \"detailContent\",\r\n \"timeTaken\" : \"10분\",\r\n \"place\" : \"소프티숙소\"\r\n } ]\r\n }\r\n}" + "value" : "{\n \"success\" : true,\n \"message\" : \"행복 루틴 별 서브 루틴 리스트 조회 성공\",\n \"data\" : {\n \"title\" : \"타이틀\",\n \"name\" : \"테마\",\n \"nameColor\" : \"색깔\",\n \"iconImageUrl\" : \"iconImageUrl\",\n \"contentImageUrl\" : \"contentImageUrl\",\n \"subRoutines\" : [ {\n \"subRoutineId\" : 1,\n \"content\" : \"소프티숙소\",\n \"detailContent\" : \"detailContent\",\n \"timeTaken\" : \"10분\",\n \"place\" : \"소프티숙소\"\n } ]\n }\n}" } } } @@ -572,11 +617,11 @@ "content" : { "application/json;charset=UTF-8" : { "schema" : { - "$ref" : "#/components/schemas/api-v1-members594740350" + "$ref" : "#/components/schemas/api-v1-auth594740350" }, "examples" : { "delete-member-daily-routine-docs" : { - "value" : "{\r\n \"success\" : true,\r\n \"message\" : \"루틴 삭제 성공\",\r\n \"data\" : null\r\n}" + "value" : "{\n \"success\" : true,\n \"message\" : \"루틴 삭제 성공\",\n \"data\" : null\n}" } } } @@ -608,7 +653,7 @@ }, "examples" : { "achieve-member-daily-routine-docs" : { - "value" : "{\r\n \"success\" : true,\r\n \"message\" : \"루틴 달성 성공\",\r\n \"data\" : {\r\n \"routineId\" : 1,\r\n \"isAchieve\" : true,\r\n \"achieveCount\" : 1\r\n }\r\n}" + "value" : "{\n \"success\" : true,\n \"message\" : \"루틴 달성 성공\",\n \"data\" : {\n \"routineId\" : 1,\n \"isAchieve\" : true,\n \"achieveCount\" : 1\n }\n}" } } } @@ -799,6 +844,19 @@ } } }, + "api-v1-auth594740350" : { + "type" : "object", + "properties" : { + "success" : { + "type" : "boolean", + "description" : "응답 성공 여부" + }, + "message" : { + "type" : "string", + "description" : "응답 메시지" + } + } + }, "api-v1-members-cottonType-1561973557" : { "type" : "object", "properties" : { @@ -845,19 +903,6 @@ } } }, - "api-v1-members594740350" : { - "type" : "object", - "properties" : { - "success" : { - "type" : "boolean", - "description" : "응답 성공 여부" - }, - "message" : { - "type" : "string", - "description" : "응답 메시지" - } - } - }, "api-v1-auth-1040425838" : { "type" : "object", "properties" : { @@ -1100,6 +1145,29 @@ } } }, + "api-v1-routines-daily-member1327124516" : { + "type" : "object", + "properties" : { + "data" : { + "type" : "object", + "properties" : { + "routineId" : { + "type" : "number", + "description" : "생성한 루틴 id" + } + }, + "description" : "응답 데이터" + }, + "success" : { + "type" : "boolean", + "description" : "응답 성공 여부" + }, + "message" : { + "type" : "string", + "description" : "응답 메시지" + } + } + }, "api-v1-members-2061462562" : { "type" : "object", "properties" : { @@ -1176,29 +1244,6 @@ } } }, - "api-v1-routines-daily-member1327124516" : { - "type" : "object", - "properties" : { - "data" : { - "type" : "object", - "properties" : { - "routineId" : { - "type" : "number", - "description" : "생성한 루틴 id" - } - }, - "description" : "응답 데이터" - }, - "success" : { - "type" : "boolean", - "description" : "응답 성공 여부" - }, - "message" : { - "type" : "string", - "description" : "응답 메시지" - } - } - }, "api-v1-test486549215" : { "type" : "object" } diff --git a/src/test/java/com/soptie/server/memberRoutine/controller/MemberHappinessRoutineControllerTest.java b/src/test/java/com/soptie/server/memberRoutine/controller/MemberHappinessRoutineControllerTest.java index 9d4689c2..540fdc1d 100644 --- a/src/test/java/com/soptie/server/memberRoutine/controller/MemberHappinessRoutineControllerTest.java +++ b/src/test/java/com/soptie/server/memberRoutine/controller/MemberHappinessRoutineControllerTest.java @@ -1,14 +1,12 @@ package com.soptie.server.memberRoutine.controller; -import static com.epages.restdocs.apispec.ResourceDocumentation.*; -import static org.mockito.Mockito.*; -import static org.springframework.restdocs.operation.preprocess.Preprocessors.*; -import static org.springframework.restdocs.payload.JsonFieldType.*; -import static org.springframework.restdocs.payload.PayloadDocumentation.*; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; - -import java.security.Principal; - +import com.epages.restdocs.apispec.ResourceSnippetParameters; +import com.soptie.server.base.BaseControllerTest; +import com.soptie.server.common.dto.Response; +import com.soptie.server.memberRoutine.dto.MemberHappinessRoutineRequest; +import com.soptie.server.memberRoutine.dto.MemberHappinessRoutineResponse; +import com.soptie.server.memberRoutine.dto.MemberHappinessRoutinesResponse; +import com.soptie.server.memberRoutine.fixture.MemberHappinessRoutineFixture; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; @@ -18,11 +16,20 @@ import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation; import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders; -import com.epages.restdocs.apispec.ResourceSnippetParameters; -import com.soptie.server.base.BaseControllerTest; -import com.soptie.server.common.dto.Response; -import com.soptie.server.memberRoutine.dto.MemberHappinessRoutinesResponse; -import com.soptie.server.memberRoutine.fixture.MemberHappinessRoutineFixture; +import java.net.URI; +import java.security.Principal; + +import static com.epages.restdocs.apispec.ResourceDocumentation.resource; +import static com.soptie.server.common.dto.Response.success; +import static org.mockito.Mockito.when; +import static org.springframework.http.MediaType.APPLICATION_JSON; +import static org.springframework.restdocs.headers.HeaderDocumentation.headerWithName; +import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document; +import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.post; +import static org.springframework.restdocs.operation.preprocess.Preprocessors.*; +import static org.springframework.restdocs.payload.JsonFieldType.*; +import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @WebMvcTest(MemberHappinessRoutineController.class) class MemberHappinessRoutineControllerTest extends BaseControllerTest { @@ -37,7 +44,7 @@ class MemberHappinessRoutineControllerTest extends BaseControllerTest { @Test @DisplayName("회원 별 행복 루틴 조회 성공") - void success_getMemberDailyRoutines() throws Exception { + void success_getMemberHappinessRoutines() throws Exception { // given MemberHappinessRoutinesResponse routines = MemberHappinessRoutineFixture.createMemberHappinessRoutinesResponseDTO(); ResponseEntity response = ResponseEntity.ok(Response.success("루틴 조회 성공", routines)); @@ -81,4 +88,47 @@ void success_getMemberDailyRoutines() throws Exception { .andExpect(status().isOk()); } + @Test + @DisplayName("회원 행복 루틴 추가 성공") + void success_createMemberHappinessRoutine() throws Exception { + + MemberHappinessRoutineRequest request = new MemberHappinessRoutineRequest(1L); + MemberHappinessRoutineResponse savedMemberRoutine = MemberHappinessRoutineFixture.createMemberHappinessRoutineResponseDTO(); + ResponseEntity response = ResponseEntity + .created(URI.create("redirect_uri")) + .body(success("루틴 추가 성공", savedMemberRoutine)); + + when(controller.createMemberHappinessRoutine(principal, request)).thenReturn(response); + + mockMvc.perform(post(DEFAULT_URL) + .contentType(APPLICATION_JSON) + .accept(APPLICATION_JSON) + .principal(principal) + .content(objectMapper.writeValueAsString(request)) + ) + .andDo( + document("post-member-happiness-routine-docs", + preprocessRequest(prettyPrint()), + preprocessResponse(prettyPrint()), + resource(ResourceSnippetParameters.builder() + .tag(TAG) + .description("회원 행복 루틴 추가 성공") + .requestFields( + fieldWithPath("routineId").type(NUMBER).description("추가할 루틴 id") + ) + .responseHeaders( + headerWithName("Location").description("Redirect URI") + ) + .responseFields( + fieldWithPath("success").type(BOOLEAN).description("응답 성공 여부"), + fieldWithPath("message").type(STRING).description("응답 메시지"), + fieldWithPath("data").type(OBJECT).description("응답 데이터"), + fieldWithPath("data.routineId").type(NUMBER).description("생성한 루틴 id") + ) + .build() + ) + )) + .andExpect(status().isCreated()); + } + } \ No newline at end of file diff --git a/src/test/java/com/soptie/server/memberRoutine/fixture/MemberHappinessRoutineFixture.java b/src/test/java/com/soptie/server/memberRoutine/fixture/MemberHappinessRoutineFixture.java index e03a7316..2e4aa2b5 100644 --- a/src/test/java/com/soptie/server/memberRoutine/fixture/MemberHappinessRoutineFixture.java +++ b/src/test/java/com/soptie/server/memberRoutine/fixture/MemberHappinessRoutineFixture.java @@ -1,5 +1,6 @@ package com.soptie.server.memberRoutine.fixture; +import com.soptie.server.memberRoutine.dto.MemberHappinessRoutineResponse; import com.soptie.server.memberRoutine.dto.MemberHappinessRoutinesResponse; public class MemberHappinessRoutineFixture { @@ -29,4 +30,8 @@ public static MemberHappinessRoutinesResponse createMemberHappinessRoutinesRespo .build(); } + + public static MemberHappinessRoutineResponse createMemberHappinessRoutineResponseDTO() { + return new MemberHappinessRoutineResponse(1L); + } } From e2e5e585fd478da03f4a0019eef448a7687befb3 Mon Sep 17 00:00:00 2001 From: choeseungbin Date: Tue, 16 Jan 2024 03:09:39 +0900 Subject: [PATCH 2/3] =?UTF-8?q?[TEST]=20=ED=96=89=EB=B3=B5=20=EB=A3=A8?= =?UTF-8?q?=ED=8B=B4=20=EC=82=AD=EC=A0=9C=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/static/docs/open-api-3.0.1.json | 34 ++++++++++++++++++ .../MemberHappinessRoutineControllerTest.java | 36 +++++++++++++++++++ 2 files changed, 70 insertions(+) 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 4389d484..c4d27ed8 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 @@ -661,6 +661,40 @@ } } } + }, + "/api/v1/routines/happiness/member/routine/{routineId}" : { + "delete" : { + "tags" : [ "MEMBER HAPPINESS ROUTINE" ], + "summary" : "회원 행복 루틴 삭제 성공", + "description" : "회원 행복 루틴 삭제 성공", + "operationId" : "delete-member-happiness-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-auth594740350" + }, + "examples" : { + "delete-member-happiness-routine-docs" : { + "value" : "{\n \"success\" : true,\n \"message\" : \"루틴 삭제 성공\",\n \"data\" : null\n}" + } + } + } + } + } + } + } } }, "components" : { diff --git a/src/test/java/com/soptie/server/memberRoutine/controller/MemberHappinessRoutineControllerTest.java b/src/test/java/com/soptie/server/memberRoutine/controller/MemberHappinessRoutineControllerTest.java index 540fdc1d..552c3f86 100644 --- a/src/test/java/com/soptie/server/memberRoutine/controller/MemberHappinessRoutineControllerTest.java +++ b/src/test/java/com/soptie/server/memberRoutine/controller/MemberHappinessRoutineControllerTest.java @@ -25,10 +25,12 @@ import static org.springframework.http.MediaType.APPLICATION_JSON; import static org.springframework.restdocs.headers.HeaderDocumentation.headerWithName; import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document; +import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.delete; import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.post; import static org.springframework.restdocs.operation.preprocess.Preprocessors.*; import static org.springframework.restdocs.payload.JsonFieldType.*; import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath; +import static org.springframework.restdocs.request.RequestDocumentation.parameterWithName; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @WebMvcTest(MemberHappinessRoutineController.class) @@ -131,4 +133,38 @@ void success_createMemberHappinessRoutine() throws Exception { .andExpect(status().isCreated()); } + @Test + @DisplayName("회원 행복 루틴 삭제 성공") + void success_deleteMemberHappinessRoutine() throws Exception { + + Long routineId = 1L; + ResponseEntity response = ResponseEntity.ok(success("루틴 삭제 성공")); + + when(controller.deleteMemberHappinessRoutine(principal, routineId)).thenReturn(response); + + mockMvc.perform(delete(DEFAULT_URL + "/routine/{routineId}", routineId) + .contentType(APPLICATION_JSON) + .accept(APPLICATION_JSON) + .principal(principal)) + .andDo( + document("delete-member-happiness-routine-docs", + preprocessRequest(prettyPrint()), + preprocessResponse(prettyPrint()), + resource(ResourceSnippetParameters.builder() + .tag(TAG) + .description("회원 행복 루틴 삭제 성공") + .pathParameters( + parameterWithName("routineId").description("루틴 id") + ) + .responseFields( + fieldWithPath("success").type(BOOLEAN).description("응답 성공 여부"), + fieldWithPath("message").type(STRING).description("응답 메시지"), + fieldWithPath("data").type(NULL).description("응답 데이터") + ) + .build() + ) + )) + .andExpect(status().isOk()); + } + } \ No newline at end of file From 760ace63f8b3dfc89e7ee1ced1374459084f57e1 Mon Sep 17 00:00:00 2001 From: choeseungbin Date: Tue, 16 Jan 2024 03:27:13 +0900 Subject: [PATCH 3/3] =?UTF-8?q?[TEST]=20=ED=96=89=EB=B3=B5=20=EB=A3=A8?= =?UTF-8?q?=ED=8B=B4=20=EB=8B=AC=EC=84=B1=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/static/docs/open-api-3.0.1.json | 32 +++++++++++++++++ .../MemberHappinessRoutineControllerTest.java | 36 +++++++++++++++++-- 2 files changed, 66 insertions(+), 2 deletions(-) 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 c4d27ed8..1c5e8a53 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 @@ -694,6 +694,38 @@ } } } + }, + "patch" : { + "tags" : [ "MEMBER HAPPINESS ROUTINE" ], + "summary" : "회원 행복 루틴 달성 성공", + "description" : "회원 행복 루틴 달성 성공", + "operationId" : "achieve-member-happiness-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-auth594740350" + }, + "examples" : { + "achieve-member-happiness-routine-docs" : { + "value" : "{\n \"success\" : true,\n \"message\" : \"회원 행복 루틴 달성 성공\",\n \"data\" : null\n}" + } + } + } + } + } + } } } }, diff --git a/src/test/java/com/soptie/server/memberRoutine/controller/MemberHappinessRoutineControllerTest.java b/src/test/java/com/soptie/server/memberRoutine/controller/MemberHappinessRoutineControllerTest.java index 552c3f86..82e56edf 100644 --- a/src/test/java/com/soptie/server/memberRoutine/controller/MemberHappinessRoutineControllerTest.java +++ b/src/test/java/com/soptie/server/memberRoutine/controller/MemberHappinessRoutineControllerTest.java @@ -25,8 +25,7 @@ import static org.springframework.http.MediaType.APPLICATION_JSON; import static org.springframework.restdocs.headers.HeaderDocumentation.headerWithName; import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document; -import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.delete; -import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.post; +import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.*; import static org.springframework.restdocs.operation.preprocess.Preprocessors.*; import static org.springframework.restdocs.payload.JsonFieldType.*; import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath; @@ -167,4 +166,37 @@ void success_deleteMemberHappinessRoutine() throws Exception { .andExpect(status().isOk()); } + @Test + @DisplayName("회원 행복 루틴 달성 성공") + void success_achieveMemberHappinessRoutine() throws Exception { + + Long routineId = 1L; + ResponseEntity response = ResponseEntity.ok(success("회원 행복 루틴 달성 성공")); + + when(controller.achieveMemberHappinessRoutine(principal, routineId)).thenReturn(response); + + mockMvc.perform(patch(DEFAULT_URL + "/routine/{routineId}", routineId) + .contentType(APPLICATION_JSON) + .accept(APPLICATION_JSON) + .principal(principal)) + .andDo( + document("achieve-member-happiness-routine-docs", + preprocessRequest(prettyPrint()), + preprocessResponse(prettyPrint()), + resource(ResourceSnippetParameters.builder() + .tag(TAG) + .description("회원 행복 루틴 달성 성공") + .pathParameters( + parameterWithName("routineId").description("루틴 id") + ) + .responseFields( + fieldWithPath("success").type(BOOLEAN).description("응답 성공 여부"), + fieldWithPath("message").type(STRING).description("응답 메시지"), + fieldWithPath("data").type(NULL).description("응답 데이터") + ) + .build() + ) + )) + .andExpect(status().isOk()); + } } \ No newline at end of file