From 0a4499837a7e485860c2d50a7243b4b121401e90 Mon Sep 17 00:00:00 2001 From: Choo Date: Tue, 6 Aug 2024 21:26:25 +0900 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20keyword=20null=EC=9D=BC=20=EB=95=8C?= =?UTF-8?q?=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/http/offering.http | 2 +- .../chongdae/offering/repository/OfferingRepository.java | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/backend/http/offering.http b/backend/http/offering.http index d10292837..19cd5fadd 100644 --- a/backend/http/offering.http +++ b/backend/http/offering.http @@ -2,7 +2,7 @@ GET {{base-url}}/offerings/1 ### 공모 목록 조회 API -GET {{base-url}}/offerings?filter=RECENT&search=&last-id=99&page-size=2 +GET {{base-url}}/offerings ### 공모 필터 목록 조회 API GET {{base-url}}/offerings/filters diff --git a/backend/src/main/java/com/zzang/chongdae/offering/repository/OfferingRepository.java b/backend/src/main/java/com/zzang/chongdae/offering/repository/OfferingRepository.java index 5cbaaf7d7..edb224b62 100644 --- a/backend/src/main/java/com/zzang/chongdae/offering/repository/OfferingRepository.java +++ b/backend/src/main/java/com/zzang/chongdae/offering/repository/OfferingRepository.java @@ -22,7 +22,8 @@ public interface OfferingRepository extends JpaRepository @Query(""" SELECT o FROM OfferingEntity o - WHERE o.id < :lastId AND (o.title LIKE %:keyword% OR o.meetingAddress LIKE %:keyword%) + WHERE o.id < :lastId + AND (:keyword IS NULL OR o.title LIKE %:keyword% OR o.meetingAddress LIKE %:keyword%) ORDER BY o.id DESC """) List findRecentOfferingsWithKeyword(Long lastId, String keyword, Pageable pageable); @@ -31,7 +32,7 @@ public interface OfferingRepository extends JpaRepository SELECT o FROM OfferingEntity o WHERE (o.deadline > :lastDeadline OR (o.deadline = :lastDeadline AND o.id < :lastId)) - AND (o.title LIKE %:keyword% OR o.meetingAddress LIKE %:keyword%) + AND (:keyword IS NULL OR o.title LIKE %:keyword% OR o.meetingAddress LIKE %:keyword%) ORDER BY o.deadline ASC, o.id DESC """) List findImminentOfferingsWithKeyword( @@ -42,7 +43,7 @@ List findImminentOfferingsWithKeyword( FROM OfferingEntity o WHERE ((o.eachPrice - (o.totalPrice * 1.0 / o.totalCount)) / o.eachPrice < :discountRate OR ((o.eachPrice - (o.totalPrice * 1.0 / o.totalCount)) / o.eachPrice = :discountRate AND o.id < :lastId)) - AND (o.title LIKE %:keyword% OR o.meetingAddress LIKE %:keyword%) + AND (:keyword IS NULL OR o.title LIKE %:keyword% OR o.meetingAddress LIKE %:keyword%) ORDER BY (o.eachPrice - (o.totalPrice * 1.0 / o.totalCount)) / o.eachPrice DESC, o.id DESC """) List findHighDiscountOfferingsWithKeyword( From d2417b9ce38f81b01fd9cff5448042ebe70a1a1d Mon Sep 17 00:00:00 2001 From: Choo Date: Tue, 6 Aug 2024 21:29:54 +0900 Subject: [PATCH 2/3] =?UTF-8?q?test:=20optional()=20=EB=B6=99=EC=97=AC?= =?UTF-8?q?=EC=84=9C=20required=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../offering/integration/OfferingIntegrationTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/src/test/java/com/zzang/chongdae/offering/integration/OfferingIntegrationTest.java b/backend/src/test/java/com/zzang/chongdae/offering/integration/OfferingIntegrationTest.java index 876543154..e30a611c7 100644 --- a/backend/src/test/java/com/zzang/chongdae/offering/integration/OfferingIntegrationTest.java +++ b/backend/src/test/java/com/zzang/chongdae/offering/integration/OfferingIntegrationTest.java @@ -119,10 +119,10 @@ class GetAllOffering { List queryParameterDescriptors = List.of( parameterWithName("filter").description("필터 이름 (기본값: RECENT)" - + getEnumValuesAsString(OfferingFilter.class)), - parameterWithName("search").description("검색어"), - parameterWithName("last-id").description("마지막 공모 id"), - parameterWithName("page-size").description("페이지 크기 (기본값: 10)") + + getEnumValuesAsString(OfferingFilter.class)).optional(), + parameterWithName("search").description("검색어").optional(), + parameterWithName("last-id").description("마지막 공모 id").optional(), + parameterWithName("page-size").description("페이지 크기 (기본값: 10)").optional() ); List successResponseDescriptors = List.of( fieldWithPath("offerings[].id").description("공모 id"), From 9e9f232f6f3b4190120b81ad42192070664feab4 Mon Sep 17 00:00:00 2001 From: Choo Date: Tue, 6 Aug 2024 22:00:30 +0900 Subject: [PATCH 3/3] =?UTF-8?q?chore:=20auto=20close=20issue=20=EC=8A=A4?= =?UTF-8?q?=ED=81=AC=EB=A6=BD=ED=8A=B8=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/auto-close-issue.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/auto-close-issue.yml diff --git a/.github/workflows/auto-close-issue.yml b/.github/workflows/auto-close-issue.yml new file mode 100644 index 000000000..45ef3aa66 --- /dev/null +++ b/.github/workflows/auto-close-issue.yml @@ -0,0 +1,20 @@ +name: Auto Close Issues on Merge + +on: + pull_request: + types: [opened] # closed로 바꾸기 + +jobs: + close-related-issue: + runs-on: ubuntu-latest + if: github.event.pull_request.merged == true && github.base.ref != 'main' + steps: + - name: Extract and Close Issue + run: | + PR_BODY="${{ github.event.pull_request.body }}" + ISSUE_NUMBERS=$(echo $PR_BODY | grep -oP 'close #\d+' | awk '{print substr($2, 2)}') + for ISSUE_NUMBER in $ISSUE_NUMBERS; do + gh api -X PATCH /repos/${{ github.repository }}/issues/$ISSUE_NUMBER --field state=closed + done + env: + GITHUB_TOKEN: ${{ secrets.AUTO_CLOSE_GITHUB_TOKEN }}