Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge: 5주차 작업 master에 반영 #39

Merged
merged 34 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
06ffe6b
feat: JWT를 입력할 수 있도록 Swagger 설정
peeerr Sep 30, 2024
a74d8ce
feat: MemberController에 문서화를 위한 로그인 API 추가
peeerr Sep 30, 2024
878450f
feat: POST로만 로그인 요청이 가능하도록 수정 및 예외 처리
peeerr Sep 30, 2024
2a546dd
refactor: cicd name 수정
peeerr Sep 30, 2024
408608e
Merge pull request #29 from kakao-tech-campus-2nd-step3/feature/28-sw…
peeerr Sep 30, 2024
1b49e90
feat: 파일 조회 API 구현
peeerr Oct 1, 2024
2c23cbb
feat: 파일 저장 API 구현
peeerr Oct 1, 2024
f045230
feat: 파일 수정 API 구현
peeerr Oct 1, 2024
69ef897
Merge pull request #30 from kakao-tech-campus-2nd-step3/feature/27-file
peeerr Oct 1, 2024
892f0b2
feat: 카테고리 추가 API 구현
peeerr Oct 2, 2024
1052bae
feat: 카테고리 조회 API 구현
peeerr Oct 2, 2024
2975e5f
feat: 카테고리 수정 API 구현
peeerr Oct 2, 2024
cfbdfe9
feat: 카테고리 삭제 API 구현
peeerr Oct 2, 2024
425228f
Merge pull request #33 from kakao-tech-campus-2nd-step3/feature/31-ca…
peeerr Oct 2, 2024
7ce42e1
feat: 친구 추가 요청 API 구현
peeerr Oct 2, 2024
1b9bd32
feat: 친구 요청 수락 API 구현
peeerr Oct 2, 2024
12567c8
feat: 친구 추가 거절 API 구현
peeerr Oct 2, 2024
6b4c9ea
feat: 친구 추가 요청 목록 조회 API 구현
peeerr Oct 2, 2024
312b235
feat: 좋아요 추가/삭제 (토글) API 구현
peeerr Oct 2, 2024
92bf079
feat: 특정 일기의 좋아요 수 조회 API 구현
peeerr Oct 2, 2024
189f517
Merge pull request #35 from kakao-tech-campus-2nd-step3/feature/34-fr…
peeerr Oct 2, 2024
c198766
feat: 로그인 및 회원 검색 요구 사항 반영
peeerr Oct 3, 2024
eebc7d9
feat: 회원 탈퇴 API 구현 (soft delete)
peeerr Oct 3, 2024
7a2ebb1
Merge pull request #37 from kakao-tech-campus-2nd-step3/feature/36-me…
peeerr Oct 3, 2024
e97a52a
refactor: 4주차 피드백 반영
Oct 4, 2024
00b7bb6
feat: 댓글 엔티티, 레포지토리 추가
Oct 4, 2024
3a750ee
feat: 댓글 작성, 조회 기능 추가
Oct 4, 2024
21278ca
feat: 댓글 수정, 삭제 기능 추가
Oct 4, 2024
a52ecad
feat: 알림 조회, 읽기 기능 추가
Oct 4, 2024
9f859b6
Merge branch 'weekly/5' into feature/32-Comment
peeerr Oct 4, 2024
a244222
fix: notification Member 컬럼명 수정
Oct 4, 2024
5516193
Merge branch 'feature/32-Comment' of https://github.com/HyeJiJUN11/KT…
Oct 4, 2024
18d218a
fix: comment, diary 엔티티 클럼명 수정
Oct 4, 2024
632740d
Merge pull request #38 from HyeJiJUN11/feature/32-Comment
peeerr Oct 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/master_weekly_cicd.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: master 브랜치 merge 시 CI/CD 파이프라인
name: master 및 weekly 브랜치 merge 시 CI/CD 파이프라인

on:
push:
Expand Down
51 changes: 51 additions & 0 deletions src/main/java/com/potatocake/everymoment/config/SwaggerConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package com.potatocake.everymoment.config;

