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

main 작업 내용 dev로 동기화 #27

Merged
merged 157 commits into from
Feb 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
157 commits
Select commit Hold shift + click to select a range
0530a2b
[feature] firebase admin sdk 비밀키 json 파일 gitignore 파일에 추가
Yun-YeoJun Oct 9, 2024
4099653
[feature] 생성 시간과 수정 시간을 기록하는 BaseTimeEntity 추상클래스 구현
Yun-YeoJun Oct 9, 2024
c757e9e
[feature] NotificationNotFoundExcepiton 구현
Yun-YeoJun Oct 9, 2024
ad6d512
[fix] 오타 수정 ERRER -> ERROR
Yun-YeoJun Oct 9, 2024
884edc8
[feature] FCM 관련 예외 추가
Yun-YeoJun Oct 11, 2024
b06f939
[feature] 알림 전송 비동기 처리를 위한 ThreadPoolTaskExecutor 설정
Yun-YeoJun Oct 11, 2024
370a66a
[feature] 스케줄러 설정
Yun-YeoJun Oct 11, 2024
8873b17
[feature] FCM 메시지 예약 & 전송 구현
Yun-YeoJun Oct 11, 2024
ed5f1ef
[feature] FCM 관련 테스트 코드 작성
Yun-YeoJun Oct 11, 2024
1d6aaf1
[fix] 의존성 추가
Yun-YeoJun Oct 11, 2024
29c1575
[fix] 베타 테스트 기간에는 로그인 기능 off
Yun-YeoJun Oct 11, 2024
1c9c20c
[feature] FcmNotification 테스트 작성
Yun-YeoJun Oct 11, 2024
597f5f3
[fix] 예외 오타 수정
Yun-YeoJun Oct 15, 2024
1bdd4a8
[fix] delete 메서드 요청 방식을 body에서 header로 변경
Yun-YeoJun Oct 15, 2024
b419838
[refactor] 스케줄러 관련 코드 리팩토링
Yun-YeoJun Oct 15, 2024
984c321
[feature] DTO에 빌더 추가
Yun-YeoJun Oct 15, 2024
e74c55c
[test] 테스트 코드 작성
Yun-YeoJun Oct 15, 2024
b094bcf
[fix] getter 수정
Yun-YeoJun Oct 15, 2024
b7fb631
[refactor] 디버깅 로그 코드 삭제 & 메서드 범위를 public에서 private로 변경
Yun-YeoJun Oct 15, 2024
10058d5
[feature] gitignore 파일에 firebase admin sdk private key 파일 추가
Yun-YeoJun Oct 15, 2024
64bc69f
[feature] 사용자 피드백을 받을 때 nps 점수도 받을 수 있도록 기능 추가
Yun-YeoJun Oct 15, 2024
75a1697
[test] 테스트 코드에 테스트 프로파일 설정 어노테이션 추가
Yun-YeoJun Oct 16, 2024
1b661f1
[fix] user 테이블 이름을 users로 수정
Yun-YeoJun Oct 16, 2024
f1d0914
[feature] 이모지 저장을 위해 컬럼 인코딩 방식을 utf8에서 utf8mb4로 변경
Yun-YeoJun Oct 16, 2024
c34259c
[fix] 필요없는 fcm 설정 삭제
Yun-YeoJun Oct 16, 2024
192e2b6
[feature] 약속 정보를 저장하기 위한 Appointment 객체와 저장소 구현
Yun-YeoJun Oct 16, 2024
e4b30c4
[refactor] 컬럼 일부를 Appointment로 옮기고 @JsonIgnore 어노테이션 추가
Yun-YeoJun Oct 16, 2024
b696b82
[refactor] DTO 리팩토링
Yun-YeoJun Oct 16, 2024
9d5b448
[refactor] 스케줄러 등록 서비스 리팩토링
Yun-YeoJun Oct 16, 2024
20dddc0
[refactor] 테스트 코드 리팩토링
Yun-YeoJun Oct 16, 2024
8df77d1
[fix] Appointment 도입 후 문법에 안 맞는 부분 수정
Yun-YeoJun Oct 16, 2024
229f5b9
[feature] 약속 이름과 디바이스 토큰 변경 함수 추가
Yun-YeoJun Oct 17, 2024
29195ad
[feature] AppointmentNotFoundException 정의
Yun-YeoJun Oct 17, 2024
e8aa2ff
[refactor] 알림 삭제 로직 리팩토링
Yun-YeoJun Oct 17, 2024
797d25a
[refactor] 알림 등록 로직 리팩토링
Yun-YeoJun Oct 17, 2024
06eddfd
[refactor] 알림 수정 로직 리팩토링
Yun-YeoJun Oct 17, 2024
cee0269
[feature] 알림 전송 취소 상태 추가
Yun-YeoJun Oct 17, 2024
b733ce1
[refactor] 불필요한 주석 삭제
Yun-YeoJun Oct 17, 2024
e0a44d2
[refactor] 등록, 수정, 삭제 로직 변경에 따른 컨트롤러 리팩토링
Yun-YeoJun Oct 17, 2024
86be455
[fix] addFcmNotification 메서드 로직 수정
Yun-YeoJun Oct 18, 2024
05c0968
[refactor] 목표 NotificationStatus를 담아서 ServiceRequest를 생성하도록 변경
Yun-YeoJun Oct 18, 2024
b66971e
[refactor] 불필요한 코드 삭제
Yun-YeoJun Oct 18, 2024
0e6f7f7
[feature] FcmNotification 엔티티에 NotificationStep과 NotificationStatus 추가
Yun-YeoJun Oct 18, 2024
9de1d86
[refactor] FcmNotificationStatus -> NotificationStatus로 이름 변경 & MODIF…
Yun-YeoJun Oct 18, 2024
e1b70d7
[feature] 기존에 하드코딩된 메시지를 모아놓은 NotificationStep Enum 구현
Yun-YeoJun Oct 18, 2024
b9fe162
[refactor] NotificationStep과 NotificationStatus를 적용하여 리팩토링
Yun-YeoJun Oct 18, 2024
caf57a6
[refactor] 불필요한 코드 삭제
Yun-YeoJun Oct 18, 2024
1b1e092
[refactor] UUID 대신 엔티티의 ID를 사용하도록 수정
Yun-YeoJun Oct 18, 2024
c04f29d
[refactor] Appointment 객체 대신 Appointment 객체의 ID 값을 사용하도록 메서드 수정
Yun-YeoJun Oct 18, 2024
2be5cb1
[feature] 스프링의 Retry를 활용하여 FCM API 호출 실패 시 최대 5번 재호출하는 기능 구현
Yun-YeoJun Oct 19, 2024
8ce4516
[refactor] 불필요한 코드 삭제
Yun-YeoJun Oct 19, 2024
5b0984f
[feature] 동시성 문제 방지를 위해 JPA 비관적 락 적용
Yun-YeoJun Oct 19, 2024
c39b482
[refactor] onSendToFcmSuccess 메서드 리팩토링
Yun-YeoJun Oct 20, 2024
dbb0136
[fix] mysql에는 JPA로 타임 아웃이 적용되지 않기 때문에 관련 어노테이션 삭제
Yun-YeoJun Oct 20, 2024
61b8222
[refactor] 불필요한 import 문 제거
Yun-YeoJun Oct 20, 2024
9ea33f1
[test] 테스트 코드 리팩토링
Yun-YeoJun Oct 20, 2024
721fb32
[feature] jpa auditing 기능 추가
Yun-YeoJun Oct 20, 2024
4539e6f
[refactor] 피드백 코멘트와 점수 분리 & 코드 리팩토링
Yun-YeoJun Oct 20, 2024
473c913
[feature] validation 추가
Yun-YeoJun Oct 20, 2024
21fa622
[feature] validation을 위한 에러 코드 추가
Yun-YeoJun Oct 20, 2024
cc29fec
[fix] 로그인하지 않은 사용자도 피드백을 남길 수 있도록 모두에게 권한 부여
Yun-YeoJun Oct 20, 2024
06a6448
[feature] ALB 헬스 체크를 위한 컨트롤러 생성
Yun-YeoJun Oct 25, 2024
3e460bf
[feature] FCM 전송 실패 시 재시도 로직 구현
Yun-YeoJun Oct 25, 2024
3439f51
[temp] 테스트 코드 임시 백업
Yun-YeoJun Oct 25, 2024
1283057
Merge branch 'beta' into feature/#14
Yun-YeoJun Oct 25, 2024
855b30e
Merge pull request #20 from Yun-YeoJun/feature/#14
Yun-YeoJun Oct 25, 2024
476ba11
Merge branch 'beta' into feature/#19
Yun-YeoJun Oct 25, 2024
ae690ca
Merge pull request #21 from Yun-YeoJun/feature/#19
Yun-YeoJun Oct 25, 2024
c746057
[fix] 오타 수정
Yun-YeoJun Oct 25, 2024
1806154
[fix] 오타 수정
Yun-YeoJun Oct 25, 2024
2557922
[refactor] 스케줄러 등록 전 시간 체크 로직 구현 & 시스템 시간대 대신 시간대 "Asia/Seoul"로 고정
Yun-YeoJun Oct 25, 2024
1db1c9e
Merge pull request #22 from Yun-YeoJun/feature/#14
Yun-YeoJun Oct 25, 2024
a6fbd77
[fix] 다중 서버 환경에서 오동작하는 코드 수정
Yun-YeoJun Oct 25, 2024
bebc03a
Merge pull request #23 from Yun-YeoJun/feature/#14
Yun-YeoJun Oct 25, 2024
fccb813
[fix] 알림 업데이트 응답으로 PENDING 상태의 알림만 나타나도록 수정
Yun-YeoJun Oct 25, 2024
9b347a4
Merge pull request #24 from Yun-YeoJun/feature/#14
Yun-YeoJun Oct 25, 2024
c098cf9
[feature] 로드밸런싱 확인을 위해 현재 서버의 ip 주소를 확인할 수 있는 기능 추가
Yun-YeoJun Oct 26, 2024
92881e5
[feature] index.html 추가
Yun-YeoJun Oct 26, 2024
60e070d
[fix] 파비콘 오류 해결
Yun-YeoJun Oct 26, 2024
b444a37
[fix] 파비콘 에러 해결
Yun-YeoJun Oct 26, 2024
9639781
[feature] 2024-11-09 베타테스트 변경사항 반영
Yun-YeoJun Nov 9, 2024
8eff2cb
[feature] 정시 도착 또는 조기 도착 시 등록된 알림 등록 취소시키는 기능 구현
Yun-YeoJun Nov 16, 2024
17fcb65
[feature] gitignore 파일에 log 파일 ignore 추가
Yun-YeoJun Nov 21, 2024
1e5ebc5
[feature] 반복 요일 기능을 지원하는 일정 기능 구현
Yun-YeoJun Nov 24, 2024
76eda0d
[feature] Util 기능 구현
Yun-YeoJun Nov 24, 2024
f7a1ed8
[feature] @Scheduled 활성화
Yun-YeoJun Nov 24, 2024
75f88ec
[feature] DeletedAppointmentException 구현
Yun-YeoJun Nov 24, 2024
6ea6511
[feature] ThreadPoolTaskScheduler의 Pool Size를 1에서 2로 수정
Yun-YeoJun Nov 24, 2024
2bc08ff
[refactor] findAll 대신 pending 상태의 알림만 가져오도록 수정
Yun-YeoJun Nov 24, 2024
97646e3
[refactor] 불필요한 코드 삭제
Yun-YeoJun Nov 24, 2024
0c321dc
[feature] DTO 변환 로직 추가
Yun-YeoJun Nov 24, 2024
862700c
[refactor] 알림 삭제 로직 수정
Yun-YeoJun Nov 24, 2024
446ee8b
[feature] 매일 23시에 반복 요일 알림 등록 구현
Yun-YeoJun Nov 24, 2024
46554ff
[refactor] registerAll 함수 리팩토링
Yun-YeoJun Nov 24, 2024
7978137
[refactor] appointment 객체 생성 로직 리팩토링
Yun-YeoJun Nov 24, 2024
1f65a45
[feature] 푸시 알림 로직을 AWS를 이용하도록 변경
Yun-YeoJun Dec 5, 2024
031d7a0
[refactor] 푸시 알림 & 일정 코드 리팩토링
Yun-YeoJun Dec 16, 2024
729439f
[refactor] application.yml 파일 분리 & 민감 정보 환경 변수로 설정
Yun-YeoJun Feb 1, 2025
539bb91
[feature] 코드 테스트용 GitHub Actions 파이프라인 작성
Yun-YeoJun Feb 1, 2025
99522cd
[temp] GitHub Actions 테스트를 위해 테스트 코드 임시 commit
Yun-YeoJun Feb 1, 2025
d599769
[fix] GitHub Actions 디렉토리 경로 수정
Yun-YeoJun Feb 1, 2025
9b75d15
[fix] key json 파일 디렉토리 경로 수정
Yun-YeoJun Feb 1, 2025
24af9bf
[temp] firebase_admin_sdk_private_key.json 생성 디버깅을 위한 코드 삽입
Yun-YeoJun Feb 1, 2025
8c746f4
[fix] 오타 수정
Yun-YeoJun Feb 1, 2025
bf36323
[temp] 디버깅을 위한 로그 코드 추가
Yun-YeoJun Feb 1, 2025
bfe625e
[temp] 디버깅을 위한 log 추가
Yun-YeoJun Feb 1, 2025
7d7d497
[temp] 디버깅을 위해 코드 수정
Yun-YeoJun Feb 1, 2025
daf69d2
[temp] 디버깅을 위한 코드 수정
Yun-YeoJun Feb 1, 2025
07405e7
[fix] firebase_admin_sdk_private_key.json 파일 생성시 base64 문자열을 decoding…
Yun-YeoJun Feb 1, 2025
b2bfb87
[fix] 디버깅을 위한 코드 삭제
Yun-YeoJun Feb 1, 2025
1ece103
[feature] 테스트 리포트 수정
Yun-YeoJun Feb 1, 2025
62fb9de
[fix] 워크플로우에 쓰기 권한 부여
Yun-YeoJun Feb 1, 2025
13300b4
[feature] 테스트 리포트 관련 step에 commit 설정
Yun-YeoJun Feb 1, 2025
8caa16a
[fix] 워크플로우 오타 수정
Yun-YeoJun Feb 1, 2025
f5f9c6f
[feature] PAT 토큰 사용하도록 수정
Yun-YeoJun Feb 1, 2025
8c6e21b
[feature] 테스트 summary report 추가
Yun-YeoJun Feb 1, 2025
5e29e26
[fix] 오타 수정
Yun-YeoJun Feb 1, 2025
a50ee03
[fix] comment 설정 변경
Yun-YeoJun Feb 1, 2025
19fc98b
[fix] 권한 수정
Yun-YeoJun Feb 1, 2025
ce252ec
[feature] 테스트 리포트 1개 추가
Yun-YeoJun Feb 1, 2025
da469af
[feature] 코멘트에 들어갈 멘트 추가
Yun-YeoJun Feb 1, 2025
006c203
[fix] updateComment 옵션 false로 변경
Yun-YeoJun Feb 1, 2025
921d88f
[temp] 실패 테스트 추가
Yun-YeoJun Feb 1, 2025
1d911c4
[fix] 실패 테스트 삭제
Yun-YeoJun Feb 1, 2025
89f5283
[fix] action-junit-report 옵션 수정
Yun-YeoJun Feb 1, 2025
cbdd28d
[fix] 코멘트 수정
Yun-YeoJun Feb 1, 2025
e004c9a
[feature] 새로운 테스트 리포트 추가
Yun-YeoJun Feb 1, 2025
5d6aebf
[refactor] 필요없는 부분 삭제
Yun-YeoJun Feb 1, 2025
340da2b
[feature] gradle 캐싱 추가
Yun-YeoJun Feb 1, 2025
015ff54
[feature] 테스트 리포트 추가
Yun-YeoJun Feb 1, 2025
a9e6462
[fix] actions/cache 버전 v4->v3 수정
Yun-YeoJun Feb 1, 2025
e848d34
[feature] 테스트 리포트 action 변경
Yun-YeoJun Feb 1, 2025
819fac0
[feature] 테스트 리포트 추가
Yun-YeoJun Feb 1, 2025
b8446be
[feature] 빌드 step 추가
Yun-YeoJun Feb 1, 2025
6e2bb49
[fix] gradle 권한 부여 step 순서 변경
Yun-YeoJun Feb 1, 2025
d23d878
[fix] 환경변수 level 변경 step -> workflow
Yun-YeoJun Feb 1, 2025
49732ec
[fix] gradle 관련 step 위치 수정
Yun-YeoJun Feb 1, 2025
a75118c
[feature] 권한 추가
Yun-YeoJun Feb 2, 2025
e8e8e19
[fix] 캐시 경로 수정
Yun-YeoJun Feb 2, 2025
b862203
[feature] cache gradle 추가
Yun-YeoJun Feb 2, 2025
9380764
[fix] 테스트 리포트 삭제
Yun-YeoJun Feb 2, 2025
c3032cc
[feature] 코드 포매팅 추가
Yun-YeoJun Feb 2, 2025
7cf5756
[fix] 빌드 관련 코드 삭제
Yun-YeoJun Feb 2, 2025
3787984
[fix] skip-commit ture로 설정
Yun-YeoJun Feb 2, 2025
169ea33
[fix] 오타 수정
Yun-YeoJun Feb 2, 2025
125fe75
[fix] skip-commit 삭제
Yun-YeoJun Feb 2, 2025
4b1f71a
[feature] github token 추가
Yun-YeoJun Feb 2, 2025
c3d5b42
[fix] github token 수정
Yun-YeoJun Feb 2, 2025
c4a1e70
[feature] checkout에 ref 추가
Yun-YeoJun Feb 2, 2025
09994ad
[fix] ref 수정
Yun-YeoJun Feb 2, 2025
68d3eb5
[feature] 권한 추가
Yun-YeoJun Feb 2, 2025
e8132d6
Google Java Format
Feb 2, 2025
9411288
[fix] 인덴트 4space로 수정
Yun-YeoJun Feb 2, 2025
9f6325a
Merge branch 'beta' of https://github.com/team-pixels-dev/EarlyBird-B…
Yun-YeoJun Feb 2, 2025
1f10283
Google Java Format
Feb 2, 2025
c35e552
[fix] job 실행 순서 수정
Yun-YeoJun Feb 2, 2025
1a9eb6c
Merge pull request #26 from team-pixels-dev/beta
Yun-YeoJun Feb 2, 2025
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
75 changes: 75 additions & 0 deletions .github/workflows/code_test_pipeline.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Code Test Pipeline
on:
pull_request:
branches: ["dev", "main"]

