Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Review 요청 #286

Open
wants to merge 71 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
e3090c9
[FEAT] 백엔드 프로젝트 설정 (#3)
kimminkyeu Sep 12, 2024
de173ae
Update README.md
kimminkyeu Sep 12, 2024
fe6f213
Update .env.sample
kimminkyeu Sep 12, 2024
3d581b5
feat : backend pr 빌드봇 추가 (#6)
Gyaak Sep 12, 2024
7a89b31
feat: swagger 설정 추가 (#13)
Gyaak Sep 16, 2024
89f07d7
feat: ERD 기반 Entity 정의 (#15)
kimminkyeu Sep 16, 2024
3ac2b26
feat: RSS 기능 구현 (#22)
sangwonsheep Sep 17, 2024
910c83c
feat: Entity 재정의 (#26)
sangwonsheep Sep 21, 2024
3f48222
feat: 엔티티 최종 수정 (#34)
kimminkyeu Sep 22, 2024
58374c0
feat: 디렉토리 구조 및 공통 예외처리 설정 (#43)
kimminkyeu Sep 24, 2024
a19c775
feat: 소셜로그인 구현 (#44)
Gyaak Sep 24, 2024
4cf6e65
refactor: 에러 코드 기능별 분리 (#49)
kimminkyeu Sep 25, 2024
3d99ede
feat: 테스트 api 서버 배포 (#64)
kimminkyeu Sep 27, 2024
fbfe881
feat: RSS 기능 구현 (#46)
sangwonsheep Sep 27, 2024
ca92e96
Update test-server-deploy.yml
kimminkyeu Sep 27, 2024
2a7c665
[feat] Link CRUD 구현 (#63)
Gyaak Sep 28, 2024
b4f044b
refactor: PickTag 엔티티 필드 변경 user->pick (#73)
Gyaak Sep 28, 2024
27381b8
[feat] 태그 API 구현 (#71)
Gyaak Sep 30, 2024
1d1c058
[test] 테스트용 mysql 분리 (#79)
Gyaak Sep 30, 2024
dd4a1ae
Refactor: Security, Exception, Package 리팩토링 (#82)
kimminkyeu Sep 30, 2024
2e4b2b8
[refactor] 태그 수정 검증로직 추가 및 태그 순서 필드명 수정 (#89)
Gyaak Sep 30, 2024
b00206d
[test] 테스트 Fixture 구현 (#86)
Gyaak Oct 1, 2024
01f231b
Feat: 테스트 서버 API 설정 (#91)
kimminkyeu Oct 1, 2024
80513e7
Refactor: RSS Exception 처리 (#81)
sangwonsheep Oct 1, 2024
56c0d7d
refactor: oauth uri 변경 (#94)
Gyaak Oct 1, 2024
2a3899a
fix: /api/login uri 접근 허용 (#97)
Gyaak Oct 1, 2024
08069a9
fix: /api/login uri 접근 허용 (#99)
Gyaak Oct 1, 2024
0cb1431
refactor: cors 설정 추가 (#102)
Gyaak Oct 1, 2024
16482cf
feat: mysql에서 rss blog url sql 파일 import (#100)
sangwonsheep Oct 1, 2024
7eef4ab
refactor: 미사용 설정 / 파일 제거 (#105)
kimminkyeu Oct 1, 2024
c933588
refactor: 스케줄러 설정 추가 (#110)
sangwonsheep Oct 2, 2024
84279e3
[feat] Folder 기본 설계 (#111)
Gyaak Oct 2, 2024
2c29aca
[feat] FolderStructure 설계 (#113)
Gyaak Oct 2, 2024
22eca1e
Feat: Parser Dto 및 구조 작성 (#118)
kimminkyeu Oct 2, 2024
04007bc
[feat] Folder Service 구현 (#121)
Gyaak Oct 3, 2024
431f924
feat: Pick DTO 설계 (#124)
sangwonsheep Oct 3, 2024
6ffaa1f
[FEAT] 프론트 로그인 로컬 테스트를 위한 redirect url 설정 (#129)
Gyaak Oct 3, 2024
55d323d
[REFACTOR] 기본 폴더 CRUD 관련 리팩토링 (#127)
Gyaak Oct 3, 2024
9ab167c
refactor: 프론트 로컬 테스트를 위한 설정 (#135)
Gyaak Oct 4, 2024
c3e9813
[REFACTOR] 프론트 로컬 테스트를 위한 설정 (#137)
Gyaak Oct 4, 2024
3296861
fix: @NotNull 어노테이션 제거 (#132)
Gyaak Oct 4, 2024
40aab86
[FEAT] 기본 폴더로 root 폴더 추가 (#140)
Gyaak Oct 5, 2024
28cf8cf
[feat] 클라이언트 폴더 구조 JSON 파싱 (#147)
kimminkyeu Oct 6, 2024
6ea9b94
[FEAT] FolderService 추가 비즈니스 로직 구현 및 리팩토링 (#143)
Gyaak Oct 6, 2024
45859d8
feat: 로그인 확인용 쿠키(techPickLogin) 구현 (#155)
Gyaak Oct 7, 2024
05d4ba9
[HOTFIX] 로그인 쿠키 버그 수정 (#156)
Gyaak Oct 7, 2024
0d6b8b9
[FEAT] 직렬화 비직렬화 및 데이터 세팅 과정 구현 (#151)
kimminkyeu Oct 7, 2024
41a6a52
[FEAT] Folder Api 구현 및 FolderService 리팩토링 (#161)
Gyaak Oct 7, 2024
6e1e53b
[FEAT] Structure와 연관된 Pick Service 구현 (#163)
sangwonsheep Oct 7, 2024
efa0a8e
[FEAT] Structure API 구현 및 Folder Create 로직 수정 (#164)
Gyaak Oct 8, 2024
9ca96d3
hotfix: getParentFolderId -> findParentFolderId JPA 오류 수정
Gyaak Oct 8, 2024
4222e3d
refactor: access_token 사용하도록 설정 (#175)
Gyaak Oct 8, 2024
02a1ead
[FEAT] Structure Validator 구현 (#178)
Gyaak Oct 8, 2024
f765b8b
[HOTFIX] swagger 쿠키 설정 수정 (#179)
Gyaak Oct 9, 2024
2733441
hotfix: swagger 쿠키 설정 수정
Gyaak Oct 9, 2024
e88f14b
hotfix: samesite 설정 제거
Gyaak Oct 9, 2024
4dd68ed
[REFACTOR] UserService 구현 포함, 전체 코드 리팩토링 (#180)
kimminkyeu Oct 10, 2024
ab39ffe
:sparkles: feat: 태그 color 추가 (#185)
kimminkyeu Oct 10, 2024
a9f6179
:bug: fix: 익스텐션 CORS 추가
kimminkyeu Oct 11, 2024
4180b1c
[FEAT] Pick API + Service 구현 (#186)
sangwonsheep Oct 11, 2024
f519c1c
[HOTFIX] Valid 관련 에러 설정 (#189)
sangwonsheep Oct 11, 2024
5c6fb2a
:bug: fix: link 생성 순서 오류 수정 및 swagger에 baseURL 수정
kimminkyeu Oct 11, 2024
cd504d0
[CI] API V2 브랜치 - 서버 설정 (#195)
kimminkyeu Oct 12, 2024
72e66ac
[REFACTOR] V2를 위한 패키지 리셋 (#237)
Gyaak Oct 16, 2024
21ee420
[FEAT] V2 엔티티 설계 (#240)
Gyaak Oct 17, 2024
273b7d0
[FEAT] V2 패키지 구조 재설계 (#258)
kimminkyeu Oct 17, 2024
861d659
[CHORE] API 명세 (#264)
kimminkyeu Oct 17, 2024
94451c9
[FEAT] pick v2 도메인 개발 (#278)
kimminkyeu Oct 21, 2024
d7a835c
[REFACTOR] pick service 코드에서 chaining 제거 (#280)
kimminkyeu Oct 21, 2024
8f77d70
[FEAT] Tag v2 Service 구현 (#281)
sangwonsheep Oct 21, 2024
34ed09d
[FIX] Pick API 예외 미흡 수정 (#283)
kimminkyeu Oct 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/backend_pr_bot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Java Spring Build Checker

on:
pull_request:
paths:
- 'backend/src/**'
- 'backend/build.gradle'
branches:
- backend
workflow_dispatch:
inputs:
comment:
description: '수동 trigger 사유'
default: 'ex) 서버 설정 변경 등'

permissions:
checks: write
pull-requests: write

jobs:
build:
name: Build check
runs-on: ubuntu-latest
env:
working-directory: backend
steps:
- name: Checkout the code
uses: actions/checkout@v3

- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'corretto'
cache: 'gradle'

- name: Setup MySQL
uses: mirromutth/[email protected]
with:
mysql database: 'techpick_db'
mysql user: ${{ secrets.DOCKER_MYSQL_USERNAME }}
mysql password: ${{ secrets.DOCKER_MYSQL_PASSWORD }}

# - name: Make application.yaml
# run: |
# cd ./src/main/resources
# touch ./application.yaml
# echo "${{ secrets.APPLICATION_YAML }}" >> ./application.yaml
# shell: bash
# working-directory: ${{ env.working-directory }}

- name: Grant execute permission for gradlew
run: chmod +x gradlew
working-directory: ${{ env.working-directory }}

- name: Build with Gradle
run: ./gradlew clean build --debug --exclude-task test
working-directory: ${{ env.working-directory }}
122 changes: 122 additions & 0 deletions .github/workflows/test-server-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@

# Reference
# - (1) https://docs.docker.com/build/ci/github-actions/#examples
# - (2) https://github.com/Kernel360/E2E2-LOOK-US/blob/deploy/.github/workflows/deploy.yml

name: Tech-pick V2 Testing Server Deploy

on:
push:
branches:
- "backend-v2" # backend v2 브랜치
env:
api-version: 'v2' # 브랜치 명과 반드시 동일할 것!!!

jobs:
build:
runs-on: ubuntu-latest
steps:
-
# 저장소 Checkout
name: Checkout source code
uses: actions/checkout@v4
-
# Gradle 실행 권한 부여
name: Grant execute permission to gradlew
run: chmod +x ./backend/gradlew
-
# JDK 설치
name: Set up JDK corretto:17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'corretto'
-
# Spring boot application 빌드
name: Build with gradle
run: |
cd ./backend
./gradlew clean build -x test
-
# Docker image 빌드
name: Build docker image
run: |
cd ./backend
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/techpick:${{ env.api-version }}-${{ github.sha }} .
-
# Docker hub 로그인
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
# Docker hub 업로드
name: Publish to docker hub
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/techpick:${{ env.api-version }}-${{ github.sha }}
-
# 서버 ssh 접속 후 방금 올린 이미지 pull 받고 실행
name: Deploy on Test-Server
uses: appleboy/ssh-action@master
with:
host: minlife.me # test home server
port: 4242
username: root # root user
password: ${{ secrets.SSH_TEST_SERVER_KYEU_PASSWORD }}
script: |

echo "login docker hub for private repository access ..."
echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin

echo "docker - pulling..."
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/techpick:${{ env.api-version }}-${{ github.sha }}

echo "docker - changing image name and tag ..."
docker tag ${{ secrets.DOCKERHUB_USERNAME }}/techpick:${{ env.api-version }}-${{ github.sha }} techpick:${{ env.api-version }}-staging

cd /home/project/techpick

echo "create .env file with github repository's ENV setting ..."

cd /home/project/techpick/database
rm -rf .env
touch .env
echo "DOCKER_MYSQL_USERNAME=${{ secrets.DOCKER_MYSQL_USERNAME }}" >> .env
echo "DOCKER_MYSQL_PASSWORD=${{ secrets.DOCKER_MYSQL_PASSWORD }}" >> .env

cd /home/project/techpick/${{ env.api-version }}
rm -rf .env
touch .env

echo "DOCKER_MYSQL_USERNAME=${{ secrets.DOCKER_MYSQL_USERNAME }}" >> .env
echo "DOCKER_MYSQL_PASSWORD=${{ secrets.DOCKER_MYSQL_PASSWORD }}" >> .env
echo "DOCKER_MYSQL_DATABASE=${{ secrets.DOCKER_MYSQL_DATABASE }}_${{ env.api-version }}" >> .env
echo "DOCKER_MYSQL_URL=jdbc:mysql://techpick-mysql:3306/${{ secrets.DOCKER_MYSQL_DATABASE }}_${{ env.api-version }}?createDatabaseIfNotExist=true" >> .env
echo "JWT_SECRET=${{ secrets.JWT_SECRET }}" >> .env
echo "JWT_ISSUER=${{ secrets.JWT_ISSUER }}" >> .env
echo "GOOGLE_CLIENT_ID=${{ secrets.GOOGLE_CLIENT_ID }}" >> .env
echo "GOOGLE_CLIENT_SECRET=${{ secrets.GOOGLE_CLIENT_SECRET }}" >> .env
echo "KAKAO_CLIENT_ID=${{ secrets.KAKAO_CLIENT_ID }}" >> .env
echo "KAKAO_CLIENT_SECRET=${{ secrets.KAKAO_CLIENT_SECRET }}" >> .env
echo "NAVER_CLIENT_ID=${{ secrets.NAVER_CLIENT_ID }}" >> .env
echo "NAVER_CLIENT_SECRET=${{ secrets.NAVER_CLIENT_SECRET }}" >> .env
echo "TECHPICK_BASE_URL=https://${{ env.api-version }}.${{ secrets.TECHPICK_DOMAIN }}" >> .env

docker-compose down
docker compose up -d

echo "docker - pruning images that passed 24h ..."
docker image prune -af --filter "until=24h"
-
# 배포 Action 실행 결과 깃허브 알림
name: Discord Webhook Action
uses: sarisia/[email protected]
if: always()
with:
webhook: ${{ secrets.DISCORD_WEBHOOK_URL }}
status: ${{ job.status }}
title: "Test API ${{ env.api-version }} Deployment Action Result"
description: "테스트 API ${{ env.api-version }} 서버 배포 완료"
color: 0xff91a4
url: "https://github.com/sarisia/actions-status-discord"
username: GitHub Actions
18 changes: 18 additions & 0 deletions backend/.env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
DOCKER_MYSQL_USERNAME=root
DOCKER_MYSQL_PASSWORD=1234
DOCKER_MYSQL_DATABASE=TECHPICK_DB
DOCKER_MYSQL_URL=jdbc:mysql://localhost:3306/TECHPICK_DB?createDatabaseIfNotExist=true

TECHPICK_BASE_URL=localhost:8080

JWT_ISSUER=TECHPICK
JWT_SECRET=

GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=

KAKAO_CLIENT_ID=
KAKAO_CLIENT_SECRET=

NAVER_CLIENT_ID=
NAVER_CLIENT_SECRET=
44 changes: 44 additions & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
*.env
data/mysql-data

HELP.md
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/

.DS_Store
._.DS_Store
**/.DS_Store
**/._.DS_Store
13 changes: 13 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM amazoncorretto:17

LABEL authors="TechPick"

ARG JAR_FILE=build/libs/*.jar

WORKDIR /app

COPY ${JAR_FILE} /app/app.jar

EXPOSE 8080

ENTRYPOINT ["java", "-jar", "-Duser.timezone=Asia/Seoul", "/app/app.jar"]
77 changes: 77 additions & 0 deletions backend/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
plugins {
id 'java'
id 'org.springframework.boot' version '3.3.3'
id 'io.spring.dependency-management' version '1.1.6'
}

group = 'kernel360'
version = '0.0.1-SNAPSHOT'

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}

configurations {
compileOnly {
extendsFrom annotationProcessor
}
}

repositories {
mavenCentral()
}

dependencies {
// spring boot
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.17.2'
implementation 'org.springframework.retry:spring-retry'
implementation 'org.springframework.boot:spring-boot-starter-validation'

runtimeOnly 'com.mysql:mysql-connector-j'

// lombok annotation
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testCompileOnly 'org.projectlombok:lombok'
testAnnotationProcessor 'org.projectlombok:lombok'

// Sql logging formatter
// reference: https://www.baeldung.com/java-p6spy-intercept-sql-logging
implementation 'com.github.gavlyukovskiy:p6spy-spring-boot-starter:1.9.2' //이쁘게

// logback logger
implementation 'ch.qos.logback:logback-classic:1.4.12'
implementation 'org.slf4j:slf4j-api:2.0.3'

// test environment
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
testRuntimeOnly 'com.mysql:mysql-connector-j'

// springdoc swagger dependency
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.6.0'

// spring security and oauth client
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
testImplementation 'org.springframework.security:spring-security-test'

// jwt
implementation 'io.jsonwebtoken:jjwt:0.9.1'
implementation 'javax.xml.bind:jaxb-api:2.3.1' //xml 문서와 자바 객체 간 매핑을 자동화

// Thymeleaf 테스트 혹은 관리자에서 추후에 사용하기 위해서 추가
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'

// map struct
implementation 'org.mapstruct:mapstruct:1.5.3.Final'
annotationProcessor 'org.mapstruct:mapstruct-processor:1.5.3.Final'
}

tasks.named('test') {
useJUnitPlatform()
}
9 changes: 9 additions & 0 deletions backend/data/mysql-files/data.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- BULK INSERT (STATIC DATA)

LOAD DATA INFILE '/var/lib/mysql-files/develop/rss_blog.csv'
INTO TABLE rss_blog
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
IGNORE 1 LINES
(@source_name, @url)
SET rss_feed_url = @url, created_at = now(), updated_at = now();
26 changes: 26 additions & 0 deletions backend/data/mysql-files/rss_blog.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
source_name,url
카카오페이,https://tech.kakaopay.com/rss
NHN Cloud,https://meetup.toast.com/rss
데브시스터즈,https://tech.devsisters.com/rss.xml
뱅크샐러드,https://blog.banksalad.com/rss.xml
마켓컬리,https://helloworld.kurly.com/feed
Gmarket,https://dev.gmarket.com/rss
무신사,https://medium.com/feed/musinsa-tech
여기어때,https://techblog.gccompany.co.kr/feed
올리브영,https://oliveyoung.tech/rss.xml
AWS,https://aws.amazon.com/ko/blogs/korea/feed/
Toss,https://toss.tech/rss.xml
우아한형제들,https://techblog.woowahan.com/feed/
카카오,https://tech.kakao.com/posts/feed
라인,https://techblog.lycorp.co.jp/ko/feed/index.xml
SK플래닛,https://techtopic.skplanet.com/rss
스마일게이트,https://smilegate.ai/feed/
29CM,https://medium.com/feed/29cm
CJ OnStyle,https://medium.com/feed/cj-onstyle
브랜디,https://labs.brandi.co.kr/feed
넷마블,https://netmarble.engineering/rss
11번가,https://11st-tech.github.io/rss/
원티드,https://medium.com/feed/wantedjobs
인프랩,https://tech.inflab.com/rss.xml
티빙,https://medium.com/feed/tving-team
리디,https://ridicorp.com/story-category/tech-blog/feed/
Loading
Loading