Skip to content

Commit

Permalink
Merge pull request #142 from Menjil-Menjil/develop
Browse files Browse the repository at this point in the history
Refactor Domain: From chat to chatbot
  • Loading branch information
megymj authored Jan 3, 2024
2 parents de67728 + 68de697 commit 94c4b9a
Show file tree
Hide file tree
Showing 73 changed files with 2,729 additions and 2,552 deletions.
45 changes: 27 additions & 18 deletions .github/workflows/ci-dev.yml → .github/workflows/build-on-pr.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: CI in develop branch
name: Build on PR to develop and main branch

on:
push:
branches: [ "develop" ]
pull_request:
branches: [ "main", "develop" ]

permissions:
contents: read

# PR 코멘트 등록을 위한 write 권한
checks: write
pull-requests: write
Expand Down Expand Up @@ -42,17 +42,17 @@ jobs:
--health-retries=3
steps:
# workflow 실행 전 기본적으로 checkout 필요
# 최신 버전은 v3
- uses: actions/checkout@v3
## workflow 실행 전 기본적으로 checkout 필요
## 최신 버전은 v3
- uses: actions/checkout@v4
- name: Install Ubuntu dependencies
run: sudo apt-get update

- name: Set up JDK 11
uses: actions/setup-java@v3
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin' # jdk를 제공하는 vender사 이름 ex. zulu, adopt, microsoft
distribution: 'temurin' # Eclipse Temurin
java-version: '17'

## Create secret yml files before build
- name: create application-common, local, prod, test.yml
Expand Down Expand Up @@ -90,6 +90,12 @@ jobs:
- name: Build with Gradle
run: ./gradlew clean build

## Codecov
- name: Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./build/reports/jacoco/test/jacocoTestReport.xml

## 테스트 결과 PR 코멘트에 등록
- name: Register the test results as PR comments
Expand All @@ -98,16 +104,19 @@ jobs:
with:
files: '**/build/test-results/test/TEST-*.xml'

## 테스트 실패시 코드 라인에 대한 체크 추가
## 테스트 실패시 코드 라인에 대한 check comment 추가
- name: If test fail, add check comment on failed code line
uses: mikepenz/action-junit-report@v3
if: always()
with:
report_paths: '**/build/test-results/test/TEST-*.html'

## 테스트 결과 업로드
- name: Upload test report
uses: actions/upload-artifact@v3
with:
name: test-report
path: build/reports/tests/test/

# code-coverage:
# needs: build
# runs-on: ubuntu-latest
# steps:
# - name: Upload coverage reports to Codecov
# uses: codecov/codecov-action@v3
# env:
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
48 changes: 6 additions & 42 deletions .github/workflows/main.yml → .github/workflows/cd-main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Java CI with Gradle, CD with Docker Hub and AWS EC2 in main branch
name: CD in main branch

on:
push:
Expand All @@ -11,42 +11,15 @@ jobs:
build:
runs-on: ubuntu-latest

services:
mongodb:
image: mongo:4.4
options: >-
--health-cmd mongo
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 27017:27017

mysql:
image: mysql:8.0
env:
MYSQL_DATABASE: menjil-test
MYSQL_ROOT_PASSWORD: root
# MYSQL_USER: root
# MYSQL_PASSWORD: root33
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
steps:
# workflow 실행 전 기본적으로 checkout 필요
# 최신 버전은 v3
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up JDK 11
uses: actions/setup-java@v3
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin' # jdk를 제공하는 vender사 이름 ex. zulu, adopt, microsoft
distribution: 'temurin' # Eclipse Temurin
java-version: '17'

## Create secret yml files before build
- name: create application-common, local, prod, test.yml
Expand Down Expand Up @@ -75,15 +48,6 @@ jobs:
- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Verify MySQL connection
run: |
sleep 30
mysql --host 127.0.0.1 --port 3306 --user root --password=root -e "SHOW DATABASES;"
## Build
- name: Build with Gradle
run: ./gradlew clean build

## Docker
- name: Login to Docker Hub
uses: docker/login-action@v2
Expand Down
32 changes: 8 additions & 24 deletions .github/workflows/codecov.yml → .github/workflows/ci-develop.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
## Use codecov, and not Continuous Deployment & Delivery
name: Code Coverage in main, develop branch
name: CI in develop branch

on:
pull_request:
branches: [ "main", "develop" ]
push:
branches: [ "develop" ]

permissions:
contents: read
Expand Down Expand Up @@ -41,15 +40,15 @@ jobs:
steps:
# workflow 실행 전 기본적으로 checkout 필요
# 최신 버전은 v3
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Ubuntu dependencies
run: sudo apt-get update

- name: Set up JDK 11
uses: actions/setup-java@v3
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin' # jdk를 제공하는 vender사 이름 ex. zulu, adopt, microsoft
distribution: 'temurin' # Eclipse Temurin
java-version: '17'

## Create secret yml files before build
- name: create application-common, local, prod, test.yml
Expand Down Expand Up @@ -87,18 +86,3 @@ jobs:
- name: Build with Gradle
run: ./gradlew clean build

- name: Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./build/reports/jacoco/test/jacocoTestReport.xml