import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.security.SecurityRequirement;
import io.swagger.v3.oas.models.security.SecurityScheme;
import org.springdoc.core.customizers.OpenApiCustomizer;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SwaggerConfig {

@Bean
public OpenAPI customOpenAPI() {
return new OpenAPI()
.info(new Info().title("API").version("1.0"))
.components(new Components()
.addSecuritySchemes("bearerAuth", new SecurityScheme()
.type(SecurityScheme.Type.HTTP)
.scheme("bearer")
.bearerFormat("JWT")
)
);
}

@Bean
public GroupedOpenApi publicApi() {
return GroupedOpenApi.builder()
.group("public-api")
.pathsToMatch("/**")
.addOpenApiCustomizer(addSecurityItemToAllEndpointsExceptLogin())
.build();
}

private OpenApiCustomizer addSecurityItemToAllEndpointsExceptLogin() {
return openApi -> {
SecurityRequirement securityRequirement = new SecurityRequirement().addList("bearerAuth");
openApi.getPaths().forEach((path, item) -> {
if (!"/api/members/login".equals(path)) {
item.readOperations().forEach(operation -> {
operation.addSecurityItem(securityRequirement);
});
}
});
};
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package com.potatocake.everymoment.controller;

import com.potatocake.everymoment.dto.SuccessResponse;
import com.potatocake.everymoment.dto.request.CategoryCreateRequest;
import com.potatocake.everymoment.dto.response.CategoryResponse;
import com.potatocake.everymoment.security.MemberDetails;
import com.potatocake.everymoment.service.CategoryService;
import jakarta.validation.Valid;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequiredArgsConstructor
@RequestMapping("/api/categories")
@RestController
public class CategoryController {

private final CategoryService categoryService;

@GetMapping
public ResponseEntity<SuccessResponse<CategoryResponse>> getCategories(
@AuthenticationPrincipal MemberDetails memberDetails) {
List<CategoryResponse> categories = categoryService.getCategories(memberDetails.getId());

return ResponseEntity.ok()
.body(SuccessResponse.ok(categories));
}

@PostMapping
public ResponseEntity<SuccessResponse> addCategory(@RequestBody @Valid CategoryCreateRequest request,
@AuthenticationPrincipal MemberDetails memberDetails) {
categoryService.addCategory(memberDetails.getId(), request);

return ResponseEntity.ok()
.body(SuccessResponse.ok());
}

@PatchMapping("/{categoryId}")
public ResponseEntity<SuccessResponse> updateCategory(@PathVariable Long categoryId,
@RequestBody @Valid CategoryCreateRequest request,
@AuthenticationPrincipal MemberDetails memberDetails) {
categoryService.updateCategory(categoryId, memberDetails.getId(), request);

return ResponseEntity.ok()
.body(SuccessResponse.ok());
}

@DeleteMapping("/{categoryId}")
public ResponseEntity<SuccessResponse> deleteCategory(@PathVariable Long categoryId,
@AuthenticationPrincipal MemberDetails memberDetails) {
categoryService.deleteCategory(categoryId, memberDetails.getId());

return ResponseEntity.ok()
.body(SuccessResponse.ok());
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package com.potatocake.everymoment.controller;

import com.potatocake.everymoment.dto.SuccessResponse;
import com.potatocake.everymoment.dto.request.CommentRequest;
import com.potatocake.everymoment.security.MemberDetails;
import com.potatocake.everymoment.service.CommentService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequiredArgsConstructor
@RestController
@RequestMapping("/api/comments")
public class CommentController {

private final CommentService commentService;

//댓글 수정
@PatchMapping("/{commentId}")
public ResponseEntity<SuccessResponse<Void>> updateComment(
@AuthenticationPrincipal MemberDetails memberDetails,
@PathVariable Long commentId,
@RequestBody CommentRequest commentRequest) {
Long memberId = memberDetails.getId();

commentService.updateComment(memberId, commentId, commentRequest);

return ResponseEntity.ok()
.body(SuccessResponse.ok());
}

//댓글 삭제
@DeleteMapping("/{commentId}")
public ResponseEntity<SuccessResponse<Void>> deleteComment(
@AuthenticationPrincipal MemberDetails memberDetails,
@PathVariable Long commentId) {
Long memberId = memberDetails.getId();

commentService.deleteComment(memberId, commentId);

return ResponseEntity.ok()
.body(SuccessResponse.ok());
}
}
Loading
Loading