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

Feat/#29: 노래 등록 조회, 파트 등록, 킬링파트 조회 기능 구현 ( 수정사항 추가 ) #76

Merged
merged 26 commits into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
e1d6e93
config: 백엔드 CI 설정 추가
seokhwan-an Jul 14, 2023
1ed262e
config: PR 등록 시 자동으로 리뷰어를 등록하는 기능 추가 (#61)
Cyma-s Jul 17, 2023
c298122
fix: java distribution 추가
seokhwan-an Jul 17, 2023
f29bee0
feat: 노래 등록 조회, 파트 등록, 킬링파트 조회 기능 구현
splitCoding Jul 15, 2023
7f2e663
refactor: 테스트 인자 값 변경
splitCoding Jul 16, 2023
a9388f4
refactor: RequiredArgsConstructor 로 변경, propagation 설정 제거
splitCoding Jul 17, 2023
9802a84
refactor: 정적 팩토리 메서드명 변경
splitCoding Jul 17, 2023
b82b3a3
refactor: 부모 예외 명시
splitCoding Jul 17, 2023
e421a41
refactor: 같은 길이의 동일한 시작 파트 검증 로직 변경
splitCoding Jul 17, 2023
d6be83d
refactor: request validation 어노테이션 변경
splitCoding Jul 17, 2023
29f7f5b
refactor: 부정연산자 제거를 위한 메서드 변경
splitCoding Jul 17, 2023
3f41f48
refactor: 확장성을 위해 정렬된 상태를 가지지 않게 변경
splitCoding Jul 17, 2023
5430c7f
refactor: Song 에 Parts 의존성 추가
splitCoding Jul 17, 2023
403e00a
refactor: 정확한 명시를 위해 Repository 어노테이션 추가
splitCoding Jul 17, 2023
6be3142
fix: Integer 에 붙어있는 @NotBlank 어노테이션 수정
splitCoding Jul 17, 2023
5f8fec1
refactor: 불변 필드에 final 키워드 추가
splitCoding Jul 17, 2023
6ba02de
refactor: Part 중복 검증 로직 추가
splitCoding Jul 17, 2023
e5b2db5
refactor: JPA 를 사용하는 테스트를 위한 추상 클래스 추가, DisplayName 수정
splitCoding Jul 17, 2023
93bc103
config: CODEOWNERS 설정 변경
Cyma-s Jul 18, 2023
7e3fb50
refactor: 개발 서버 환경과 시간 정보 일치를 위해 밀리초 제거
splitCoding Jul 18, 2023
7aab9cb
fix: 테스트에 밀리초 제거 로직 추가
splitCoding Jul 18, 2023
ffbbe8f
Merge branch 'main' into feat/#29
splitCoding Jul 18, 2023
6f8284c
Revert "fix: 테스트에 밀리초 제거 로직 추가"
splitCoding Jul 18, 2023
5b48c7c
fix: 테스트에 밀리초 제거 로직 추가
splitCoding Jul 18, 2023
c015aaf
fix: createdAt 검증 로직 변경
splitCoding Jul 18, 2023
7f0307a
Merge branch 'develop' into feat/#29
splitCoding Jul 18, 2023
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
5 changes: 5 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Frontend
/frontend/* @Creative-Lee @ukkodeveloper @cruelladevil

# Backend
/backend/* @Cyma-s @splitCoding @somsom13 @seokhwan-an
61 changes: 61 additions & 0 deletions .github/workflows/backend-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# workflow의 이름
name: Backend CI

# 해당 workflow가 언제 실행될 것인지에 대한 트리거를 지정
on:
pull_request:
branches: [ main ] # main branch로 pull request될 때 실행됩니다.
types: [opened, synchronize, reopened]

defaults:
run:
working-directory: backend

# workflow는 한개 이상의 job을 가지며, 각 job은 여러 step에 따라 단계를 나눌 수 있습니다.
jobs:
build:
name: CI
# 해당 jobs에서 아래의 steps들이 어떠한 환경에서 실행될 것인지를 지정합니다.(우리가 확인하고 싶은 것은 build가 되는 것과 test를 통과하는 여부를 알고 싶음)
runs-on: ubuntu-latest

steps:
# 작업에서 액세스할 수 있도록 $GITHUB_WORKSPACE에서 저장소를 체크아웃합니다.
- name: Pull Repository
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v2 # 자바를 설치하는 명렁어
with:
java-version: '17'
distribution: 'zulu'

- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
shell: bash

- name: Build with Gradle
run: ./gradlew build
shell: bash

- name: Comment on test result
uses: EnricoMi/publish-unit-test-result-action@v1
if: always()
with:
files: '**/build/test-results/test/TEST-*.xml'

- name: Show comment on fail part
uses: mikepenz/action-junit-report@v3
if: always()
with:
report_paths: '**/build/test-results/test/TEST-*.xml'
token: ${{ github.token }}

- name: Notify slack on CI fail
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
author_name: 백엔드 빌드 실패 알림
fields: repo, message, commit, author, action, eventName, ref, workflow, job, took
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: failure()
3 changes: 2 additions & 1 deletion backend/src/main/java/shook/shook/part/domain/Part.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import jakarta.persistence.PrePersist;
import jakarta.persistence.Table;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
Expand Down Expand Up @@ -57,7 +58,7 @@ public class Part {

@PrePersist
private void prePersist() {
createdAt = LocalDateTime.now();
createdAt = LocalDateTime.now().truncatedTo(ChronoUnit.MILLIS);
}

private Part(final Long id, final int startSecond, final PartLength length, final Song song) {
Expand Down
3 changes: 2 additions & 1 deletion backend/src/main/java/shook/shook/part/domain/Vote.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import jakarta.persistence.PrePersist;
import jakarta.persistence.Table;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.Objects;
import lombok.AccessLevel;
import lombok.Getter;
Expand All @@ -36,7 +37,7 @@ public class Vote {

@PrePersist
void prePersist() {
createdAt = LocalDateTime.now();
createdAt = LocalDateTime.now().truncatedTo(ChronoUnit.MILLIS);
}

private Vote(final Long id, final Part part) {
Expand Down
3 changes: 2 additions & 1 deletion backend/src/main/java/shook/shook/song/domain/Song.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import jakarta.persistence.PrePersist;
import jakarta.persistence.Table;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
Expand Down Expand Up @@ -48,7 +49,7 @@ public class Song {

@PrePersist
private void prePersist() {
createdAt = LocalDateTime.now();
createdAt = LocalDateTime.now().truncatedTo(ChronoUnit.MILLIS);
}

public Song(final String title, final String videoUrl, final String singer, final int length) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.assertj.core.api.Assertions.assertThat;

import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.List;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
Expand Down Expand Up @@ -50,9 +51,9 @@ void createdAt() {
final Part part = Part.forSave(14, PartLength.SHORT, SAVED_SONG);

//when
final LocalDateTime prev = LocalDateTime.now();
final LocalDateTime prev = LocalDateTime.now().truncatedTo(ChronoUnit.MILLIS);
final Part saved = partRepository.save(part);
final LocalDateTime after = LocalDateTime.now();
final LocalDateTime after = LocalDateTime.now().truncatedTo(ChronoUnit.MILLIS);

//then
assertThat(part).isSameAs(saved);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.assertj.core.api.Assertions.assertThat;

import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.Optional;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -69,12 +70,12 @@ void createdAt_prePersist() {
final Song song = new Song("제목", "비디오URL", "가수", 5);

//when
final LocalDateTime prev = LocalDateTime.now();
final LocalDateTime prev = LocalDateTime.now().truncatedTo(ChronoUnit.MILLIS);
final Song saved = songRepository.save(song);
final LocalDateTime after = LocalDateTime.now();
final LocalDateTime after = LocalDateTime.now().truncatedTo(ChronoUnit.MILLIS);

//then
assertThat(song).isSameAs(saved);
assertThat(song.getCreatedAt()).isAfter(prev).isBefore(after);
assertThat(song.getCreatedAt()).isBetween(prev, after);
}
}