# code-coverage:
# needs: build
# runs-on: ubuntu-latest
# steps:
# - name: Upload coverage reports to Codecov
# uses: codecov/codecov-action@v3
# env:
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ jacocoTestReport {
"seoultech/capstone/menjil/**/*Request*",
"seoultech/capstone/menjil/**/*Response*",
"seoultech/capstone/menjil/domain/**/domain/**",
"seoultech/capstone/menjil/domain/chat/dto/**",
"seoultech/capstone/menjil/domain/chatbot/dto/**",
"seoultech/capstone/menjil/global/filter/*CustomCors*",
"**/*Config*",
"**/*Exception*"
Expand All @@ -176,7 +176,7 @@ jacocoTestCoverageVerification {
"**.*Request*",
"**.*Response*",
"**/domain/**/domain/**",
"**/domain/chat/dto/**",
"**/domain/chatbot/dto/**",
"**.*Config*",
"**.*CustomCors*",
"**.*Exception*"
Expand Down
72 changes: 60 additions & 12 deletions src/docs/asciidoc/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -72,42 +72,40 @@ operation::api/auth/signup/false-score-max[snippets='http-request']
operation::api/auth/signup/false-score-max[snippets='http-response']




== 로그인
=== 로그인
==== 성공
=== 성공
operation::api/auth/signin/success[snippets='http-request,request-fields']
operation::api/auth/signin/success[snippets='http-response,response-fields']

==== 실패
===== 플랫폼이 google, kakao 가 아닌 경우
=== 실패
==== 플랫폼이 google, kakao 가 아닌 경우
operation::api/auth/signin/fail-provider[snippets='http-request']
operation::api/auth/signin/fail-provider[snippets='http-response']


// ** 2. 팔로우 **
== 팔로우
=== 팔로우 요청
==== 팔로우가 되어있지 않은 경우
==== 성공
===== 팔로우가 되어있지 않은 경우
팔로우가 생성된다.

operation::api/follow/create/201/true[snippets='http-request,request-fields']
operation::api/follow/create/201/true[snippets='http-response,response-fields']

==== 이미 팔로우가 되어 있는 경우
===== 이미 팔로우가 되어 있는 경우
팔로우가 해제된다.

operation::api/follow/create/201/false[snippets='http-request,request-fields']
operation::api/follow/create/201/false[snippets='http-response,response-fields']

==== 서버 오류

==== 실패
===== 서버 내부 오류
operation::api/follow/create/500[snippets='http-request,request-fields']
operation::api/follow/create/500[snippets='http-response,response-fields']

=== 팔로우 상태 확인

=== 팔로우 상태 확인
==== 팔로우가 되어있는 경우
return true

Expand All @@ -125,7 +123,7 @@ operation::api/follow/check-status/false[snippets='http-response,response-fields
// ** 3. 팔로잉 페이지 **
== 팔로잉
=== 니의 팔로잉 목록 가져오기

-> 작성 중 ...


=== 팔로잉된 사용자의 상세 정보 조회
Expand All @@ -143,3 +141,53 @@ operation::api/following/info/200-only-userinfo[snippets='http-response']
operation::api/following/info/500-error[snippets='http-request']
operation::api/following/info/500-error[snippets='http-response,response-fields']


// ** 4. 챗봇 대화방 **
== 챗봇
=== 다른 사용자에게 질문하기
==== 성공
===== 기존에 챗봇 대화방이 존재하지 않는 경우(처음 질문하는 경우)
operation::api/chat-bot/room/enter/200/case2[snippets='http-request']
operation::api/chat-bot/room/enter/200/case2[snippets='http-response,response-fields']

===== 기존에 챗봇 대화방이 존재하는 경우
처음 질문하는 경우와 동일한 응답을 출력한다

operation::api/chat-bot/room/enter/200/case2-1[snippets='http-request']
operation::api/chat-bot/room/enter/200/case2-1[snippets='http-response,response-fields']

==== 실패
===== 사용자 정보가 존재하지 않는 경우
operation::api/chat-bot/room/enter/500/case1[snippets='http-request']
operation::api/chat-bot/room/enter/500/case1-1[snippets='http-response,response-fields']


=== 대화방 목록 불러오기
==== 성공
===== 기존에 존재하던 대화방이 1개인 경우
operation::api/chat-bot/rooms/200/case1[snippets='http-request,request-parameters']
operation::api/chat-bot/rooms/200/case1[snippets='http-response,response-fields']

==== 기존에 존재하던 대화방이 2개 이상 경우
operation::api/chat-bot/rooms/200/case1-1[snippets='http-request,request-parameters']
operation::api/chat-bot/rooms/200/case1-1[snippets='http-response,response-fields']

==== 대화방이 존재하지 않는 경우
operation::api/chat-bot/rooms/200/case2[snippets='http-request,request-parameters']
operation::api/chat-bot/rooms/200/case2[snippets='http-response,response-fields']


=== 대화방 퇴장하기
==== 성공
===== 정상적으로 퇴장에 성공한 경우
operation::api/chat-bot/room/quit/201/case1[snippets='http-request']
operation::api/chat-bot/room/quit/201/case1[snippets='http-response,response-fields']

==== 실패
===== 서버, DB 오류 등으로 인해 퇴장에 실패한 경우
operation::api/chat-bot/room/quit/500/case2[snippets='http-request']
operation::api/chat-bot/room/quit/500/case2[snippets='http-response,response-fields']




Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import seoultech.capstone.menjil.domain.auth.domain.User;

import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Optional;

// CRUD 함수를 JpaRepository 가 가지고 있다.
Expand All @@ -18,6 +19,8 @@ public interface UserRepository extends JpaRepository<User, String> {

Optional<User> findUserById(String id);

List<User> findAllByNicknameIn(List<String> nicknames); // 주어진 닉네임 리스트에 해당하는 모든 User 객체를 찾는 메서드

Page<User> findAll(@NotNull Pageable pageable);
}

Loading

0 comments on commit 94c4b9a

Please sign in to comment.