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

Briefing 2.0.0 서버 추가 요구사항 #147

Merged
merged 44 commits into from
Jan 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
deb4a1c
Merge branch 'develop' of https://github.com/Team-Shaka/Briefing-Back…
CYY1007 Nov 29, 2023
72f6aa9
Merge branch 'develop' of https://github.com/Team-Shaka/Briefing-Back…
CYY1007 Dec 4, 2023
1292fd6
Merge branch 'develop' of https://github.com/Team-Shaka/Briefing-Back…
CYY1007 Dec 9, 2023
133e305
Merge branch 'develop' of https://github.com/Team-Shaka/Briefing-Back…
CYY1007 Dec 10, 2023
4511514
Merge branch 'develop' of https://github.com/Team-Shaka/Briefing-Back…
CYY1007 Dec 10, 2023
392ae94
Merge branch 'develop' of https://github.com/Team-Shaka/Briefing-Back…
CYY1007 Dec 17, 2023
3f1019d
Merge branch 'develop' of https://github.com/Team-Shaka/Briefing-Back…
CYY1007 Dec 27, 2023
217691d
Update README.md
swa07016 Dec 27, 2023
3aaf28b
♻️ Refactor: Spotless 플러그인 적용 (#131)
swa07016 Dec 27, 2023
f18096c
Merge branch 'develop' of https://github.com/Team-Shaka/Briefing-Back…
CYY1007 Dec 27, 2023
c2026d4
💚 Ci : 서버 이전으로 인한 github action 수정 (#132)
CYY1007 Dec 27, 2023
f27f247
Merge branch 'develop' of https://github.com/Team-Shaka/Briefing-Back…
CYY1007 Dec 27, 2023
d1229bf
Update README.md
swa07016 Dec 28, 2023
044a759
:recycle: Refactor: Scrap API 버전별 클래스 분리
swa07016 Dec 30, 2023
546f18d
:recycle: Refactor: Briefing API 버전별 클래스 분리
swa07016 Dec 30, 2023
ca36623
:recycle: Refactor: Member API 버전별 클래스 분리
swa07016 Dec 30, 2023
b3cbaf7
:recycle: Refactor : Swagger 로그인 및 리터칭
CYY1007 Dec 30, 2023
3baf756
:sparkles: Feat: Scrap Command 전략 패턴 구조 작성
swa07016 Dec 30, 2023
b77f686
:bug: Fix : Swagger V1 표시 방식 수정
CYY1007 Dec 31, 2023
500337b
:sparkles: Feat: Scrap V1 커맨드 전략 구현
swa07016 Jan 1, 2024
e1a7089
:sparkles: Feat: Scrap V2 커맨드 전략 구현
swa07016 Jan 1, 2024
f44395a
:sparkles: Scrap V2 요구사항 반영
swa07016 Jan 1, 2024
43dc199
Merge pull request #134 from Team-Shaka/refactor/126
swa07016 Jan 1, 2024
8b7e018
Merge pull request #136 from Team-Shaka/feature/133
swa07016 Jan 1, 2024
03d50aa
:recycle: Refactor: Scrap API 리팩토링 (#138)
swa07016 Jan 3, 2024
be583f1
Merge branch 'develop' of https://github.com/Team-Shaka/Briefing-Back…
CYY1007 Jan 4, 2024
ae2bc34
:memo: Docs : 리드미 업데이트 2024.01.05
CYY1007 Jan 4, 2024
5283358
:memo: Docs : 리드미 오타 수정 2024.01.05
CYY1007 Jan 4, 2024
7a1afa9
Update README.md
swa07016 Jan 5, 2024
a1dee9e
:sparkles: Feat: API 응답 캐싱을 통한 브리핑 V2 조회 속도 개선
swa07016 Jan 5, 2024
ba85b24
:sparkles: Feat: 캐시 유효시간 조정
swa07016 Jan 5, 2024
7fc9200
:pencil2: Fix: @CacheEvict 어노테이션 이동
swa07016 Jan 5, 2024
c6ed247
Merge pull request #142 from Team-Shaka/feature/118
swa07016 Jan 5, 2024
08392fb
:pencil2: Fix: 캐시 키 변경 & 커스텀 캐시 Evict 로직 구현
swa07016 Jan 5, 2024
ac44539
Merge pull request #143 from Team-Shaka/feature/118
swa07016 Jan 5, 2024
40fa225
Update README.md
swa07016 Jan 5, 2024
9d2c782
Update README.md
swa07016 Jan 7, 2024
79da5ff
:sparkles: Feat : 브리핑 수정 API 구현
CYY1007 Jan 7, 2024
5ba6519
불필요한 의존성 제거
CYY1007 Jan 7, 2024
ed38836
:hammer: 코드리뷰 반영
CYY1007 Jan 7, 2024
277e99a
:bug: Fix: 브리핑 목록 조회 순위 버그 해결
swa07016 Jan 7, 2024
66ae90e
:recycle: Refactor: 애플리케이션단 역순 정렬 제거
swa07016 Jan 7, 2024
cbfd0ee
Merge pull request #144 from Team-Shaka/feature/141
swa07016 Jan 7, 2024
61d460f
Merge pull request #146 from Team-Shaka/bug/135
swa07016 Jan 7, 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
10 changes: 5 additions & 5 deletions .github/workflows/dev_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ jobs:
- name: Beanstalk Deploy
uses: einaregilsson/beanstalk-deploy@v20
with:
aws_access_key: ${{ secrets.AWS_ACTION_ACCESS_KEY_ID }}
aws_secret_key: ${{ secrets.AWS_ACTION_SECRET_ACCESS_KEY }}
application_name: breifing-dev
environment_name: Breifing-dev-env
aws_access_key: ${{ secrets.AWS_DEV_ACTION_ACCESS_KEY_ID }}
aws_secret_key: ${{ secrets.AWS_DEV_ACTION_SECRET_ACCESS_KEY }}
application_name: briefing-dev
environment_name: Briefing-dev-env
version_label: github-action-${{ steps.current-time.outputs.formattedTime }}
region: ap-northeast-1
region: ap-northeast-2
deployment_package: deploy/deploy.zip
wait_for_deployment: false

11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,14 @@
</div>
<div>
<img src="https://img.shields.io/badge/MySQL-4479A1.svg?style=square&logo=MySQL&logoColor=white">
<img src="https://img.shields.io/badge/Redis-DC382D?style=flat-square&logo=Redis&logoColor=white">
<img src="https://img.shields.io/badge/Redis-DC382D?style=square&logo=Redis&logoColor=white">
<img src="https://img.shields.io/badge/Amazon AWS-232F3E?style=square&logo=Amazon AWS&logoColor=white">
</div>
<br/>

<b>Spring Cloud</b>
- write
- Node.js 크롤러 서버가 하나의 Base Url만을 이용하여 개발 서버와 릴리즈 서버 모두에게 요청을 보낼 수 있도록 해서 편의성을 늘렸습니다.
- 개발 편의성을 위해 Feign 클라이언트를 사용해 외부 API를 호출 했습니다.

<b>QueryDSL</b>
- 컴파일 시점 문법 검사와 개발 편의성을 위해 QueryDSL을 사용했습니다.
Expand All @@ -77,8 +78,10 @@
<br/>

## 📚 개발 과정
- [[Briefing] API 버전 관리 & 전략 패턴](https://velog.io/@cekim/briefing-api-versioning)

- [[Briefing] API 버전 관리 & 전략 패턴](https://poisson-it.tistory.com/75)
- [[Briefing] Spotless로 코드 포맷 유지하기](https://poisson-it.tistory.com/77)
- [[Briefing] Spring Security - Swagger 로그인 적용하기](https://ddol-dev-blog.tistory.com/3)
- [[Briefing] API 응답 캐싱을 통한 조회 속도 개선](https://poisson-it.tistory.com/78)

<br/>

Expand Down
31 changes: 30 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ plugins {
id 'java'
id 'org.springframework.boot' version '3.1.2'
id 'io.spring.dependency-management' version '1.1.2'
// id 'com.ewerk.gradle.plugins.querydsl' version '1.0.10'
id 'com.diffplug.spotless' version '6.23.3' // Spotless 플러그인
}

group = 'briefing.info'
Expand Down Expand Up @@ -72,6 +72,35 @@ tasks.named('test') {
useJUnitPlatform()
}


/*
compileJava 태스크가 실행되기 전에 spotlessApply 태스크가 먼저 실행되도록 구성
개발자가 별도로 코드 포맷팅을 신경 쓸 필요 없이, 코드가 항상 일관된 스타일을 유지하도록 설정
*/
tasks.named('compileJava') {
dependsOn 'spotlessApply'
}

jar {
enabled = false
}

spotless {
java {
// Google Java 포맷 적용
/*
googleJavaFormat() : 탭은 2개의 공백
googleJavaFormat().aosp() : 탭은 4개의 공백
[참고] https://github.com/google/google-java-format/issues/525
*/
googleJavaFormat().aosp()
// 아래 순서로 import문 정렬
importOrder('java', 'javax', 'jakarta', 'org', 'com')
// 사용하지 않는 import 제거
removeUnusedImports()
// 각 라인 끝에 있는 공백을 제거
trimTrailingWhitespace()
// 파일 끝에 새로운 라인 추가
endWithNewline()
}
}
18 changes: 14 additions & 4 deletions src/main/java/briefing/BriefingApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,28 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.cloud.openfeign.FeignAutoConfiguration;
import org.springframework.data.redis.repository.configuration.EnableRedisRepositories;

import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import io.swagger.v3.oas.annotations.servers.Server;

@OpenAPIDefinition(
servers = {
@Server(url = "http://localhost:8080", description = "local server"),
@Server(url = "https://dev.briefing.store", description = "dev server"),
@Server(url = "https://api.newsbreifing.store", description = "release server")
})
@SpringBootApplication
@EnableCaching
@EnableFeignClients
@EnableRedisRepositories
@ImportAutoConfiguration({FeignAutoConfiguration.class})
public class BriefingApplication {

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

public static void main(final String[] args) {
SpringApplication.run(BriefingApplication.class, args);
}
}
28 changes: 14 additions & 14 deletions src/main/java/briefing/GlobalControllerAdvice.java
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
package briefing;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ExceptionHandler;

import briefing.base.BaseException;
import briefing.base.BaseExceptionType;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@Slf4j
//@RestControllerAdvice
// @RestControllerAdvice
public class GlobalControllerAdvice {

@ExceptionHandler(BaseException.class)
public ResponseEntity<ExceptionResponse> handleException(final BaseException e) {
final BaseExceptionType type = e.exceptionType();
log.warn("[WARN] MESSAGE: {}", type.message());
return new ResponseEntity<>(ExceptionResponse.from(e), e.exceptionType().status());
}
@ExceptionHandler(BaseException.class)
public ResponseEntity<ExceptionResponse> handleException(final BaseException e) {
final BaseExceptionType type = e.exceptionType();
log.warn("[WARN] MESSAGE: {}", type.message());
return new ResponseEntity<>(ExceptionResponse.from(e), e.exceptionType().status());
}

private record ExceptionResponse(String message) {
private record ExceptionResponse(String message) {

private static ExceptionResponse from(final BaseException e) {
return new ExceptionResponse(e.exceptionType().message());
private static ExceptionResponse from(final BaseException e) {
return new ExceptionResponse(e.exceptionType().message());
}
}
}
}
17 changes: 10 additions & 7 deletions src/main/java/briefing/base/BaseDateTimeEntity.java
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
package briefing.base;

import java.time.LocalDateTime;

import jakarta.persistence.Column;
import jakarta.persistence.EntityListeners;
import jakarta.persistence.MappedSuperclass;
import java.time.LocalDateTime;
import lombok.Getter;

import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import lombok.Getter;

@EntityListeners(AuditingEntityListener.class)
@MappedSuperclass
@Getter
public abstract class BaseDateTimeEntity {

@Column(updatable = false)
@CreatedDate
private LocalDateTime createdAt;
@LastModifiedDate
private LocalDateTime updatedAt;
@Column(updatable = false)
@CreatedDate
private LocalDateTime createdAt;

@LastModifiedDate private LocalDateTime updatedAt;
}
8 changes: 4 additions & 4 deletions src/main/java/briefing/base/BaseException.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

public abstract class BaseException extends RuntimeException {

protected BaseException(final String message) {
super(message);
}
protected BaseException(final String message) {
super(message);
}

public abstract BaseExceptionType exceptionType();
public abstract BaseExceptionType exceptionType();
}
4 changes: 2 additions & 2 deletions src/main/java/briefing/base/BaseExceptionType.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

public interface BaseExceptionType {

HttpStatus status();
HttpStatus status();

String message();
String message();
}
Loading
Loading