Skip to content

Commit 76c1c7a

Browse files
committed
fix: 충돌 해결
2 parents 76d647c + d9bc29f commit 76c1c7a

File tree

351 files changed

+9788
-8061
lines changed

Some content is hidden

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

351 files changed

+9788
-8061
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created
6+
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle
7+
8+
name: Deploy Backend Prod
9+
10+
on:
11+
workflow_dispatch:
12+
13+
defaults:
14+
run:
15+
working-directory: backend
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v3
23+
24+
- name: Set up JDK
25+
uses: actions/setup-java@v3
26+
with:
27+
java-version: '11'
28+
distribution: 'temurin'
29+
30+
- name: Build
31+
run: ./gradlew build --exclude-task test --exclude-task asciidoctor
32+
33+
- name: Test
34+
env:
35+
client-id: ${{ secrets.CLIENT_ID }}
36+
client-secret: ${{ secrets.CLIENT_SECRET }}
37+
jwt-secret-key: ${{ secrets.JWT_SECRET_KEY }}
38+
jwt-expire-length: ${{ secrets.JWT_EXPIRE_LENGTH }}
39+
run: ./gradlew test -Dmoamoa.allow-origins='*' -Doauth2.github.client-id=${{ env.client-id }} -Doauth2.github.client-secret=${{ env.client-secret }} -Dsecurity.jwt.token.secret-key=${{ env.jwt-secret-key }} -Dsecurity.jwt.token.expire-length=${{ env.jwt-expire-length }}
40+
41+
- name: SonarQube
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
45+
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
46+
run: ./gradlew sonarqube --info
47+
48+
- name : Deploy
49+
run: |
50+
curl ${{ secrets.DEPLOY_PROD_BACKEND_REQUEST_URL }}

.github/workflows/frontend.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
run: npm run build
3636

3737
- name: Test
38-
uses: cypress-io/github-action@v2
38+
uses: cypress-io/github-action@v4.2.0
3939
with:
4040
start: npm run start
4141
wait-on: "http://localhost:3000"

README.md

Lines changed: 46 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
# MOAMOA
1+
# 🪐 MOAMOA
22

3-
## Description
3+
<p align="center">
4+
<img src="https://user-images.githubusercontent.com/61091307/195328070-acd1d81f-2818-4931-be2c-f54e8365d30f.png" width="50%" />
5+
</p>
6+
7+
---
8+
9+
## 📝 Description
410

511
**What?**
612

@@ -17,11 +23,42 @@
1723

1824
---
1925

20-
## Crews
26+
## 🌐 사용자 요청 흐름도
27+
<p align="left">
28+
<img src="https://user-images.githubusercontent.com/61091307/195348433-2d28a9e4-1adb-4d13-a640-bd4e522048cb.png" />
29+
</p>
30+
31+
---
32+
33+
## 🚀 기술 스택
34+
35+
|프론트엔드 기술 스택|백엔드 기술 스택|
36+
|--|--|
37+
|<img src="https://user-images.githubusercontent.com/61091307/195329613-178f8f40-e29b-4563-bc90-3928f25899d5.png" />|<img src="https://user-images.githubusercontent.com/61091307/195329972-3a9c93f8-1e0c-4d5a-b3b6-8d5f065b6dc2.png" />|
38+
39+
### 인프라 기술 스택
40+
41+
<p align="left">
42+
<img src="https://user-images.githubusercontent.com/61091307/195334688-66c0aea8-dc30-40b8-b57b-71e9b0f94318.png" />
43+
</p>
44+
45+
---
46+
47+
## ⚙️ 인프라 구조
48+
<p align="left">
49+
<img src="https://user-images.githubusercontent.com/61091307/195333113-76b5549a-ad10-456c-9746-34886f13137f.png" />
50+
</p>
51+
52+
## 🛠 CI/CD
53+
<p align="left">
54+
<img src="https://user-images.githubusercontent.com/61091307/195333213-41325640-1fb8-45ca-a335-995b0da1e20c.png" />
55+
</p>
56+
57+
---
58+
59+
## 🙂 Crews (Members)
2160

