Skip to content

Commit

Permalink
Merge branch 'develop' into feature/#29/friend-api
Browse files Browse the repository at this point in the history
  • Loading branch information
junseokkim authored Feb 1, 2024
2 parents 684244a + 8ff84f4 commit 4209e66
Show file tree
Hide file tree
Showing 64 changed files with 4,007 additions and 47 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,7 @@ application.yml
### Ignore checksum files ###
checksums.lock
md-checksums.bin
*.lock
*.lock

### Qclass ###
**/generated
28 changes: 27 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ plugins {
group = 'com.umc'
version = '0.0.1-SNAPSHOT'


java {
sourceCompatibility = '17'
}
Expand All @@ -21,6 +22,7 @@ repositories {
mavenCentral()
}


dependencies {
implementation 'io.jsonwebtoken:jjwt:0.9.1'

Expand All @@ -47,6 +49,12 @@ dependencies {
// s3 setting
implementation 'org.springframework.cloud:spring-cloud-starter-aws:2.2.6.RELEASE'

//query dsl
implementation 'com.querydsl:querydsl-jpa:5.0.0:jakarta'
annotationProcessor "com.querydsl:querydsl-apt:5.0.0:jakarta"
annotationProcessor "jakarta.annotation:jakarta.annotation-api"
annotationProcessor "jakarta.persistence:jakarta.persistence-api"

// ์Šคํ”„๋ง ์‹œํ๋ฆฌํ‹ฐ๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•œ ์Šคํƒ€ํ„ฐ ์ถ”๊ฐ€
implementation 'org.springframework.boot:spring-boot-starter-security'

Expand All @@ -60,6 +68,24 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-webflux'
}

tasks.named('test') {
test {
useJUnitPlatform()
}

// Querydsl
def generated = 'src/main/generated'

//QClass ํŒŒ์ผ ์œ„์น˜
tasks.withType(JavaCompile) {
options.getGeneratedSourceOutputDirectory().set(file(generated))
}

//java source set ์— querydsl QClass ์œ„์น˜ ์ถ”๊ฐ€
sourceSets {
main.java.srcDirs += [ generated ]
}

//clean ์‹œ generated ํŒŒ์ผ ์‚ญ์ œ
clean {
delete file(generated)
}
19 changes: 19 additions & 0 deletions src/main/java/com/umc/networkingService/config/QueryDSLConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.umc.networkingService.config;

import com.querydsl.jpa.impl.JPAQueryFactory;
import jakarta.persistence.EntityManager;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
@RequiredArgsConstructor
public class QueryDSLConfig {
private final EntityManager entityManager;

@Bean
public JPAQueryFactory jpaQueryFactory() {
return new JPAQueryFactory(entityManager);
}
}
12 changes: 12 additions & 0 deletions src/main/java/com/umc/networkingService/config/WebMvcConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.umc.networkingService.domain.member.interceptor.LastActiveInterceptor;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

Expand All @@ -19,4 +20,15 @@ public void addInterceptors(InterceptorRegistry registry) {
.excludePathPatterns("/v3/**", "/swagger-ui/**") // ์Šค์›จ๊ฑฐ ์š”์ฒญ์€ ์ œ์™ธ
.excludePathPatterns("/members/login"); // ๋กœ๊ทธ์ธ API ์ œ์™ธ
}

//cors ์—๋Ÿฌ ํ•ด๊ฒฐ
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOriginPatterns("*")
.allowCredentials(true)
.allowedMethods("GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS")
.allowedHeaders("*")
.maxAge(3600);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
package com.umc.networkingService.domain.board.controller;

import com.umc.networkingService.config.security.auth.CurrentMember;
import com.umc.networkingService.domain.board.dto.request.comment.BoardCommentAddRequest;
import com.umc.networkingService.domain.board.dto.request.comment.BoardCommentUpdateRequest;
import com.umc.networkingService.domain.board.dto.response.comment.BoardCommentIdResponse;
import com.umc.networkingService.domain.board.dto.response.comment.BoardCommentPagingResponse;
import com.umc.networkingService.domain.board.dto.response.member.MyBoardCommentPagingWebResponse;
import com.umc.networkingService.domain.board.dto.response.member.MyBoardPagingResponse;
import com.umc.networkingService.domain.board.entity.BoardType;
import com.umc.networkingService.domain.board.entity.HostType;
import com.umc.networkingService.domain.board.service.BoardCommentService;
import com.umc.networkingService.domain.member.entity.Member;
import com.umc.networkingService.global.common.base.BaseResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.web.PageableDefault;
import org.springframework.web.bind.annotation.*;

import java.util.UUID;

@Tag(name = "๊ฒŒ์‹œํŒ ๋Œ“๊ธ€ API", description = "๊ฒŒ์‹œํŒ ๋Œ“๊ธ€ ๊ด€๋ จ API")
@RestController
@RequiredArgsConstructor
@RequestMapping("/boards/comments")
public class BoardCommentController {

private final BoardCommentService boardCommentService;

@Operation(summary = "๋Œ“๊ธ€ ์ž‘์„ฑ API", description = "๋Œ“๊ธ€์„ ์ž‘์„ฑํ•˜๋Š” API์ž…๋‹ˆ๋‹ค.")
@ApiResponses(value = {
@ApiResponse(responseCode = "COMMON200", description = "์„ฑ๊ณต"),
})
@PostMapping
public BaseResponse<BoardCommentIdResponse> addBoardComment(@CurrentMember Member member,
@Valid @RequestBody BoardCommentAddRequest request) {
return BaseResponse.onSuccess(boardCommentService.addBoardComment(member, request));
}

@Operation(summary = "๋Œ“๊ธ€ ์ˆ˜์ • API", description = "๋Œ“๊ธ€์„ ์ˆ˜์ •ํ•˜๋Š” API์ž…๋‹ˆ๋‹ค.")
@ApiResponses(value = {
@ApiResponse(responseCode = "COMMON200", description = "์„ฑ๊ณต"),
@ApiResponse(responseCode = "COMMENT001", description = "๋Œ“๊ธ€์„ ์ฐพ์„ ์ˆ˜ ์—†์„ ๊ฒฝ์šฐ ๋ฐœ์ƒ"),
@ApiResponse(responseCode = "COMMENT002", description = "๋Œ“๊ธ€ ์ˆ˜์ • ๊ถŒํ•œ์ด ์—†์„ ๊ฒฝ์šฐ ๋ฐœ์ƒ"),

})
@PatchMapping("/{commentId}")
public BaseResponse<BoardCommentIdResponse> updateBoardComment(@CurrentMember Member member,
@PathVariable(value = "commentId") UUID commentId,
@Valid @RequestBody BoardCommentUpdateRequest request) {
return BaseResponse.onSuccess(boardCommentService.updateBoardComment(member, commentId, request));
}


@Operation(summary = "๋Œ“๊ธ€ ์‚ญ์ œ API", description = "๋Œ“๊ธ€์„ ์‚ญ์ œํ•˜๋Š” API์ž…๋‹ˆ๋‹ค.")
@ApiResponses(value = {
@ApiResponse(responseCode = "COMMON200", description = "์„ฑ๊ณต"),
@ApiResponse(responseCode = "COMMENT001", description = "๋Œ“๊ธ€์„ ์ฐพ์„ ์ˆ˜ ์—†์„ ๊ฒฝ์šฐ ๋ฐœ์ƒ"),
@ApiResponse(responseCode = "COMMENT002", description = "๋Œ“๊ธ€ ์‚ญ์ œ ๊ถŒํ•œ์ด ์—†์„ ๊ฒฝ์šฐ ๋ฐœ์ƒ")
})
@DeleteMapping("/{commentId}")
public BaseResponse<BoardCommentIdResponse> deleteBoardComment(@CurrentMember Member member,
@PathVariable(value = "commentId") UUID commentId) {
return BaseResponse.onSuccess(boardCommentService.deleteBoardComment(member, commentId));
}

@Operation(summary = " ํŠน์ • ๊ฒŒ์‹œ๊ธ€ ๋Œ“๊ธ€ ๋ชฉ๋ก ์กฐํšŒ API", description = "ํŠน์ • ๊ฒŒ์‹œ๊ธ€์˜ ๋Œ“๊ธ€ ๋ชฉ๋ก์„ ์กฐํšŒํ•˜๋Š” API์ž…๋‹ˆ๋‹ค.")
@ApiResponses(value = {
@ApiResponse(responseCode = "COMMON200", description = "์„ฑ๊ณต"),
@ApiResponse(responseCode = "BOARD002", description = "๊ฒŒ์‹œ๊ธ€์„ ์ฐพ์„ ์ˆ˜ ์—†์„ ๊ฒฝ์šฐ ๋ฐœ์ƒ")
})
@Parameters(value = {
@Parameter(name = "page", description = " page ์‹œ์ž‘์€ 0๋ฒˆ๋ถ€ํ„ฐ, ์˜ค๋ฆ„์ฐจ์ˆœ์œผ๋กœ ์กฐํšŒ๋ฉ๋‹ˆ๋‹ค.")
})
@GetMapping(value = "/{boardId}")
public BaseResponse<BoardCommentPagingResponse> showBoardComments(@CurrentMember Member member,
@PathVariable(value = "boardId") UUID boardId,
@PageableDefault(sort = "created_at", direction = Sort.Direction.ASC)
@Parameter(hidden = true) Pageable pageable) {
return BaseResponse.onSuccess(boardCommentService.showBoardComments(member, boardId, pageable));
}

@Operation(summary = "[APP] ๋‚ด๊ฐ€ ๋Œ“๊ธ€ ์“ด ๊ธ€ ์กฐํšŒ/๊ฒ€์ƒ‰ API", description = "APP์šฉ ๋‚ด๊ฐ€ ๋Œ“๊ธ€ ์“ด ๊ธ€์„ ์กฐํšŒ/๊ฒ€์ƒ‰ํ•˜๋Š” API์ž…๋‹ˆ๋‹ค.")
@ApiResponses(value = {
@ApiResponse(responseCode = "COMMON200", description = "์„ฑ๊ณต"),
})
@Parameters(value = {
@Parameter(name = "keyword", description = "keyword๋ฅผ ์ฃผ์ง€ ์•Š์œผ๋ฉด ๋ชจ๋“  ๋‚ด๊ฐ€ ๋Œ“๊ธ€ ์“ด ๊ธ€์ด ์กฐํšŒ๋ฉ๋‹ˆ๋‹ค. keyword๋ฅผ ์ฃผ๋ฉด ๊ฒ€์ƒ‰์ด ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค."),
@Parameter(name = "page", description = "page ์‹œ์ž‘์€ 0๋ฒˆ๋ถ€ํ„ฐ, ๋‚ด๋ฆผ์ฐจ์ˆœ์œผ๋กœ ์กฐํšŒ๋ฉ๋‹ˆ๋‹ค.")
})
@GetMapping(value = "/member/comments/app")
public BaseResponse<MyBoardPagingResponse> showBoardsByMemberCommentsForApp(@CurrentMember Member member,
@RequestParam(name = "keyword", required = false) String keyword,
@PageableDefault(sort = "created_at", direction = Sort.Direction.DESC)
@Parameter(hidden = true) Pageable pageable) {
return BaseResponse.onSuccess(boardCommentService.showBoardsByMemberCommentForApp(member, keyword, pageable));
}

@Operation(summary = "[WEB] ๋‚ด๊ฐ€ ๋Œ“๊ธ€ ์“ด ๊ธ€ ์กฐํšŒ/๊ฒ€์ƒ‰ API", description = "WEB์šฉ ๋‚ด๊ฐ€ ๋Œ“๊ธ€ ์“ด ๊ธ€์„ ์กฐํšŒ/๊ฒ€์ƒ‰ํ•˜๋Š” API์ž…๋‹ˆ๋‹ค. "+
"host: CENTER, BRANCH, CAMPUS ์ค‘ ํ•˜๋‚˜์˜ ๊ฐ’์„ ๋Œ€๋ฌธ์ž๋กœ ์ฃผ์„ธ์š”. " +
"board: NOTICE, FREE, WORKBOOK, OB, QUESTION ์ค‘ ํ•˜๋‚˜์˜ ๊ฐ’์„ ๋Œ€๋ฌธ์ž๋กœ ์ฃผ์„ธ์š”.")
@ApiResponses(value = {
@ApiResponse(responseCode = "COMMON200", description = "์„ฑ๊ณต"),
})
@Parameters(value = {
@Parameter(name = "keyword", description = "keyword๋ฅผ ์ฃผ์ง€ ์•Š์œผ๋ฉด ๋ชจ๋“  ๋‚ด๊ฐ€ ๋Œ“๊ธ€ ์“ด ๊ธ€์ด ์กฐํšŒ๋ฉ๋‹ˆ๋‹ค. keyword๋ฅผ ์ฃผ๋ฉด ๊ฒ€์ƒ‰์ด ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค."),
@Parameter(name = "page", description = "page ์‹œ์ž‘์€ 0๋ฒˆ๋ถ€ํ„ฐ, ๋‚ด๋ฆผ์ฐจ์ˆœ์œผ๋กœ ์กฐํšŒ๋ฉ๋‹ˆ๋‹ค.")})
@GetMapping(value = "/member/comments/web")
public BaseResponse<MyBoardCommentPagingWebResponse> showBoardsByMemberCommentForWeb(@CurrentMember Member member,
@RequestParam(name = "host") HostType hostType,
@RequestParam(name = "board") BoardType boardType,
@RequestParam(name = "keyword", required = false) String keyword,
@PageableDefault(sort = "created_at", direction = Sort.Direction.DESC)
@Parameter(hidden = true) Pageable pageable) {
return BaseResponse.onSuccess(boardCommentService.showBoardsByMemberCommentForWeb(member, hostType, boardType,keyword, pageable));
}
}
Loading

0 comments on commit 4209e66

Please sign in to comment.