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

[REFACTOR] 전체 구조 리팩토링 #203

Merged
merged 57 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
beedb29
[REFACTOR] 모듈 1차 분리
thguss Feb 6, 2024
b82ea75
[REFACTOR] 모듈 분리
thguss Feb 6, 2024
ce7acf3
Refactor: 멀티모듈 구조 리팩토링
unanchoi Feb 6, 2024
caecdcb
Refactor: Test Directory Package 이동
unanchoi Feb 6, 2024
c80dc5d
[ADD] Success Code 추가
thguss Feb 6, 2024
fcf8110
[REFACTOR] API 공통 Response DTO 리팩토링
thguss Feb 6, 2024
390612c
[FIX] Auth : Success Code 및 DTO 반영
thguss Feb 6, 2024
f7da888
[FIX] Badge : Success Code 및 DTO 반영
thguss Feb 6, 2024
c2b6f40
[FIX] Diary : Success Code 및 DTO 반영
thguss Feb 6, 2024
5a1cca2
[FIX] Diary : Success Code 및 DTO 반영
thguss Feb 6, 2024
e779e42
[FIX] Goal : Success Code 및 DTO 반영
thguss Feb 6, 2024
2d96bd7
[FIX] Member : Success Code 및 DTO 반영
thguss Feb 6, 2024
3750165
[FIX] Test : Success Code 및 DTO 반영
thguss Feb 6, 2024
edb1c5a
[FIX] Topic : Success Code 및 DTO 반영
thguss Feb 6, 2024
1bf276a
[FIX] Member : Success Code 및 DTO 반영
thguss Feb 6, 2024
b2103df
[ADD] Failure Code 추가
thguss Feb 7, 2024
4bba734
[ADD] Failure Code 적용 형태 추가
thguss Feb 7, 2024
8c171cf
[ADD] 예외 커스텀
thguss Feb 7, 2024
1e90249
[REFACTOR] batch 리팩토링
thguss Feb 7, 2024
3c614a3
[FIX] 테스트 리팩토링 반영
thguss Feb 7, 2024
a84afb0
[FIX] script 파일 내 경로 변경
thguss Feb 7, 2024
e55f846
Merge pull request #200 from Team-Smeme/sohyeon_#198
thguss Feb 9, 2024
dfb52bf
[TEST] 테스트 코드 임시 중단
thguss Feb 9, 2024
7f7b4a5
[REFACTOR] Diary 리팩토링
thguss Feb 12, 2024
3903b80
[REFACTOR] Diary 리팩토링
thguss Feb 12, 2024
1708f3e
[REFACTOR] Test 리팩토링
thguss Feb 12, 2024
30148bb
[REFACTOR] Topic 리팩토링
thguss Feb 12, 2024
3cee0d1
[REFACTOR] Goal 리팩토링
thguss Feb 12, 2024
cd3c1a2
[REFACTOR] domain 모듈 리팩토링
thguss Feb 12, 2024
1600065
[REFACTOR] build 실행
thguss Feb 12, 2024
1cfec62
[REFACTOR] 스케줄링 및 FCM API 호출 코드 리팩토링
thguss Feb 12, 2024
acfd9c0
Member, Badge, Auth domain 리팩토링
unanchoi Feb 13, 2024
aaa7dd1
Merge pull request #201 from Team-Smeme/sohyeon_#198
thguss Feb 13, 2024
457d34c
[FIX] merge conflict 해결
unanchoi Feb 13, 2024
bb333e4
[FIX] settings.gradle 불필요한 코드 삭제
unanchoi Feb 13, 2024
1948af8
Merge pull request #202 from Team-Smeme/refactor_#198_unan
unanchoi Feb 13, 2024
4ba3fbe
[REFACTOR] api: final 추가, 선public 후private, Response DTO (Service, Co…
thguss Feb 20, 2024
17d6460
[REFACTOR] 리팩토링 반영
thguss Feb 20, 2024
c477caf
[REFACTOR] domain: PROTECTED 추가, 기타 리팩토링
thguss Feb 20, 2024
c4d33d4
[REFACTOR] external: DTO 분리
thguss Feb 20, 2024
90fb18d
[REFACTOR] 2차 리팩토링
unanchoi Feb 20, 2024
354e0b9
Merge pull request #206 from Team-Smeme/refactor_#198_unan2
unanchoi Feb 20, 2024
6e1bc45
Merge branch 'refactor_#198' into sohyeon_#198
thguss Feb 20, 2024
6c2e655
Merge pull request #204 from Team-Smeme/sohyeon_#198
thguss Feb 20, 2024
56cc739
[REFACTOR] DTO 리팩토링
unanchoi Feb 22, 2024
c7a9e26
[REFACTOR] 파라미터 수정 및 불필요한 import 삭제
unanchoi Feb 22, 2024
5825e55
[REFACTOR] 버전업
thguss Feb 22, 2024
0bd4397
[REFACTOR] 외부 API 호출 : RestClient 으로 변경
thguss Feb 22, 2024
ce2b3a6
[REFACTOR] 람다식 수정 및 메소드 재활용
thguss Feb 22, 2024
745fdcb
[REFACTOR] 3차 리팩토링
unanchoi Feb 23, 2024
3783004
[REFACTOR] 불변성 보장을 위한 final 적용
unanchoi Feb 23, 2024
316c512
Merge pull request #208 from Team-Smeme/sohyeon_#198
thguss Feb 27, 2024
edb3492
[FIX] 리뷰 반영
unanchoi Feb 27, 2024
78b3ada
[CHORE] BadgeListResponse 컨벤션에 맞춰 리팩토링
unanchoi Feb 27, 2024
a595bf9
[CHORE] static import 적용 및 코드 정렬
unanchoi Feb 27, 2024
469e0bb
Merge branch 'refactor_#198' into refactor_#198_unan3
unanchoi Feb 27, 2024
0f41821
Merge pull request #209 from Team-Smeme/refactor_#198_unan3
unanchoi Feb 27, 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
7 changes: 4 additions & 3 deletions .github/workflows/cd-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ jobs:
- name: Create application-secret.yml
run: |
pwd
touch src/main/resources/application-secret.yml
echo "${{ secrets.APPLICATION_SECRET_YML }}" >> src/main/resources/application-secret.yml
cat src/main/resources/application-secret.yml
cd ./smeem-api/src/main/resources
touch ./application-secret.yml
echo "${{ secrets.APPLICATION_SECRET_YML }}" >> ./application-secret.yml
cat ./application-secret.yml

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/cd-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ jobs:
- name: Create application-secret.yml
run: |
pwd
touch src/main/resources/application-secret.yml
echo "${{ secrets.APPLICATION_SECRET_YML }}" >> src/main/resources/application-secret.yml
cat src/main/resources/application-secret.yml
cd ./smeem-api/src/main/resources
touch ./application-secret.yml
echo "${{ secrets.APPLICATION_SECRET_YML }}" >> ./application-secret.yml
cat ./application-secret.yml

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ jobs:
- name: Create application-secret.yml
run: |
pwd
touch src/main/resources/application-secret.yml
echo "${{ secrets.APPLICATION_SECRET_YML }}" >> src/main/resources/application-secret.yml
cat src/main/resources/application-secret.yml
cd ./smeem-api/src/main/resources
touch ./application-secret.yml
echo "${{ secrets.APPLICATION_SECRET_YML }}" >> ./application-secret.yml
cat ./application-secret.yml

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
Expand Down
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ HELP.md
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/
!**/src/com.smeem.test/**/build/

### STS ###
.apt_generated
Expand All @@ -15,7 +15,7 @@ build/
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/
!**/src/com.smeem.test/**/bin/

### IntelliJ IDEA ###
.idea
Expand All @@ -24,7 +24,7 @@ bin/
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/
!**/src/com.smeem.test/**/out/

### NetBeans ###
/nbproject/private/
Expand Down
150 changes: 32 additions & 118 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,138 +1,52 @@
import org.hidetake.gradle.swagger.generator.GenerateSwaggerUI
import org.springframework.boot.gradle.tasks.bundling.BootJar

buildscript {
ext {
queryDslVersion = "5.0.0"
restdocsApiSpecVersion = "0.18.2"
repositories {
mavenCentral()
}
}

plugins {
id 'java'
id 'org.springframework.boot' version '3.0.1'
id 'io.spring.dependency-management' version '1.1.0'
// jacoco
id 'jacoco'
// restdocs-api-spec
id 'com.epages.restdocs-api-spec' version "${restdocsApiSpecVersion}"
// swagger generator
id 'org.hidetake.swagger.generator' version '2.18.2'
}

swaggerSources {
sample {
setInputFile(file("${project.buildDir}/api-spec/openapi3.yaml"))
}
}

openapi3 {
server('http://localhost:8080')
title = 'restdocs-swagger API Documentation'
description = 'Spring REST Docs with SwaggerUI.'
version = '0.0.1'
format = 'yaml'
id 'org.springframework.boot' version '3.2.0'
id 'io.spring.dependency-management' version '1.1.4'
}

allprojects {
apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

jacoco {
toolVersion = "0.8.7"
}

tasks.withType(Test) {
jacoco.includeNoLocationClasses = true
jacoco.excludes = ['jdk.internal.*']
group = 'com.smeme'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'

}

group = 'com.smeme'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'

configurations {
compileOnly {
extendsFrom annotationProcessor
repositories {
mavenCentral()
}
}

repositories {
mavenCentral()
}

ext {
set('snippetsDir', file("build/generated-snippets"))
}

dependencies {
// Spring Boot Starter
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
implementation 'org.springframework.boot:spring-boot-starter-validation'

testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'

// JWT
implementation group: 'io.jsonwebtoken', name: 'jjwt-api', version: '0.11.5'
implementation group: 'io.jsonwebtoken', name: 'jjwt-impl', version: '0.11.5'
implementation group: 'io.jsonwebtoken', name: 'jjwt-jackson', version: '0.11.5'


implementation 'com.google.code.gson:gson:2.10.1'
implementation 'javax.xml.bind:jaxb-api:2.4.0-b180830.0359'

// Swagger & RestDocs
testImplementation "com.epages:restdocs-api-spec-mockmvc:${restdocsApiSpecVersion}"
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2'

// fcm
implementation 'com.google.firebase:firebase-admin:9.1.1'
implementation group: 'com.squareup.okhttp3', name: 'okhttp', version: '4.2.2'

// QueryDSL
implementation 'com.querydsl:querydsl-jpa:5.0.0:jakarta'
annotationProcessor "com.querydsl:querydsl-apt:5.0.0:jakarta"
annotationProcessor "jakarta.annotation:jakarta.annotation-api"
annotationProcessor "jakarta.persistence:jakarta.persistence-api"
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}

// lombok
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testCompileOnly 'org.projectlombok:lombok'
testAnnotationProcessor 'org.projectlombok:lombok'
dependencies {

// DB
runtimeOnly 'com.h2database:h2'
runtimeOnly 'org.postgresql:postgresql'
}
// test
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'

tasks.named('test') {
useJUnitPlatform()
}
// lombok
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testAnnotationProcessor 'org.projectlombok:lombok'
testCompileOnly 'org.projectlombok:lombok'
}

tasks.withType(GenerateSwaggerUI) {
dependsOn 'openapi3'
copy {
from "build/resources/main/static/docs"
into "src/main/resources/static/docs/"
tasks.named('test') {
useJUnitPlatform()
}
}

bootJar {
dependsOn(':openapi3')
}
// bootJar 실행 전, copySwaggerUI 를 실행하도록 설정
openapi3 {
server = "http://localhost:8080"
title = "smeme api documentation"
description = "Spring REST Docs with SwaggerUI."
version = "0.0.1"
outputFileNamePrefix = 'open-api-3.0.1'
format = 'json'
jar { enabled = true }

outputDirectory = 'build/resources/main/static/docs'
}
bootJar { enabled = false }
2 changes: 1 addition & 1 deletion scripts/health_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ echo "> Start health check of WAS at 'http://127.0.0.1:${TARGET_PORT}/api/v2/tes
for RETRY_COUNT in 1 2 3 4 5 6 7 8 9 10
do
echo "> #${RETRY_COUNT} trying..."
RESPONSE_CODE=$(curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:${TARGET_PORT}/api/v2/test)
RESPONSE_CODE=$(curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:${TARGET_PORT}/api/v2/com.smeem.test)

if [ ${RESPONSE_CODE} -eq 200 ]; then
echo "> New WAS successfully running"
Expand Down
6 changes: 6 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
rootProject.name = 'server'
include 'smeem-api'
include 'smeem-domain'
include 'smeem-batch'
include 'smeem-external'
include 'smeem-common'

68 changes: 68 additions & 0 deletions smeem-api/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import org.hidetake.gradle.swagger.generator.GenerateSwaggerUI

plugins {
// restdocs-api-spec
id 'com.epages.restdocs-api-spec' version "0.18.2"
// swagger generator
id 'org.hidetake.swagger.generator' version '2.18.2'
}

dependencies {
implementation project(':smeem-common')
implementation project(':smeem-domain')
implementation project(':smeem-external')

implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-validation'

// JWT
implementation group: 'io.jsonwebtoken', name: 'jjwt-api', version: '0.11.5'
implementation group: 'io.jsonwebtoken', name: 'jjwt-impl', version: '0.11.5'
implementation group: 'io.jsonwebtoken', name: 'jjwt-jackson', version: '0.11.5'

// Swagger & RestDocs
testImplementation "com.epages:restdocs-api-spec-mockmvc:0.18.2"
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
// implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.1.0'

}

swaggerSources {
sample {
setInputFile(file("build/api-spec/openapi3.yaml"))
}
}

openapi3 {
server = "http://localhost:8080"
title = "SMEEM API Documentation"
description = "Spring REST Docs with SwaggerUI."
version = "0.0.1"
outputFileNamePrefix = 'open-api-3.0.1'
format = 'json'
outputDirectory = 'build/resources/main/static/docs'
}

ext {
set('snippetsDir', file("build/generated-snippets"))
}

tasks.withType(GenerateSwaggerUI).configureEach {
dependsOn 'openapi3'
copy {
from "build/resources/main/static/docs"
into "src/main/resources/static/docs/"
}
}

bootJar {
// enabled = true
dependsOn('openapi3')
}
repositories {
mavenCentral()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.smeem.api;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;

@SpringBootApplication
@ComponentScan(basePackages = {"com.smeem.common", "com.smeem.api", "com.smeem.domain", "com.smeem.external"})
@EnableJpaRepositories(basePackages = {"com.smeem.domain"})
@EntityScan(basePackages = {"com.smeem.domain"})
public class SmemeServerRenewalApplication {

public static void main(String[] args) {
SpringApplication.run(SmemeServerRenewalApplication.class, args);
}

}
Loading
Loading