permissions:
contents: read
checks: write

env:
DB_URL: ${{ secrets.DB_URL }}
DB_USERNAME: ${{ secrets.DB_USERNAME }}
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
SPRING_ACTIVE_PROFILE: ${{ vars.SPRING_ACTIVE_PROFILE }}
JWT_SECRET: ${{ secrets.JWT_SECRET }}
FCM_PROJECT_ID: ${{ secrets.FCM_PROJECT_ID }}
AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

jobs:
formatting:
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Formatting Code with Google Java Style Guide
uses: axel-op/googlejavaformat-action@v3
with:
args: "--replace --aosp"
github-token: ${{ secrets.GITHUB_TOKEN }}

unit-test:
runs-on: ubuntu-latest
permissions: write-all
needs: [formatting]
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Gradle Caching
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 21
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'
cache: 'gradle'

- name: Create firebase_admin_sdk_private_key.json from Secrets
run: |
mkdir -p $GITHUB_WORKSPACE/src/main/resources/key
echo "${{ secrets.FIREBASE_ADMIN_SDK_PRIVATE_KEY }}" | base64 --decode > $GITHUB_WORKSPACE/src/main/resources/key/firebase_admin_sdk_private_key.json

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Test with Gradle
run: ./gradlew --info test

- name: Publish Test Report
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: "**/build/test-results/test/TEST-*.xml"
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ out/


