Skip to content

Commit

Permalink
[RELEASE] v24.08.08.01 (#319)
Browse files Browse the repository at this point in the history
* [Refactor/#275]: 인덱스 제약 수정 및 추가  (#294)

* [Refactor/#300] 컨트롤러 인증 구현 (#301)

* [Feat/#293] 작가 description json 필드 추가 - imageUrl(required) (#299)

* [#298/refactor]: 가입/인증에 따라 다른 내용 채워서 이메일 보내도록 수정 (#302)

* [Chore/#303] 단순 이메일 스타일 변경입니다  (#304)

* [Refactor/#305] 액션 개선 및 수정 (#306)

* [Fix/#308]: 시큐리티 필터 파싱 오류 해결 (#309)

* [Feat/#310] 이미지 Webp 변환 코드 구현 (#311)

* [Fix/#315] 멤버의 구독 정보 제공을 위한 조회시 취소를 구분하지 않은 문제 해결 (#316)

* [#317/Refactor] 시큐리티 필터 제외 목록 점검 및 수정 (#318)

---------

Co-authored-by: 지훈 <[email protected]>
Co-authored-by: belljun3395 <[email protected]>
  • Loading branch information
3 people authored Aug 7, 2024
1 parent 9167809 commit 641ee38
Show file tree
Hide file tree
Showing 78 changed files with 780 additions and 257 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/code-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Cache Gradle
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 17
uses: actions/setup-java@v3
with:
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/ecs-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Cache Gradle
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 17
uses: actions/setup-java@v3
with:
Expand Down
105 changes: 105 additions & 0 deletions .github/workflows/ecs-dev-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: DEV - Deploy to Amazon ECS DEV

on:
push:
branches:
- dev
workflow_dispatch:
env:
AWS_REGION: ap-northeast-2
ECR_REPOSITORY: few-ecr
ECS_SERVICE: few-ecs-service
ECS_CLUSTER: few-ecs-cluster
ECS_TASK_DEFINITION: task-definition.json
TASK_DEFINITION_NAME: few-ecs-task
CONTAINER_NAME: few-container

jobs:
build-and-push-docker-image:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

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

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.DEV_AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.DEV_AWS_SECRET_KEY }}
aws-region: ${{ env.AWS_REGION }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

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

- name: Jooq Code Generation
run: |
./gradlew jooqCodegenAll
- name: Test with Gradle
run: |
./gradlew test
- name: Generate OpenAPI3
run: |
./gradlew --info api:openapi3 -PserverUrl=https://api.fewletter.shop
- name: Generate Swagger
run: |
./gradlew --info api:generateStaticSwaggerUIApi
- name: Build with Gradle bootBuildImage, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
run: |
GIT_HASH=$(git rev-parse --short HEAD)
./gradlew buildEcsDockerImage -PimageName=${ECR_REGISTRY}/${ECR_REPOSITORY}:latest
docker tag ${ECR_REGISTRY}/${ECR_REPOSITORY}:latest ${ECR_REGISTRY}/${ECR_REPOSITORY}:${GIT_HASH}
docker push ${ECR_REGISTRY}/${ECR_REPOSITORY} --all-tags
- name: Get ECR Repository image path
id: get-docker-image-path
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
run: |
GIT_HASH=$(git rev-parse --short HEAD)
echo ${ECR_REGISTRY}/${ECR_REPOSITORY}:${GIT_HASH}
echo "::set-output name=image::${ECR_REGISTRY}/${ECR_REPOSITORY}:${GIT_HASH}"
- name: Download task definition
run: |
aws ecs describe-task-definition --task-definition ${TASK_DEFINITION_NAME} --query taskDefinition > task-definition.json
- name: Fill in the new image ID in the Amazon ECS task definition
id: task-definition
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: ${{ env.ECS_TASK_DEFINITION }}
container-name: ${{ env.CONTAINER_NAME }}
image: ${{ steps.get-docker-image-path.outputs.image }}

- name: Deploy Amazon ECS task definition
id: ecs-deployment
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.task-definition.outputs.task-definition }}
service: ${{ env.ECS_SERVICE }}
cluster: ${{ env.ECS_CLUSTER }}
wait-for-service-stability: true
14 changes: 13 additions & 1 deletion .github/workflows/sql-explain-hook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: Sql Explain Hook

on:
pull_request:
branches: ["main"]
types: [ opened ]
branches: [ "main", "dev" ]
workflow_dispatch:

env:
Expand All @@ -14,12 +15,23 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "temurin"

- name: Cache Gradle
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: Jooq Code Generation
run: |
./gradlew --info jooqCodegenAll
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Integration Test
name: Validate Test

on:
pull_request:
branches: [ "main" ]
branches: [ "dev" ]
workflow_dispatch:

permissions:
Expand All @@ -22,6 +22,16 @@ jobs:
java-version: '17'
distribution: 'temurin'

- name: Cache Gradle
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: Jooq Code Generation
run: |
./gradlew --info jooqCodegenAll
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,6 @@ api-repo/**/*.sql
batch/**/*.sql
email/**/*.sql
storage/**/*.sql

# DB explain result files
**/resources/explain/
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ class ArticleMainCardDao(
ARTICLE_MAIN_CARD.WRITER_DESCRIPTION,
"name"
).`as`(ArticleMainCardRecord::writerName.name),
jsonGetAttribute(ARTICLE_MAIN_CARD.WRITER_DESCRIPTION, "url").`as`(ArticleMainCardRecord::writerImgUrl.name),
jsonGetAttribute(ARTICLE_MAIN_CARD.WRITER_DESCRIPTION, "url").`as`(ArticleMainCardRecord::writerUrl.name),
jsonGetAttribute(ARTICLE_MAIN_CARD.WRITER_DESCRIPTION, "imageUrl").`as`(ArticleMainCardRecord::writerImgUrl.name),
ARTICLE_MAIN_CARD.WORKBOOKS.`as`(ArticleMainCardRecord::workbooks.name)
).from(ARTICLE_MAIN_CARD)
.where(ARTICLE_MAIN_CARD.ID.`in`(articleIds))
Expand Down Expand Up @@ -70,7 +71,8 @@ class ArticleMainCardDao(
commonJsonMapper.toJsonStr(
mapOf(
"name" to command.writerName,
"url" to command.writerImgUrl
"url" to command.writerUrl,
"imageUrl" to command.writerImgUrl
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ data class ArticleMainCardExcludeWorkbookCommand(
val writerId: Long,
val writerEmail: String,
val writerName: String,
val writerUrl: URL,
val writerImgUrl: URL,
)
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ data class ArticleMainCardRecord(
val writerId: Long,
val writerEmail: String,
val writerName: String,
val writerUrl: URL,
val writerImgUrl: URL,
val workbooks: List<WorkbookRecord> = emptyList(),
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class ArticleMainCardMapper(
writerId = record.get(ArticleMainCardRecord::writerId.name, Long::class.java),
writerEmail = record.get(ArticleMainCardRecord::writerEmail.name, String::class.java),
writerName = record.get(ArticleMainCardRecord::writerName.name, String::class.java),
writerUrl = record.get(ArticleMainCardRecord::writerUrl.name, URL::class.java),
writerImgUrl = record.get(ArticleMainCardRecord::writerImgUrl.name, URL::class.java),
workbooks = record.get(ArticleMainCardRecord::workbooks.name, JSON::class.java)?.data()?.let {
if ("{}".equals(it)) {
Expand Down
22 changes: 15 additions & 7 deletions api-repo/src/main/kotlin/com/few/api/repo/dao/member/MemberDao.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import com.few.api.repo.dao.member.query.SelectMemberByEmailQuery
import com.few.api.repo.dao.member.query.SelectWriterQuery
import com.few.api.repo.dao.member.query.SelectWritersQuery
import com.few.api.repo.dao.member.record.MemberIdAndIsDeletedRecord
import com.few.api.repo.dao.member.record.MemberIdAndNameRecord
import com.few.api.repo.dao.member.record.MemberRecord
import com.few.api.repo.dao.member.record.MemberEmailAndTypeRecord
import com.few.api.repo.dao.member.record.WriterRecord
import com.few.api.repo.dao.member.record.WriterRecordMappedWorkbook
Expand All @@ -22,6 +22,7 @@ import jooq.jooq_dsl.tables.MappingWorkbookArticle
import jooq.jooq_dsl.tables.Member
import org.jooq.DSLContext
import org.jooq.impl.DSL
import org.jooq.impl.DSL.jsonGetAttribute
import org.jooq.impl.DSL.jsonGetAttributeAsText
import org.springframework.cache.annotation.Cacheable
import org.springframework.stereotype.Repository
Expand All @@ -42,7 +43,8 @@ class MemberDao(
fun selectWriterQuery(query: SelectWriterQuery) = dslContext.select(
Member.MEMBER.ID.`as`(WriterRecord::writerId.name),
DSL.jsonGetAttributeAsText(Member.MEMBER.DESCRIPTION, "name").`as`(WriterRecord::name.name),
DSL.jsonGetAttribute(Member.MEMBER.DESCRIPTION, "url").`as`(WriterRecord::url.name)
DSL.jsonGetAttribute(Member.MEMBER.DESCRIPTION, "url").`as`(WriterRecord::url.name),
DSL.jsonGetAttribute(Member.MEMBER.DESCRIPTION, "imageUrl").`as`(WriterRecord::imageUrl.name)
)
.from(Member.MEMBER)
.where(Member.MEMBER.ID.eq(query.writerId))
Expand Down Expand Up @@ -73,7 +75,8 @@ class MemberDao(
Member.MEMBER.ID.`as`(WriterRecord::writerId.name),
DSL.jsonGetAttributeAsText(Member.MEMBER.DESCRIPTION, "name")
.`as`(WriterRecord::name.name),
DSL.jsonGetAttribute(Member.MEMBER.DESCRIPTION, "url").`as`(WriterRecord::url.name)
DSL.jsonGetAttribute(Member.MEMBER.DESCRIPTION, "url").`as`(WriterRecord::url.name),
DSL.jsonGetAttribute(Member.MEMBER.DESCRIPTION, "imageUrl").`as`(WriterRecord::imageUrl.name)
)
.from(Member.MEMBER)
.where(Member.MEMBER.ID.`in`(notCachedIds))
Expand Down Expand Up @@ -125,14 +128,19 @@ class MemberDao(
.where(Member.MEMBER.TYPE_CD.eq(MemberType.WRITER.code))
.and(Member.MEMBER.DELETED_AT.isNull)

fun selectMemberByEmail(query: SelectMemberByEmailQuery): MemberIdAndNameRecord? {
fun selectMemberByEmail(query: SelectMemberByEmailQuery): MemberRecord? {
return selectMemberByEmailQuery(query)
.fetchOneInto(MemberIdAndNameRecord::class.java)
.fetchOneInto(MemberRecord::class.java)
}

fun selectMemberByEmailQuery(query: SelectMemberByEmailQuery) = dslContext.select(
Member.MEMBER.ID.`as`(MemberIdAndNameRecord::memberId.name),
jsonGetAttributeAsText(Member.MEMBER.DESCRIPTION, "name").`as`(MemberIdAndNameRecord::writerName.name) // writer only(nullable)
Member.MEMBER.ID.`as`(MemberRecord::memberId.name),
// writer only(nullable)
jsonGetAttributeAsText(Member.MEMBER.DESCRIPTION, "name").`as`(MemberRecord::writerName.name),
// writer only(nullable)
jsonGetAttribute(Member.MEMBER.DESCRIPTION, "url").`as`(MemberRecord::url.name),
// writer only(nullable)
jsonGetAttribute(Member.MEMBER.DESCRIPTION, "imageUrl").`as`(MemberRecord::imageUrl.name)
)
.from(Member.MEMBER)
.where(Member.MEMBER.EMAIL.eq(query.email))
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.few.api.repo.dao.member.record

import java.net.URL

data class MemberRecord(
val memberId: Long,
val writerName: String?, // writer only
val imageUrl: URL?, // writer only
val url: URL?, // writer only
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ data class WriterRecord(
val writerId: Long,
val name: String,
val url: URL,
val imageUrl: URL,
)
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ import java.net.URL
data class WriterDescription(
val name: String,
val url: URL,
val imageUrl: URL,
)
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import com.few.api.repo.dao.subscription.query.CountAllWorkbooksSubscription
import com.few.api.repo.dao.subscription.query.SelectAllWorkbookSubscriptionStatusNotConsiderDeletedAtQuery
import com.few.api.repo.dao.subscription.record.WorkbookSubscriptionStatus
import com.few.api.repo.dao.subscription.query.CountWorkbookMappedArticlesQuery
import com.few.api.repo.dao.subscription.query.SelectAllMemberWorkbookSubscriptionStatusNotConsiderDeletedAtQuery
import com.few.api.repo.dao.subscription.query.SelectAllMemberWorkbookSubscriptionStatusUnsubOpinionConditionAndNotConsiderDeletedAQuery
import com.few.api.repo.dao.subscription.record.CountAllSubscriptionStatusRecord
import com.few.api.repo.dao.subscription.record.MemberWorkbookSubscriptionStatusRecord
import jooq.jooq_dsl.Tables.MAPPING_WORKBOOK_ARTICLE
Expand Down Expand Up @@ -69,23 +69,24 @@ class SubscriptionDao(
.orderBy(SUBSCRIPTION.CREATED_AT.desc())
.limit(1)

fun selectAllWorkbookSubscriptionStatus(query: SelectAllMemberWorkbookSubscriptionStatusNotConsiderDeletedAtQuery): List<MemberWorkbookSubscriptionStatusRecord> {
fun selectAllWorkbookSubscriptionStatus(query: SelectAllMemberWorkbookSubscriptionStatusUnsubOpinionConditionAndNotConsiderDeletedAQuery): List<MemberWorkbookSubscriptionStatusRecord> {
return selectAllWorkbookSubscriptionStatusQuery(query)
.fetchInto(MemberWorkbookSubscriptionStatusRecord::class.java)
}

fun selectAllWorkbookSubscriptionStatusQuery(query: SelectAllMemberWorkbookSubscriptionStatusNotConsiderDeletedAtQuery) =
fun selectAllWorkbookSubscriptionStatusQuery(query: SelectAllMemberWorkbookSubscriptionStatusUnsubOpinionConditionAndNotConsiderDeletedAQuery) =
dslContext.select(
SUBSCRIPTION.TARGET_WORKBOOK_ID.`as`(MemberWorkbookSubscriptionStatusRecord::workbookId.name),
SUBSCRIPTION.DELETED_AT.isNull.`as`(MemberWorkbookSubscriptionStatusRecord::isActiveSub.name),
DSL.max(SUBSCRIPTION.PROGRESS).add(1).`as`(MemberWorkbookSubscriptionStatusRecord::currentDay.name),
DSL.max(MAPPING_WORKBOOK_ARTICLE.DAY_COL).`as`(MemberWorkbookSubscriptionStatusRecord::totalDay.name)
)
.from(SUBSCRIPTION)
.leftJoin(MappingWorkbookArticle.MAPPING_WORKBOOK_ARTICLE)
.join(MappingWorkbookArticle.MAPPING_WORKBOOK_ARTICLE)
.on(SUBSCRIPTION.TARGET_WORKBOOK_ID.eq(MappingWorkbookArticle.MAPPING_WORKBOOK_ARTICLE.WORKBOOK_ID))
.where(SUBSCRIPTION.MEMBER_ID.eq(query.memberId))
.and(SUBSCRIPTION.TARGET_MEMBER_ID.isNull)
.and(SUBSCRIPTION.UNSUBS_OPINION.`in`(query.unsubOpinion, query.activeSubscriptionUnsubOpinion))
.groupBy(SUBSCRIPTION.TARGET_WORKBOOK_ID, SUBSCRIPTION.DELETED_AT)
.query

Expand Down

This file was deleted.

Loading

0 comments on commit 641ee38

Please sign in to comment.