From 7346234a98f380b2c1848c7a8fd4788be678cbff Mon Sep 17 00:00:00 2001 From: HEY <50323157+SSung023@users.noreply.github.com> Date: Sun, 30 Mar 2025 20:28:02 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[REFACTOR]CertificationRepository=20?= =?UTF-8?q?=EC=BF=BC=EB=A6=AC=20=EC=84=B1=EB=8A=A5=20=EA=B0=9C=EC=84=A0=20?= =?UTF-8?q?(#272)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor: 쿼리의 성능 개선 * chore: git submodule 갱신 * chore: 워크플로우 갱신 * chore: git submodule 갱신 * chore: 워크플로우 변경 --- .github/workflows/main.yml | 30 ++++++++----------- .github/workflows/prTest.yml | 25 +++++++--------- GitGet-BACK-SECRET | 2 +- .../repository/CertificationRepository.java | 28 +++++++++-------- 4 files changed, 40 insertions(+), 45 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 46d28e4c..df1cbb43 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -29,23 +29,19 @@ jobs: - name: make application.yml run: | - mkdir -p ./src/main/resources - cd ./src/main/resources - touch ./application.yml - touch ./application-common.yml - touch ./application-prod.yml - echo "${{ secrets.APPLICATION }}" > ./application.yml - echo "${{ secrets.COMMON }}" > ./application-common.yml - echo "${{ secrets.PROD }}" > ./application-prod.yml - - - name: make test application.yml - run: | - mkdir -p ./src/test/resources - cd ./src/test/resources - touch ./application.yml - touch ./application-test.yml - echo "${{ secrets.APPLICATION_TEST }}" > ./application.yml - echo "${{ secrets.TEST }}" > ./application-test.yml + mkdir -p src/main/resources + cp GitGet-BACK-SECRET/main/resources/application.yml src/main/resources/ + cp GitGet-BACK-SECRET/main/resources/application-prod.yml src/main/resources/ + cp GitGet-BACK-SECRET/main/resources/application-common.yml src/main/resources/ + + mkdir -p src/test/resources + cp GitGet-BACK-SECRET/test/resources/application.yml src/test/resources/ + cp HGitGet-BACK-SECRET/test/resources/application-test.yml src/test/resources/ + + echo "Main resources contents:" + ls -la src/main/resources/ + echo "Test resources contents:" + ls -la src/test/resources/ - name: Grant execute permission for gradlew run: chmod +x ./gradlew diff --git a/.github/workflows/prTest.yml b/.github/workflows/prTest.yml index 743750d3..6f8cf990 100644 --- a/.github/workflows/prTest.yml +++ b/.github/workflows/prTest.yml @@ -8,32 +8,29 @@ jobs: PRTest: runs-on: ubuntu-latest permissions: write-all + steps: - uses: actions/checkout@v4 - - - name: Set up JDK 17 - uses: actions/setup-java@v4 with: - java-version: '17' - distribution: 'temurin' + token: ${{ secrets.ACTIONS_TOKEN }} + submodules: true - name: make application.yml run: | mkdir -p src/main/resources - cp HERE-WE-SECRET/main/resources/application.yml src/main/resources/ - cp HERE-WE-SECRET/main/resources/application-dev.yml src/main/resources/ - cp HERE-WE-SECRET/main/resources/application-prod.yml src/main/resources/ - cp HERE-WE-SECRET/main/resources/application-common.yml src/main/resources/ - + cp GitGet-BACK-SECRET/main/resources/application.yml src/main/resources/ + cp GitGet-BACK-SECRET/main/resources/application-prod.yml src/main/resources/ + cp GitGet-BACK-SECRET/main/resources/application-common.yml src/main/resources/ + mkdir -p src/test/resources - cp HERE-WE-SECRET/test/resources/application.yml src/test/resources/ - cp HERE-WE-SECRET/test/resources/application-test.yml src/test/resources/ - + cp GitGet-BACK-SECRET/test/resources/application.yml src/test/resources/ + cp GitGet-BACK-SECRET/test/resources/application-test.yml src/test/resources/ + echo "Main resources contents:" ls -la src/main/resources/ echo "Test resources contents:" ls -la src/test/resources/ - + - name: Grant execute permission for gradlew run: chmod +x ./gradlew diff --git a/GitGet-BACK-SECRET b/GitGet-BACK-SECRET index d3101d08..1b02d687 160000 --- a/GitGet-BACK-SECRET +++ b/GitGet-BACK-SECRET @@ -1 +1 @@ -Subproject commit d3101d0881a3ea01d7dba39a954c8aa04d9a12c3 +Subproject commit 1b02d6877d424fa6b75ed362e774c1bde48c413c diff --git a/src/main/java/com/genius/gitget/challenge/certification/repository/CertificationRepository.java b/src/main/java/com/genius/gitget/challenge/certification/repository/CertificationRepository.java index 5329be0c..d27abbed 100644 --- a/src/main/java/com/genius/gitget/challenge/certification/repository/CertificationRepository.java +++ b/src/main/java/com/genius/gitget/challenge/certification/repository/CertificationRepository.java @@ -1,27 +1,29 @@ package com.genius.gitget.challenge.certification.repository; -import com.genius.gitget.challenge.certification.domain.CertificateStatus; -import com.genius.gitget.challenge.certification.domain.Certification; import java.time.LocalDate; import java.util.List; import java.util.Optional; + import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; +import com.genius.gitget.challenge.certification.domain.CertificateStatus; +import com.genius.gitget.challenge.certification.domain.Certification; + public interface CertificationRepository extends JpaRepository { - @Query("select c from Certification c where c.certificatedAt = :targetDate and c.participant.id = :participantId") - Optional findByDate(@Param("targetDate") LocalDate targetDate, - @Param("participantId") Long participantId); + @Query("select c from Certification c where c.participant.id = :participantId AND c.certificatedAt = :targetDate") + Optional findByDate(@Param("targetDate") LocalDate targetDate, + @Param("participantId") Long participantId); - @Query("select c from Certification c where c.participant.id = :participantId and c.certificatedAt between :startDate AND :endDate order by c.currentAttempt desc") - List findByDuration(@Param("startDate") LocalDate startDate, - @Param("endDate") LocalDate endDate, - @Param("participantId") Long participantId); + @Query("select c from Certification c where c.participant.id = :participantId and c.certificatedAt between :startDate AND :endDate order by c.currentAttempt desc") + List findByDuration(@Param("startDate") LocalDate startDate, + @Param("endDate") LocalDate endDate, + @Param("participantId") Long participantId); - @Query("select c from Certification c where c.participant.id = :participantId and c.certificationStatus = :status and c.certificatedAt <= :currentDate") - List findByStatus(@Param("participantId") Long participantId, - @Param("status") CertificateStatus status, - @Param("currentDate") LocalDate currentDate); + @Query("select c from Certification c where c.participant.id = :participantId and c.certificatedAt <= :currentDate AND c.certificationStatus = :status") + List findByStatus(@Param("participantId") Long participantId, + @Param("status") CertificateStatus status, + @Param("currentDate") LocalDate currentDate); } From f9e82b18cd8052525243180a33a84f0fcc61d8b7 Mon Sep 17 00:00:00 2001 From: SSung023 Date: Sun, 30 Mar 2025 20:38:24 +0900 Subject: [PATCH 2/2] =?UTF-8?q?chore:=20=EC=9B=8C=ED=81=AC=ED=94=8C?= =?UTF-8?q?=EB=A1=9C=EC=9A=B0=20=EC=97=85=EB=8D=B0=EC=9D=B4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index df1cbb43..d7e3b1ee 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -36,7 +36,7 @@ jobs: mkdir -p src/test/resources cp GitGet-BACK-SECRET/test/resources/application.yml src/test/resources/ - cp HGitGet-BACK-SECRET/test/resources/application-test.yml src/test/resources/ + cp GitGet-BACK-SECRET/test/resources/application-test.yml src/test/resources/ echo "Main resources contents:" ls -la src/main/resources/