###
**/src/main/resources/application.properties
**/src/main/resources/application.yml


src/main/java/earlybird/earlybird/user/TestController.java
src/main/resources/key/firebase_admin_sdk_private_key.json

logs/*.log
13 changes: 13 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,32 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation "org.springframework.retry:spring-retry"
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'

compileOnly 'org.projectlombok:lombok'
runtimeOnly 'com.mysql:mysql-connector-j'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
testImplementation 'com.h2database:h2'

implementation 'org.springframework.boot:spring-boot-starter-webflux'

implementation 'io.jsonwebtoken:jjwt-api:0.12.3'
implementation 'io.jsonwebtoken:jjwt-impl:0.12.3'
implementation 'io.jsonwebtoken:jjwt-jackson:0.12.3'

implementation 'com.google.firebase:firebase-admin:9.3.0'

testImplementation 'org.awaitility:awaitility:4.2.2'

implementation(platform("software.amazon.awssdk:bom:2.27.21"))
implementation("software.amazon.awssdk:sdk-core")
implementation("software.amazon.awssdk:eventbridge")
implementation("software.amazon.awssdk:dynamodb")
}

tasks.named('test') {
Expand Down
11 changes: 7 additions & 4 deletions src/main/java/earlybird/earlybird/EarlybirdApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.scheduling.annotation.EnableScheduling;

@EnableScheduling
@EnableJpaAuditing
@SpringBootApplication
public class EarlybirdApplication {

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

public static void main(String[] args) {
SpringApplication.run(EarlybirdApplication.class, args);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package earlybird.earlybird.appointment.controller;

import earlybird.earlybird.appointment.controller.request.CreateAppointmentRequest;
import earlybird.earlybird.appointment.controller.request.UpdateAppointmentRequest;
import earlybird.earlybird.appointment.controller.response.CreateAppointmentResponse;
import earlybird.earlybird.appointment.service.CreateAppointmentService;
import earlybird.earlybird.appointment.service.DeleteAppointmentService;
import earlybird.earlybird.appointment.service.UpdateAppointmentService;
import earlybird.earlybird.appointment.service.request.CreateAppointmentServiceRequest;
import earlybird.earlybird.appointment.service.request.DeleteAppointmentServiceRequest;
import earlybird.earlybird.appointment.service.request.UpdateAppointmentServiceRequest;
import earlybird.earlybird.appointment.service.response.CreateAppointmentServiceResponse;

import jakarta.validation.Valid;

import lombok.RequiredArgsConstructor;

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

@RequiredArgsConstructor
@RequestMapping("/api/v1/appointments")
@RestController
public class AppointmentController {

private final CreateAppointmentService createAppointmentService;
private final UpdateAppointmentService updateAppointmentService;
private final DeleteAppointmentService deleteAppointmentService;

@PostMapping
public ResponseEntity<CreateAppointmentResponse> createAppointment(
@Valid @RequestBody CreateAppointmentRequest request) {

CreateAppointmentServiceRequest serviceRequest =
request.toCreateAppointmentServiceRequest();
CreateAppointmentServiceResponse serviceResponse =
createAppointmentService.create(serviceRequest);

return ResponseEntity.ok(CreateAppointmentResponse.from(serviceResponse));
}

@PatchMapping
public ResponseEntity<Void> updateAppointment(
@Valid @RequestBody UpdateAppointmentRequest request) {

UpdateAppointmentServiceRequest serviceRequest =
request.toUpdateAppointmentServiceRequest();
updateAppointmentService.update(serviceRequest);

return ResponseEntity.ok().build();
}

@DeleteMapping
public ResponseEntity<Void> deleteAppointment(
@RequestHeader("appointmentId") Long appointmentId,
@RequestHeader("clientId") String clientId) {

DeleteAppointmentServiceRequest serviceRequest =
new DeleteAppointmentServiceRequest(clientId, appointmentId);
deleteAppointmentService.delete(serviceRequest);

return ResponseEntity.noContent().build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package earlybird.earlybird.appointment.controller.request;

import com.fasterxml.jackson.annotation.JsonFormat;

import earlybird.earlybird.appointment.service.request.CreateAppointmentServiceRequest;
import earlybird.earlybird.common.DayOfWeekUtil;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;

import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.time.DayOfWeek;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.List;

@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
@Getter
public class CreateAppointmentRequest {
@NotBlank private String clientId;
@NotBlank private String deviceToken;
@NotBlank private String appointmentName;
@NotNull private Duration movingDuration;
@NotNull private Duration preparationDuration;

@NotNull
@JsonFormat(
shape = JsonFormat.Shape.STRING,
pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "Asia/Seoul")
private LocalDateTime firstAppointmentTime;

// 월화수목금토일
@NotNull
@Size(min = 7, max = 7, message = "repeatDayOfWeek 의 길이는 7이어야 합니다.")
private List<Boolean> repeatDayOfWeekBoolList;

public CreateAppointmentServiceRequest toCreateAppointmentServiceRequest() {

List<DayOfWeek> repeatDayOfWeekList =
DayOfWeekUtil.convertBooleanListToDayOfWeekList(this.repeatDayOfWeekBoolList);

return CreateAppointmentServiceRequest.builder()
.clientId(this.clientId)
.deviceToken(this.deviceToken)
.appointmentName(this.appointmentName)
.firstAppointmentTime(this.firstAppointmentTime)
.preparationDuration(this.preparationDuration)
.movingDuration(this.movingDuration)
.repeatDayOfWeekList(repeatDayOfWeekList)
.build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package earlybird.earlybird.appointment.controller.request;

import com.fasterxml.jackson.annotation.JsonFormat;

import earlybird.earlybird.appointment.domain.AppointmentUpdateType;
import earlybird.earlybird.appointment.service.request.UpdateAppointmentServiceRequest;
import earlybird.earlybird.common.DayOfWeekUtil;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;

import lombok.Getter;

import java.time.DayOfWeek;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.List;

@Getter
public class UpdateAppointmentRequest {

@NotNull private Long appointmentId;
@NotBlank private String clientId;
@NotBlank private String deviceToken;
@NotBlank private String appointmentName;
@NotNull private Duration movingDuration;
@NotNull private Duration preparationDuration;

@NotNull
@JsonFormat(
shape = JsonFormat.Shape.STRING,
pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "Asia/Seoul")
private LocalDateTime firstAppointmentTime;

// 월화수목금토일
@NotNull
@Size(min = 7, max = 7, message = "repeatDayOfWeek 의 길이는 7이어야 합니다.")
private List<Boolean> repeatDayOfWeekBoolList;

@NotNull private AppointmentUpdateType updateType;

public UpdateAppointmentServiceRequest toUpdateAppointmentServiceRequest() {
List<DayOfWeek> repeatDayOfWeekList =
DayOfWeekUtil.convertBooleanListToDayOfWeekList(this.repeatDayOfWeekBoolList);

return UpdateAppointmentServiceRequest.builder()
.appointmentId(appointmentId)
.clientId(clientId)
.deviceToken(deviceToken)
.appointmentName(appointmentName)
.movingDuration(movingDuration)
.preparationDuration(preparationDuration)
.firstAppointmentTime(firstAppointmentTime)
.repeatDayOfWeekList(repeatDayOfWeekList)
.updateType(updateType)
.build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package earlybird.earlybird.appointment.controller.response;

import earlybird.earlybird.appointment.service.response.CreateAppointmentServiceResponse;

import lombok.*;

@Getter
public class CreateAppointmentResponse {
private final Long createdAppointmentId;

@Builder
private CreateAppointmentResponse(Long createdAppointmentId) {
this.createdAppointmentId = createdAppointmentId;
}

public static CreateAppointmentResponse from(
CreateAppointmentServiceResponse createAppointmentServiceResponse) {
return CreateAppointmentResponse.builder()
.createdAppointmentId(createAppointmentServiceResponse.getCreatedAppointmentId())
.build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package earlybird.earlybird.appointment.controller.response;

public class UpdateAppointmentResponse {}
Loading