22-
- [디우(김동규)](https://github.com/tco0427)
23-
- [태태(김태윤)](https://github.com/nan-noo)
24-
- [그린론(유재서)](https://github.com/jaejae-yoo)
25-
- [베루스(정진혁)](https://github.com/wilgur513)
26-
- [짱구(신승철)](https://github.com/sc0116)
27-
- [병민(윤병인)](https://github.com/airman5573)
61+
|[디우(김동규)](https://github.com/tco0427)|[태태(김태윤)](https://github.com/nan-noo)|[그린론(유재서)](https://github.com/jaejae-yoo)|[베루스(정진혁)](https://github.com/wilgur513)|[짱구(신승철)](https://github.com/sc0116)|[병민(윤병인)](https://github.com/airman5573)|
62+
|:------:|:------:|:------:|:------:|:------:|:------:|
63+
|Backend|FrontEnd|Backend|Backend|Backend|FrontEnd|
64+
|<img src="https://avatars.githubusercontent.com/u/57028386?v=4" />|<img src="https://avatars.githubusercontent.com/u/54002105?v=4" />|<img src="https://avatars.githubusercontent.com/u/61091307?v=4" />|<img src="https://avatars.githubusercontent.com/u/25394140?v=4" />|<img src="https://avatars.githubusercontent.com/u/47477359?v=4" />|<img src="https://avatars.githubusercontent.com/u/68623798?v=4" />|

backend/src/main/java/com/woowacourse/moamoa/auth/config/AuthConfig.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@ private HandlerInterceptor loginInterceptor() {
4545
.includePathPattern("/api/studies/**", HttpMethod.DELETE)
4646
.includePathPattern("/api/members/me/**", HttpMethod.GET)
4747
.includePathPattern("/api/auth/refresh", HttpMethod.GET)
48-
.includePathPattern("/api/my/studies", HttpMethod.GET)
49-
.includePathPattern("/api/studies/\\w+/community/articles/**", HttpMethod.GET)
50-
.includePathPattern("/api/studies/\\d+/reference-room/links", HttpMethod.GET);
48+
.includePathPattern("/api/my/studies", HttpMethod.GET);
5149
}
5250

5351
@Bean

backend/src/main/java/com/woowacourse/moamoa/common/advice/CommonControllerAdvice.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ public ResponseEntity<ErrorResponse> handleNotFound(final Exception e) {
6060
@ExceptionHandler(RuntimeException.class)
6161
public ResponseEntity<ErrorResponse> handleInternalServerError(RuntimeException e) {
6262
log.debug("RuntimeException : {}", e.getMessage());
63-
System.out.println("e.getMessage() = " + e.getMessage());
6463
return ResponseEntity.status(INTERNAL_SERVER_ERROR).body(new ErrorResponse("요청을 처리할 수 없습니다."));
6564
}
6665
}

backend/src/main/java/com/woowacourse/moamoa/study/domain/repository/StudyRepository.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,20 @@
33
import com.woowacourse.moamoa.study.domain.Study;
44
import java.util.List;
55
import java.util.Optional;
6+
import javax.persistence.LockModeType;
7+
import org.springframework.data.jpa.repository.Lock;
8+
import org.springframework.data.jpa.repository.Query;
9+
import org.springframework.data.repository.query.Param;
610

711
public interface StudyRepository {
812

913
Study save(Study study);
1014

1115
Optional<Study> findById(Long id);
1216

17+
@Lock(LockModeType.PESSIMISTIC_WRITE)
18+
@Query("select s from Study s where s.id = :id")
19+
Optional<Study> findByIdUpdateFor(@Param("id") Long id);
20+
1321
List<Study> findAll();
1422
}

backend/src/main/java/com/woowacourse/moamoa/study/service/StudyParticipantService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ public class StudyParticipantService {
2121
private final StudyRepository studyRepository;
2222
private final DateTimeSystem dateTimeSystem;
2323

24-
public synchronized void participateStudy(final Long memberId, final Long studyId) {
24+
public void participateStudy(final Long memberId, final Long studyId) {
2525
memberRepository.findById(memberId)
2626
.orElseThrow(MemberNotFoundException::new);
27-
final Study study = studyRepository.findById(studyId)
27+
final Study study = studyRepository.findByIdUpdateFor(studyId)
2828
.orElseThrow(StudyNotFoundException::new);
2929

3030
study.participate(memberId);
@@ -33,7 +33,7 @@ public synchronized void participateStudy(final Long memberId, final Long studyI
3333
public void leaveStudy(final Long memberId, final Long studyId) {
3434
memberRepository.findById(memberId)
3535
.orElseThrow(MemberNotFoundException::new);
36-
final Study study = studyRepository.findById(studyId)
36+
final Study study = studyRepository.findByIdUpdateFor(studyId)
3737
.orElseThrow(StudyNotFoundException::new);
3838

3939
final LocalDate now = dateTimeSystem.now().toLocalDate();

backend/src/main/resources/schema.sql

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,11 @@
1-
DROP TABLE IF EXISTS community;
2-
DROP TABLE IF EXISTS notice;
3-
DROP TABLE IF EXISTS study_tag;
4-
DROP TABLE IF EXISTS study_member;
5-
DROP TABLE IF EXISTS tag;
6-
DROP TABLE IF EXISTS category;
7-
DROP TABLE IF EXISTS review;
8-
DROP TABLE IF EXISTS study;
9-
DROP TABLE IF EXISTS member;
10-
DROP TABLE IF EXISTS token;
11-
121
CREATE TABLE thumbnail_image
132
(
143
id BIGINT PRIMARY KEY AUTO_INCREMENT,
15-
fileName VARCHAR(50),
16-
fileUrl VARCHAR(50)
4+
file_name VARCHAR(50) NOT NULL,
5+
file_url VARCHAR(50) NOT NULL
176
);
187

19-
CREATE TABLE member
8+
CREATE TABLE IF NOT EXISTS member
209
(
2110
id BIGINT PRIMARY KEY AUTO_INCREMENT,
2211
github_id BIGINT NOT NULL UNIQUE,
@@ -25,7 +14,7 @@ CREATE TABLE member
2514
profile_url VARCHAR(255)
2615
);
2716

28-
CREATE TABLE study
17+
CREATE TABLE IF NOT EXISTS study
2918
(
3019
id BIGINT PRIMARY KEY AUTO_INCREMENT,
3120
title VARCHAR(30) NOT NULL,
@@ -44,7 +33,7 @@ CREATE TABLE study
4433
FOREIGN KEY (owner_id) REFERENCES member (id)
4534
);
4635

47-
CREATE TABLE review
36+
CREATE TABLE IF NOT EXISTS review
4837
(
4938
id BIGINT PRIMARY KEY AUTO_INCREMENT,
5039
study_id BIGINT NOT NULL,
@@ -57,7 +46,7 @@ CREATE TABLE review
5746
FOREIGN KEY (member_id) REFERENCES member (id)
5847
);
5948

60-
CREATE TABLE link
49+
CREATE TABLE IF NOT EXISTS link
6150
(
6251
id BIGINT PRIMARY KEY AUTO_INCREMENT,
6352
study_id BIGINT NOT NULL,
@@ -71,22 +60,22 @@ CREATE TABLE link
7160
FOREIGN KEY (author_id) REFERENCES member (id)
7261
);
7362

74-
CREATE TABLE category
63+
CREATE TABLE IF NOT EXISTS category
7564
(
7665
id BIGINT PRIMARY KEY,
7766
name VARCHAR(255) NOT NULL
7867
);
7968

80-
CREATE TABLE tag
69+
CREATE TABLE IF NOT EXISTS tag
8170
(
82-
id BIGINT PRIMARY KEY AUTO_INCREMENT,
71+
id BIGINT PRIMARY KEY,
8372
name VARCHAR(255) NOT NULL,
8473
description VARCHAR(255) NOT NULL,
8574
category_id BIGINT,
8675
FOREIGN KEY (category_id) REFERENCES category (id)
87-
);
76+
);
8877

89-
CREATE TABLE study_tag
78+
CREATE TABLE IF NOT EXISTS study_tag
9079
(
9180
id BIGINT PRIMARY KEY AUTO_INCREMENT,
9281
study_id BIGINT,
@@ -95,7 +84,7 @@ CREATE TABLE study_tag
9584
FOREIGN KEY (tag_id) REFERENCES tag (id)
9685
);
9786

98-
CREATE TABLE study_member
87+
CREATE TABLE IF NOT EXISTS study_member
9988
(
10089
id BIGINT PRIMARY KEY AUTO_INCREMENT,
10190
study_id BIGINT,
@@ -105,7 +94,7 @@ CREATE TABLE study_member
10594
FOREIGN KEY (member_id) REFERENCES member (id)
10695
);
10796

108-
CREATE TABLE article
97+
CREATE TABLE IF NOT EXISTS article
10998
(
11099
id BIGINT PRIMARY KEY AUTO_INCREMENT,
111100
title VARCHAR(255) NOT NULL,
@@ -118,4 +107,4 @@ CREATE TABLE article
118107
deleted boolean NOT NULL,
119108
FOREIGN KEY (author_id) REFERENCES member (id),
120109
FOREIGN KEY (study_id) REFERENCES study (id)
121-
);
110+
);

backend/src/test/java/com/woowacourse/acceptance/steps/LoginSteps.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,23 @@ public class LoginSteps extends Steps {
1818
}
1919

2020
public static LoginSteps 짱구가() {
21-
return new LoginSteps(짱구_깃허브_프로필);
21+
return 사용자가(짱구_깃허브_프로필);
2222
}
2323

2424
public static LoginSteps 그린론이() {
25-
return new LoginSteps(그린론_깃허브_프로필);
25+
return 사용자가(그린론_깃허브_프로필);
2626
}
2727

2828
public static LoginSteps 디우가() {
29-
return new LoginSteps(디우_깃허브_프로필);
29+
return 사용자가(디우_깃허브_프로필);
3030
}
3131

3232
public static LoginSteps 베루스가() {
33-
return new LoginSteps(베루스_깃허브_프로필);
33+
return 사용자가(베루스_깃허브_프로필);
34+
}
35+
36+
public static LoginSteps 사용자가(final GithubProfileResponse response) {
37+
return new LoginSteps(response);
3438
}
3539

3640
public AfterLoginSteps 로그인하고() {
@@ -53,7 +57,7 @@ private String getIssuedBearerToken() {
5357
}
5458

5559
private String requestBearerToken() {
56-
final String authorizationCode = "Authorization Code";
60+
final String authorizationCode = "Authorization Code" + githubProfile.getGithubId();
5761
mockingGithubServer(authorizationCode, githubProfile);
5862

5963
final String token = RestAssured.given().log().all()

backend/src/test/java/com/woowacourse/acceptance/steps/StudyRelatedSteps.java

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,19 @@ public class StudyRelatedSteps extends Steps {
2323
this.token = token;
2424
}
2525

26-
public void 참여한다() {
26+
public HttpStatus 참여를_시도한다() {
27+
final int code = RestAssured.given().log().all()
28+
.header(CONTENT_TYPE, APPLICATION_JSON_VALUE)
29+
.header(AUTHORIZATION, token)
30+
.pathParam("study-id", studyId)
31+
.when().log().all()
32+
.post("/api/studies/{study-id}/members")
33+
.then().log().all()
34+
.extract().statusCode();
35+
return HttpStatus.valueOf(code);
36+
}
37+
38+
public void 참여에_성공한다() {
2739
RestAssured.given().log().all()
2840
.header(CONTENT_TYPE, APPLICATION_JSON_VALUE)
2941
.header(AUTHORIZATION, token)
@@ -106,4 +118,16 @@ public class StudyRelatedSteps extends Steps {
106118
return null;
107119
}
108120
}
121+
122+
public HttpStatus 탈퇴를_시도한다() {
123+
final int code = RestAssured.given().log().all()
124+
.header(CONTENT_TYPE, APPLICATION_JSON_VALUE)
125+
.header(AUTHORIZATION, token)
126+
.pathParam("study-id", studyId)
127+
.when().log().all()
128+
.delete("/api/studies/{study-id}/members")
129+
.then().log().all()
130+
.extract().statusCode();
131+
return HttpStatus.valueOf(code);
132+
}
109133
}

backend/src/test/java/com/woowacourse/acceptance/test/study/GettingMyStudiesAcceptanceTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ void getMyStudies() {
5353
LocalDate 지금 = LocalDate.now();
5454
long 자바_스터디_ID = 그린론이().로그인하고().자바_스터디를().시작일자는(지금).태그는(자바_태그_ID, BE_태그_ID).생성한다();
5555
long 리액트_스터디_ID = 디우가().로그인하고().리액트_스터디를().시작일자는(지금.plusDays(10)).생성한다();
56-
그린론이().로그인하고().스터디에(리액트_스터디_ID).참여한다();
56+
그린론이().로그인하고().스터디에(리액트_스터디_ID).참여에_성공한다();
5757
final String token = 그린론이().로그인한다();
5858

5959
final MemberResponse 그린론_정보 = 그린론이().로그인하고().정보를_가져온다();

backend/src/test/java/com/woowacourse/acceptance/test/study/GettingStudyDetailsAcceptanceTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ void getStudyDetails() {
5151
.시작일자는(지금).모집종료일자는(지금.plusDays(4)).종료일자는(지금.plusDays(10))
5252
.태그는(우테코4기_태그_ID, FE_태그_ID, 리액트_태그_ID).모집인원은(5)
5353
.생성한다();
54-
짱구가().로그인하고().스터디에(리액트_스터디).참여한다();
55-
그린론이().로그인하고().스터디에(리액트_스터디).참여한다();
56-
베루스가().로그인하고().스터디에(리액트_스터디).참여한다();
54+
짱구가().로그인하고().스터디에(리액트_스터디).참여에_성공한다();
55+
그린론이().로그인하고().스터디에(리액트_스터디).참여에_성공한다();
56+
베루스가().로그인하고().스터디에(리액트_스터디).참여에_성공한다();
5757

5858
RestAssured.given(spec).log().all()
5959
.filter(document("studies/details"))

0 commit comments

Comments
 (0)