From 56640307882e4b7c6e39698430171ebe2bee2427 Mon Sep 17 00:00:00 2001 From: HoeSeong123 Date: Wed, 7 Aug 2024 11:58:13 +0900 Subject: [PATCH 1/6] =?UTF-8?q?docs(codezap):=20=EC=98=88=EC=99=B8=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC=EC=97=90=20=EB=8C=80=ED=95=9C=20=EB=AC=B8?= =?UTF-8?q?=EC=84=9C=ED=99=94=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../category/controller/SpringDocCategoryController.java | 8 ++++++-- .../template/controller/SpringDocTemplateController.java | 8 ++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/codezap/category/controller/SpringDocCategoryController.java b/backend/src/main/java/codezap/category/controller/SpringDocCategoryController.java index 6c8f552b4..ba62f553a 100644 --- a/backend/src/main/java/codezap/category/controller/SpringDocCategoryController.java +++ b/backend/src/main/java/codezap/category/controller/SpringDocCategoryController.java @@ -28,7 +28,7 @@ public interface SpringDocCategoryController { @ApiErrorResponse(status = HttpStatus.BAD_REQUEST, instance = "/categories", errorCases = { @ErrorCase(description = "모든 필드 중 null인 값이 있는 경우", exampleMessage = "카테고리 이름이 null 입니다."), @ErrorCase(description = "카테고리 이름이 255자를 초과한 경우", exampleMessage = "카테고리 이름은 최대 255자까지 입력 가능합니다."), - @ErrorCase(description = "동일한 이름의 카테고리가 존재하는 경우", exampleMessage = "이름이 Spring 인 카테고리가 이미 존재합니다.") + @ErrorCase(description = "동일한 이름의 카테고리가 존재하는 경우", exampleMessage = "이름이 Spring 인 카테고리가 이미 존재합니다."), }) ResponseEntity createCategory(CreateCategoryRequest createCategoryRequest, MemberDto memberDto); @@ -43,7 +43,9 @@ public interface SpringDocCategoryController { @ErrorCase(description = "해당하는 id 값인 카테고리가 없는 경우", exampleMessage = "식별자 1에 해당하는 카테고리가 존재하지 않습니다."), @ErrorCase(description = "동일한 이름의 카테고리가 존재하는 경우", - exampleMessage = "이름이 Spring 인 카테고리가 이미 존재합니다.") + exampleMessage = "이름이 Spring 인 카테고리가 이미 존재합니다."), + @ErrorCase(description = "카테고리를 수정할 권한이 없는 경우", + exampleMessage = "해당 카테고리를 수정 또는 삭제할 권한이 없는 유저입니다.") }) ResponseEntity updateCategory(Long id, UpdateCategoryRequest updateCategoryRequest, MemberDto memberDto); @@ -52,6 +54,8 @@ public interface SpringDocCategoryController { @ApiErrorResponse(status = HttpStatus.BAD_REQUEST, instance = "/categories/1", errorCases = { @ErrorCase(description = "삭제하려는 카테고리에 템플릿이 존재하는 경우", exampleMessage = "템플릿이 존재하는 카테고리는 삭제할 수 없습니다."), + @ErrorCase(description = "카테고리를 삭제할 권한이 없는 경우", + exampleMessage = "해당 카테고리를 수정 또는 삭제할 권한이 없는 유저입니다.") }) ResponseEntity deleteCategory(Long id, MemberDto memberDto); } diff --git a/backend/src/main/java/codezap/template/controller/SpringDocTemplateController.java b/backend/src/main/java/codezap/template/controller/SpringDocTemplateController.java index 44745d05a..9b944bbb4 100644 --- a/backend/src/main/java/codezap/template/controller/SpringDocTemplateController.java +++ b/backend/src/main/java/codezap/template/controller/SpringDocTemplateController.java @@ -65,6 +65,7 @@ ResponseEntity getTemplates( content = {@Content(schema = @Schema(implementation = ExploreTemplatesResponse.class))}) @ApiErrorResponse(status = HttpStatus.BAD_REQUEST, instance = "/templates/1", errorCases = { @ErrorCase(description = "해당하는 id 값인 템플릿이 없는 경우", exampleMessage = "식별자 1에 해당하는 템플릿이 존재하지 않습니다."), + @ErrorCase(description = "템플릿을 가져올 권한이 없는 경우", exampleMessage = "해당 템플릿에 대한 권한이 없는 유저입니다."), }) ResponseEntity getTemplateById(Long id, MemberDto memberDto); @@ -79,10 +80,17 @@ ResponseEntity getMyTemplatesContainTopic( @ApiResponse(responseCode = "200", description = "템플릿 수정 성공") @ApiErrorResponse(status = HttpStatus.BAD_REQUEST, instance = "/templates/1", errorCases = { @ErrorCase(description = "해당하는 id 값인 템플릿이 없는 경우", exampleMessage = "식별자 1에 해당하는 템플릿이 존재하지 않습니다."), + @ErrorCase(description = "템플릿을 수정할 권한이 없는 경우", exampleMessage = "해당 템플릿에 대한 권한이 없는 유저입니다."), + }) ResponseEntity updateTemplate(Long id, UpdateTemplateRequest updateTemplateRequest, MemberDto memberDto); @Operation(summary = "템플릿 삭제", description = "해당하는 식별자의 템플릿을 삭제합니다.") @ApiResponse(responseCode = "204", description = "템플릿 삭제 성공") + @ApiErrorResponse(status = HttpStatus.BAD_REQUEST, instance = "/templates/1", errorCases = { + @ErrorCase(description = "해당하는 id 값인 템플릿이 없는 경우", exampleMessage = "식별자 1에 해당하는 템플릿이 존재하지 않습니다."), + @ErrorCase(description = "템플릿을 수정할 권한이 없는 경우", exampleMessage = "해당 템플릿에 대한 권한이 없는 유저입니다."), + + }) ResponseEntity deleteTemplate(Long id, MemberDto memberDto); } From 883638ad446ecd3866c1adc09d50732f604b0977 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9E=AC=EC=9A=B0?= Date: Wed, 7 Aug 2024 13:57:57 +0900 Subject: [PATCH 2/6] =?UTF-8?q?fix(service):=20=ED=9A=8C=EC=9B=90=EA=B0=80?= =?UTF-8?q?=EC=9E=85=20=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/codezap/member/service/MemberService.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/codezap/member/service/MemberService.java b/backend/src/main/java/codezap/member/service/MemberService.java index 83a358a26..e9dcf2dbd 100644 --- a/backend/src/main/java/codezap/member/service/MemberService.java +++ b/backend/src/main/java/codezap/member/service/MemberService.java @@ -27,8 +27,9 @@ public Member signup(SignupRequest request) { assertUniqueEmail(request.email()); assertUniqueUsername(request.username()); Member member = new Member(request.email(), request.password(), request.username()); - categoryJpaRepository.save(Category.createDefaultCategory(member)); - return memberRepository.save(member); + Member saved = memberRepository.save(member); + categoryJpaRepository.save(Category.createDefaultCategory(saved)); + return saved; } public MemberDto login(LoginRequest request) { From d45030bd9743661c63734fd10f412e4721f2fe21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9E=AC=EC=9A=B0?= Date: Wed, 7 Aug 2024 14:30:24 +0900 Subject: [PATCH 3/6] =?UTF-8?q?fix(service):=20cookie=20=EC=84=A4=EC=A0=95?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/codezap/member/controller/MemberController.java | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/src/main/java/codezap/member/controller/MemberController.java b/backend/src/main/java/codezap/member/controller/MemberController.java index 393297b3d..9f5bad79b 100644 --- a/backend/src/main/java/codezap/member/controller/MemberController.java +++ b/backend/src/main/java/codezap/member/controller/MemberController.java @@ -54,6 +54,7 @@ public void login(@Valid @RequestBody LoginRequest request, HttpServletResponse ResponseCookie cookie = ResponseCookie.from(HttpHeaders.AUTHORIZATION, basicAuth) .maxAge(-1) .path("/") + .sameSite("None") .secure(true) .httpOnly(true) .build(); From 0e9e955fb82e328d98425221691c73b4769c103e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=98jminkkk=E2=80=99?= <102847513+jminkkk@users.noreply.github.com> Date: Wed, 7 Aug 2024 14:56:36 +0900 Subject: [PATCH 4/6] =?UTF-8?q?refactor(resources):=20log=20file=20?= =?UTF-8?q?=EC=9C=84=EC=B9=98=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/main/resources/logback-spring.xml | 1 - backend/src/main/resources/logger/logback-spring-dev.xml | 3 +++ backend/src/main/resources/logger/logback-spring-prod.xml | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/src/main/resources/logback-spring.xml b/backend/src/main/resources/logback-spring.xml index 3259bd3a5..3ebbe60aa 100644 --- a/backend/src/main/resources/logback-spring.xml +++ b/backend/src/main/resources/logback-spring.xml @@ -1,7 +1,6 @@ - diff --git a/backend/src/main/resources/logger/logback-spring-dev.xml b/backend/src/main/resources/logger/logback-spring-dev.xml index 582b10ba1..7074c38e7 100644 --- a/backend/src/main/resources/logger/logback-spring-dev.xml +++ b/backend/src/main/resources/logger/logback-spring-dev.xml @@ -1,5 +1,8 @@ + + + diff --git a/backend/src/main/resources/logger/logback-spring-prod.xml b/backend/src/main/resources/logger/logback-spring-prod.xml index 812893728..9412be3d9 100644 --- a/backend/src/main/resources/logger/logback-spring-prod.xml +++ b/backend/src/main/resources/logger/logback-spring-prod.xml @@ -1,5 +1,7 @@ + + From dddde60261a5bb85934e3f5307f30d53b8782cff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=98jminkkk=E2=80=99?= <102847513+jminkkk@users.noreply.github.com> Date: Wed, 7 Aug 2024 15:53:07 +0900 Subject: [PATCH 5/6] =?UTF-8?q?refactor(resources):=20log=20file=20?= =?UTF-8?q?=EC=9C=84=EC=B9=98=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/main/resources/logger/logback-spring-prod.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/main/resources/logger/logback-spring-prod.xml b/backend/src/main/resources/logger/logback-spring-prod.xml index 9412be3d9..4078eacc4 100644 --- a/backend/src/main/resources/logger/logback-spring-prod.xml +++ b/backend/src/main/resources/logger/logback-spring-prod.xml @@ -1,6 +1,6 @@ - + From a5a9f90c8663b65ef10b8503ecb6d891fedf7a09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9E=AC=EC=9A=B0?= Date: Wed, 7 Aug 2024 16:59:44 +0900 Subject: [PATCH 6/6] =?UTF-8?q?fix(controller):=20cookie=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/codezap/member/controller/MemberController.java | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/src/main/java/codezap/member/controller/MemberController.java b/backend/src/main/java/codezap/member/controller/MemberController.java index 9f5bad79b..9486790a6 100644 --- a/backend/src/main/java/codezap/member/controller/MemberController.java +++ b/backend/src/main/java/codezap/member/controller/MemberController.java @@ -74,6 +74,7 @@ public void logout(HttpServletResponse response) { ResponseCookie cookie = ResponseCookie.from(HttpHeaders.AUTHORIZATION, "") .maxAge(0) .path("/") + .sameSite("None") .secure(true) .httpOnly(true) .build();