Skip to content

Commit f85c180

Browse files
authored
Merge pull request #404 from woowacourse-teams/develop
chore: v0.3.0 배포
2 parents d6d6aaa + 87aa3b7 commit f85c180

File tree

207 files changed

+7312
-2158
lines changed

Some content is hidden

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

207 files changed

+7312
-2158
lines changed

.github/workflows/ci-backend.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: CI-BackEnd
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
- develop
8+
paths:
9+
- backend/**
10+
- .github/**
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-22.04
15+
16+
defaults:
17+
run:
18+
working-directory: ./backend
19+
20+
steps:
21+
- uses: actions/checkout@v3
22+
23+
- name: Install Java
24+
uses: actions/setup-java@v3
25+
with:
26+
java-version: "11"
27+
distribution: "temurin"
28+
29+
- name: Grant execute permisson for gradlew
30+
run: chmod +x gradlew
31+
32+
- name: Build with Gradle
33+
run: ./gradlew clean build

.github/workflows/ci-frontend.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: CI-FrontEnd
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
- develop
8+
paths:
9+
- frontend/**
10+
- .github/**
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-22.04
15+
16+
defaults:
17+
run:
18+
working-directory: ./frontend
19+
20+
steps:
21+
- uses: actions/checkout@v3
22+
23+
- name: Install Node
24+
uses: actions/setup-node@v3
25+
with:
26+
node-version: 18
27+
28+
- name: Istall dependencies
29+
run: yarn
30+
31+
- name: Build page
32+
run: yarn build

.github/workflows/frontend-test.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Test - FrontEnd
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
- develop
8+
paths:
9+
- frontend/**
10+
- .github/**
11+
12+
defaults:
13+
run:
14+
working-directory: frontend
15+
16+
jobs:
17+
jest-test:
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- uses: actions/checkout@v3
22+
23+
- name: Install Node
24+
uses: actions/setup-node@v3
25+
with:
26+
node-version: 18
27+
28+
- name: Install dependencies
29+
run: yarn
30+
31+
- name: Run Jest tests
32+
run: |
33+
yarn test

.github/workflows/sonarqube.yml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: sonarqube
2+
on:
3+
push:
4+
branches:
5+
- main
6+
- develop
7+
paths:
8+
- backend/**
9+
pull_request:
10+
branches:
11+
- main # or the name of your main branch
12+
- develop
13+
paths:
14+
- backend/**
15+
types: [opened, synchronize]
16+
17+
jobs:
18+
build:
19+
defaults:
20+
run:
21+
working-directory: ./backend
22+
name: Build
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v2
26+
with:
27+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
28+
- name: Set up JDK 11
29+
uses: actions/setup-java@v1
30+
with:
31+
java-version: 11
32+
- name: Cache SonarQube packages
33+
uses: actions/cache@v1
34+
with:
35+
path: ~/.sonar/cache
36+
key: ${{ runner.os }}-sonar
37+
restore-keys: ${{ runner.os }}-sonar
38+
- name: Cache Gradle packages
39+
uses: actions/cache@v1
40+
with:
41+
path: ~/.gradle/caches
42+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
43+
restore-keys: ${{ runner.os }}-gradle
44+
- name: Build and analyze
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
48+
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
49+
run: ./gradlew build sonarqube --warn

backend/.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
/logs/
1+
/logs/
2+
/src/main/resources/static/

backend/build.gradle

+29-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ plugins {
22
id 'org.springframework.boot' version '2.6.9'
33
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
44
id 'org.asciidoctor.jvm.convert' version '3.3.2'
5+
id 'org.sonarqube' version '3.4.0.2513'
56
id 'java'
7+
id 'jacoco'
68
}
79

810
group = 'com.woowacourse'
@@ -34,6 +36,7 @@ dependencies {
3436
implementation 'org.springframework.boot:spring-boot-starter-validation'
3537
implementation 'org.springframework.boot:spring-boot-starter-web'
3638
implementation 'org.flywaydb:flyway-core:6.4.2'
39+
implementation 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.3'
3740
compileOnly 'org.projectlombok:lombok'
3841
runtimeOnly 'com.h2database:h2:1.4.200'
3942
runtimeOnly 'mysql:mysql-connector-java'
@@ -52,6 +55,19 @@ dependencies {
5255
tasks.named('test') {
5356
outputs.dir snippetsDir
5457
useJUnitPlatform()
58+
finalizedBy 'jacocoTestReport'
59+
}
60+
61+
jacoco {
62+
toolVersion = "0.8.7"
63+
}
64+
65+
jacocoTestReport {
66+
reports {
67+
xml.enabled true
68+
csv.enabled false
69+
html.enabled false
70+
}
5571
}
5672

5773
tasks.named('asciidoctor') {
@@ -66,14 +82,20 @@ asciidoctor.doFirst {
6682
}
6783

6884
task createDocument(type: Copy) {
69-
dependsOn asciidoctor
70-
from file("build/docs/asciidoc")
71-
into file("src/main/resources/static")
85+
dependsOn asciidoctor
86+
from file("build/docs/asciidoc")
87+
into file("src/main/resources/static")
7288
}
7389

7490
bootJar {
75-
dependsOn createDocument
76-
from("${asciidoctor.outputDir}") {
77-
into 'static/docs'
78-
}
91+
dependsOn createDocument
92+
from("${asciidoctor.outputDir}") {
93+
into 'static/docs'
94+
}
95+
}
96+
97+
sonarqube {
98+
properties {
99+
property "sonar.projectKey", "woowacourse-teams_2022-nae-pyeon_AYKuzmWfelLz0D2BhgWj"
100+
}
79101
}

backend/src/docs/asciidoc/errorCodes.adoc

+21-36
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,12 @@
3434
| `2003`
3535
| 해당 회원은 작성자가 아닙니다. id={%d}
3636
| 해당 글의 작성자가 아닙니다.
37-
| `403 Forbidden.`
37+
| `403 Forbidden`
38+
39+
| `2004`
40+
| 모임에게 작성하는 메시지는 비밀로 작성할 수 없습니다. rollingpaperId = {%d}
41+
| 모임에게 작성하는 메시지는 비밀로 작성할 수 없습니다.
42+
| `400 Bad Request`
3843
|===
3944

4045
=== 유저 에러
@@ -52,41 +57,6 @@
5257
| 유효하지 않은 이메일입니다.
5358
| `400 Bad Request`
5459

55-
| `3003`
56-
| 이미 이메일이 중복되는 회원이 존재합니다.
57-
| 이미 가입된 이메일입니다.
58-
| `403 Forbidden.`
59-
60-
| `3004`
61-
| 유저네임은 공백일 수 없습니다
62-
| 유저네임은 공백일 수 없습니다
63-
| `400 Bad Request`
64-
65-
| `3005`
66-
| 유저네임은 2자 이상 20자 이하여야 합니다. username={%s}
67-
| 유저네임은 2자 이상 20자 이하여야 합니다.
68-
| `400 Bad Request`
69-
70-
| `3006`
71-
| 올바르지 않은 username입니다. username={%s}
72-
| 유저네임은 영어, 한국어, 숫자로 구성해야 합니다.
73-
| `400 Bad Request`
74-
75-
| `3007`
76-
| 비밀번호는 공백일 수 없습니다.
77-
| 비밀번호는 공백일 수 없습니다.
78-
| `400 Bad Request`
79-
80-
| `3008`
81-
| 비밀번호는 8자 이상 20자 이하여야 합니다. password={%s}
82-
| 해당 글의 작성자가 아닙니다.
83-
| `400 Bad Request`
84-
85-
| `3009`
86-
| 비밀번호는 최소 하나 이상의 알파벳과 숫자로 구성해야 합니다. password={%s}
87-
| 비밀번호는 최소 하나 이상의 알파벳과 숫자로 구성해야 합니다.
88-
| `400 Bad Request`
89-
9060
| `3010`
9161
| 이메일 정규식에 위반되는 이메일입니다. email = {%s}
9262
| 이메일 또는 비밀번호가 일치하지 않습니다.
@@ -176,4 +146,19 @@
176146
| 해당 모임에 가입해야 가능한 작업입니다. teamId={%d}, memberId={%d}
177147
| 해당 모임에 가입해야 가능한 작업입니다.
178148
| `403 Forbidden`
149+
150+
| `4015
151+
| 올바르지 않은 토큰입니다.
152+
| 올바르지 않은 토큰입니다.
153+
| `400 Bad Request`
154+
155+
| `4016`
156+
| 토큰의 유효기간이 만료됐습니다.
157+
| 토큰의 유효기간이 만료됐습니다.
158+
| `400 Bad Request`
159+
160+
| `4017`
161+
| 토큰의 secret key가 변조됐습니다. 해킹의 우려가 존재합니다.
162+
| 토큰의 secret key가 변조됐습니다. 해킹의 우려가 존재합니다.
163+
| `400 Bad Request`
179164
|===

backend/src/docs/asciidoc/teams.adoc

+9
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,12 @@ operation::team-controller-test/get-my-info-in-team[snippets='http-request,http-
2929

3030
=== 모임에서 내 정보 수정
3131
operation::team-controller-test/update-my-info[snippets='http-request,http-response']
32+
33+
=== 모임의 초대 코드 생성
34+
operation::team-controller-test/create-invite-token[snippets='http-request,http-response']
35+
36+
=== 초대 코드로 어떤 팀의 초대 코드인지 조회
37+
operation::team-controller-test/get-team-id-by-invite-token[snippets='http-request,http-response']
38+
39+
=== 초대 코드로 팀 가입
40+
operation::team-controller-test/invite-join[snippets='http-request,http-response']
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,32 @@
11
package com.woowacourse.naepyeon.config;
22

3+
import com.woowacourse.naepyeon.config.logging.LoggingInterceptor;
4+
import lombok.RequiredArgsConstructor;
35
import org.springframework.context.annotation.Configuration;
46
import org.springframework.http.HttpHeaders;
57
import org.springframework.web.servlet.config.annotation.CorsRegistry;
8+
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
69
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
710

811
@Configuration
12+
@RequiredArgsConstructor
913
public class WebConfig implements WebMvcConfigurer {
1014

1115
public static final String ALLOWED_METHOD_NAMES = "GET,HEAD,POST,PUT,DELETE,TRACE,OPTIONS,PATCH";
1216

17+
private final LoggingInterceptor loggingInterceptor;
18+
1319
@Override
1420
public void addCorsMappings(final CorsRegistry registry) {
1521
registry.addMapping("/**")
1622
.allowedOrigins("*")
1723
.allowedMethods(ALLOWED_METHOD_NAMES.split(","))
1824
.exposedHeaders(HttpHeaders.LOCATION);
1925
}
26+
27+
@Override
28+
public void addInterceptors(final InterceptorRegistry registry) {
29+
registry.addInterceptor(loggingInterceptor)
30+
.addPathPatterns("/**");
31+
}
2032
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.woowacourse.naepyeon.config.logging;
2+
3+
public class LogForm {
4+
5+
public static final String SUCCESS_REQUEST_FORM = "\n HTTP Method : {} " +
6+
"\n Request URI : {} " +
7+
"\n AccessToken Exist : {} " +
8+
"\n Request Body : {}";
9+
10+
public static final String FAILED_LOGGING_FORM = "\nOccur Handle Exception!!" +
11+
"\n HTTP Method : {} " +
12+
"\n Request URI : {} " +
13+
"\n AccessToken Exist : {} " +
14+
"\n Request Body : {}" +
15+
"\n Http Status Code : {} " +
16+
"\n Error Message : {}";
17+
18+
public static final String STACK_TRACE_HEADER = "\nException Stack Trace\n";
19+
}

0 commit comments

Comments
 (0)