Skip to content

Commit 6c12b96

Browse files
5uhwannwonjunYouKoSeonJe
authored
[release] v.1.2.0 (#223)
Co-authored-by: Wonjun You <[email protected]> Co-authored-by: koseonje <[email protected]> Co-authored-by: koseonje <[email protected]>
1 parent a756132 commit 6c12b96

File tree

388 files changed

+10957
-3738
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

388 files changed

+10957
-3738
lines changed

.DS_Store

6 KB
Binary file not shown.

.coderabbit.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
language: "ko-KR"
2+
early_access: false
3+
reviews:
4+
profile: "chill"
5+
request_changes_workflow: false
6+
high_level_summary: true
7+
poem: false
8+
review_status: true
9+
collapse_walkthrough: false
10+
auto_review:
11+
enabled: true
12+
drafts: false
13+
chat:
14+
auto_reply: true

.github/workflows/dev-server-integrator.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
run: chmod +x gradlew
3333

3434
- name: CI Test
35-
run: ./gradlew clean test
35+
run: ./gradlew clean test --no-build-cache
3636

3737
- name: Configure AWS Credentials
3838
uses: aws-actions/configure-aws-credentials@v4

.github/workflows/sonar_cloud.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: SonarCloud
2+
on:
3+
push:
4+
branches:
5+
- develop
6+
pull_request:
7+
types: [opened, synchronize, reopened]
8+
jobs:
9+
build:
10+
name: Build and analyze
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
16+
- name: Set up JDK 17
17+
uses: actions/setup-java@v4
18+
with:
19+
java-version: 17
20+
distribution: 'temurin' # Alternative distribution options are available
21+
- name: Cache SonarCloud packages
22+
uses: actions/cache@v4
23+
with:
24+
path: ~/.sonar/cache
25+
key: ${{ runner.os }}-sonar
26+
restore-keys: ${{ runner.os }}-sonar
27+
- name: Cache Gradle packages
28+
uses: actions/cache@v4
29+
with:
30+
path: ~/.gradle/caches
31+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
32+
restore-keys: ${{ runner.os }}-gradle
33+
- name: Build and analyze
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
37+
run: ./gradlew build sonar --info

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,6 @@ out/
3535

3636
### VS Code ###
3737
.vscode/
38+
39+
### QClass ###
40+
src/main/generated/**

build.gradle

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ plugins {
22
id 'java'
33
id 'org.springframework.boot' version '3.2.6'
44
id 'io.spring.dependency-management' version '1.1.3'
5+
id 'jacoco'
6+
id "org.sonarqube" version "5.1.0.4882"
57
}
68

79
group = 'ddingdong'
@@ -82,4 +84,44 @@ dependencies {
8284

8385
tasks.named('test') {
8486
useJUnitPlatform()
87+
finalizedBy 'jacocoTestReport'
88+
}
89+
90+
sonar {
91+
properties {
92+
property "sonar.projectKey", "COW-dev_ddingdong-be"
93+
property "sonar.organization", "cow-dev"
94+
property "sonar.host.url", "https://sonarcloud.io"
95+
property "sonar.sourceEncoding", "UTF-8"
96+
property "sonar.java.source", "${java.sourceCompatibility}"
97+
property "sonar.coverage.jacoco.xmlReportPaths", "${layout.buildDirectory}/reports/jacoco/test/jacocoTestReport.xml"
98+
property "sonar.junit.reportPaths", "${layout.buildDirectory}/test-results/test"
99+
100+
property "sonar.exclusions", "**/common/**"
101+
property "sonar.coverage.exclusions", """
102+
**/common/**,
103+
**/controller/**,
104+
**/dto/**,
105+
**/service/General*.java
106+
"""
107+
}
108+
}
109+
110+
jacocoTestReport {
111+
dependsOn test
112+
afterEvaluate {
113+
classDirectories.setFrom(files(classDirectories.files.collect {
114+
fileTree(dir: it, exclude: [
115+
"**/common/**",
116+
"**/controller/**",
117+
"**/dto/**",
118+
"**/service/General*.class"
119+
])
120+
}))
121+
}
122+
reports {
123+
html.required = true
124+
xml.required = true
125+
csv.required = false
126+
}
85127
}

compose-dev.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,18 @@ services:
1414
- mysql
1515
ports:
1616
- "8080:8080"
17+
1718
mysql:
18-
image: mysql:8.0.33
19+
image: mysql:8.0.40
1920
environment:
2021
MYSQL_DATABASE: ddingdong
2122
MYSQL_ROOT_PASSWORD: ${DEV_DB_PASSWORD}
2223
TZ: Asia/Seoul
2324
ports:
2425
- "3306:3306"
26+
volumes:
27+
- mysql-volume:/var/lib/mysql
2528

2629
volumes:
2730
mysql-volume:
31+
external: true

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
44
networkTimeout=10000
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists
7+
org.gradle.annotation.processing=true

promtail/.DS_Store

6 KB
Binary file not shown.

src/main/java/ddingdong/ddingdongBE/auth/controller/dto/request/SignInRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
@Getter
66
public class SignInRequest {
77

8-
private String userId;
8+
private String authId;
99

1010
private String password;
1111

src/main/java/ddingdong/ddingdongBE/auth/service/JwtAuthService.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ public class JwtAuthService implements AuthService {
3636
private final JwtConfig jwtConfig;
3737

3838
@Override
39-
public User registerClubUser(String userId, String password, String name) {
40-
checkExistUserId(userId);
39+
public User registerClubUser(String authId, String password, String name) {
40+
checkExistUserId(authId);
4141

4242
User clubUser = User.builder()
43-
.userId(userId)
43+
.authId(authId)
4444
.password(passwordEncoder.encode(Password.of(password).getValue()))
4545
.name(name)
4646
.role(Role.CLUB)
@@ -50,7 +50,7 @@ public User registerClubUser(String userId, String password, String name) {
5050

5151
@Override
5252
public String signIn(SignInRequest request) {
53-
User user = userRepository.findByUserId(request.getUserId())
53+
User user = userRepository.findByAuthId(request.getAuthId())
5454
.orElseThrow(UnRegisteredId::new);
5555

5656
if (!passwordEncoder.matches(request.getPassword(), user.getPassword())) {
@@ -114,7 +114,7 @@ private String createJwt(User user) {
114114

115115

116116
private void checkExistUserId(String userId) {
117-
if (userRepository.existsByUserId(userId)) {
117+
if (userRepository.existsByAuthId(userId)) {
118118
throw new AlreadyExistClubId();
119119
}
120120
}

src/main/java/ddingdong/ddingdongBE/common/config/SecurityConfig.java

Lines changed: 52 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -33,56 +33,58 @@ public class SecurityConfig {
3333
public SecurityFilterChain filterChain(HttpSecurity http, JwtAuthService authService, JwtConfig config)
3434
throws Exception {
3535
http
36-
.authorizeHttpRequests(auth -> auth
37-
.requestMatchers(API_PREFIX + "/auth/**",
38-
API_PREFIX + "/events/**")
39-
.permitAll()
40-
.requestMatchers(API_PREFIX + "/admin/**").hasRole("ADMIN")
41-
.requestMatchers(API_PREFIX + "/club/**").hasRole("CLUB")
42-
.requestMatchers(actuatorPath).hasRole("ADMIN")
43-
.requestMatchers(GET,
44-
API_PREFIX + "/clubs/**",
45-
API_PREFIX + "/notices/**",
46-
API_PREFIX + "/banners/**",
47-
API_PREFIX + "/documents/**",
48-
API_PREFIX + "/questions/**",
49-
API_PREFIX + "/feeds/**")
50-
.permitAll()
51-
.requestMatchers("/v3/api-docs/**", "/swagger-ui/**", "/swagger-resources/**")
52-
.permitAll()
53-
.anyRequest()
54-
.authenticated()
55-
)
56-
.cors(cors -> cors
57-
.configurationSource(corsConfigurationSource())
58-
)
59-
/*
60-
csrf, headers, http-basic, rememberMe, formLogin 비활성화
61-
*/
62-
.csrf(AbstractHttpConfigurer::disable)
63-
.headers(AbstractHttpConfigurer::disable)
64-
.httpBasic(AbstractHttpConfigurer::disable)
65-
.rememberMe(AbstractHttpConfigurer::disable)
66-
.formLogin(AbstractHttpConfigurer::disable)
67-
.logout(AbstractHttpConfigurer::disable)
68-
/*
69-
Session 설정
70-
*/
71-
.sessionManagement(session -> session
72-
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
73-
)
74-
/*
75-
Jwt 필터
76-
*/
77-
.addFilterBefore(authenticationFilter(authService, config),
78-
UsernamePasswordAuthenticationFilter.class)
79-
/*
80-
exceptionHandling
81-
*/
82-
.exceptionHandling(exceptions -> exceptions
83-
.authenticationEntryPoint(restAuthenticationEntryPoint())
84-
.accessDeniedHandler(accessDeniedHandler())
85-
);
36+
.authorizeHttpRequests(auth -> auth
37+
.requestMatchers(API_PREFIX + "/auth/**",
38+
API_PREFIX + "/events/**")
39+
.permitAll()
40+
.requestMatchers(API_PREFIX + "/admin/**").hasRole("ADMIN")
41+
.requestMatchers(API_PREFIX + "/central/**").hasRole("CLUB")
42+
.requestMatchers(actuatorPath).hasRole("ADMIN")
43+
.requestMatchers(GET,
44+
API_PREFIX + "/clubs/**",
45+
API_PREFIX + "/notices/**",
46+
API_PREFIX + "/banners/**",
47+
API_PREFIX + "/documents/**",
48+
API_PREFIX + "/questions/**",
49+
API_PREFIX + "/feeds/**")
50+
.permitAll()
51+
.requestMatchers(API_PREFIX + "/internal/**")
52+
.permitAll()
53+
.requestMatchers("/v3/api-docs/**", "/swagger-ui/**", "/swagger-resources/**")
54+
.permitAll()
55+
.anyRequest()
56+
.authenticated()
57+
)
58+
.cors(cors -> cors
59+
.configurationSource(corsConfigurationSource())
60+
)
61+
/*
62+
csrf, headers, http-basic, rememberMe, formLogin 비활성화
63+
*/
64+
.csrf(AbstractHttpConfigurer::disable)
65+
.headers(AbstractHttpConfigurer::disable)
66+
.httpBasic(AbstractHttpConfigurer::disable)
67+
.rememberMe(AbstractHttpConfigurer::disable)
68+
.formLogin(AbstractHttpConfigurer::disable)
69+
.logout(AbstractHttpConfigurer::disable)
70+
/*
71+
Session 설정
72+
*/
73+
.sessionManagement(session -> session
74+
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
75+
)
76+
/*
77+
Jwt 필터
78+
*/
79+
.addFilterBefore(authenticationFilter(authService, config),
80+
UsernamePasswordAuthenticationFilter.class)
81+
/*
82+
exceptionHandling
83+
*/
84+
.exceptionHandling(exceptions -> exceptions
85+
.authenticationEntryPoint(restAuthenticationEntryPoint())
86+
.accessDeniedHandler(accessDeniedHandler())
87+
);
8688

8789
return http.build();
8890
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package ddingdong.ddingdongBE.common.constant;
2+
3+
public class PageConstant {
4+
5+
public static final int DEFAULT_DOCUMENT_PAGE_SIZE = 10;
6+
}

src/main/java/ddingdong/ddingdongBE/common/converter/MultipartJackson2HttpMessageConverter.java

Lines changed: 0 additions & 31 deletions
This file was deleted.

src/main/java/ddingdong/ddingdongBE/common/exception/CustomExceptionHandler.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,10 @@ public ErrorResponse handleMethodArgumentNotValidException(MethodArgumentNotVali
117117
+ "\n"
118118
+ exception.getClass().getSimpleName() + " : " + message);
119119

120-
return new ErrorResponse(BAD_REQUEST.value(), exception.getMessage(), LocalDateTime.now()
120+
return new ErrorResponse(BAD_REQUEST.value(), message, LocalDateTime.now()
121121
);
122122
}
123123

124-
125124
// TODO : NoSuchElementException 대신 PersistenceException.ResourceNotFound()로 전환 필요
126125
@ExceptionHandler(NoSuchElementException.class)
127126
@ResponseStatus(BAD_REQUEST)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package ddingdong.ddingdongBE.common.exception;
2+
3+
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
4+
5+
sealed public class SseException extends CustomException {
6+
7+
public static final String SSE_NOT_FOUND_ERROR_MESSAGE = "SSE Not Found = ";
8+
9+
public SseException(String message, int errorCode) {
10+
super(message, errorCode);
11+
}
12+
13+
public static final class SseEmitterNotFound extends SseException {
14+
15+
public SseEmitterNotFound(String sseId) {
16+
super(SSE_NOT_FOUND_ERROR_MESSAGE + sseId, INTERNAL_SERVER_ERROR.value());
17+
}
18+
}
19+
}

src/main/java/ddingdong/ddingdongBE/common/utils/TimeParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public static LocalDateTime parseToLocalDateTime(String dateString) {
1717

1818
public static LocalDateTime processDate(String dateString, LocalDateTime currentDate) {
1919
if (dateString == null) {
20-
return currentDate;
20+
return null;
2121
}
2222

2323
if (dateString.isBlank()) {

0 commit comments

Comments
 (0)