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

Merge branch 'develop' into main #107

Merged
merged 70 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
f1ac769
Merge pull request #56 from LeeSM0518/DVK-88-apply-jooq-to-ebook-api
LeeSM0518 Nov 21, 2024
29aadfe
[DVK-64] docs: 알림 API에 Swagger 적용
LeeSM0518 Nov 22, 2024
83acebd
Merge branch 'develop' into DVK-64-apply-swagger-to-notification-api
LeeSM0518 Nov 22, 2024
3d3a14b
Merge pull request #57 from LeeSM0518/DVK-64-apply-swagger-to-notific…
LeeSM0518 Nov 22, 2024
cc58787
[DVK-66] docs: 리뷰 API에 Swagger 적용
LeeSM0518 Nov 22, 2024
b08308a
[DVK-66] docs: 리뷰 API에 Swagger 적용
LeeSM0518 Nov 22, 2024
d2a51d1
Merge pull request #59 from LeeSM0518/DVK-66-apply-swagger-to-review-api
LeeSM0518 Nov 22, 2024
5562e30
[DVK-66] docs: 리뷰 API에 Swagger 적용
LeeSM0518 Nov 22, 2024
f53aaeb
Merge pull request #61 from LeeSM0518/DVK-67-apply-swagger-to-service…
LeeSM0518 Nov 22, 2024
f061d59
[DVK-81] docs: 전자책 사진 API에 Swagger 적용
LeeSM0518 Nov 22, 2024
fd8dfa5
Merge pull request #63 from LeeSM0518/DVK-81-apply-swagger-to-ebook-i…
LeeSM0518 Nov 22, 2024
a7a2a2c
[DVK-82] docs: 전자책 문의 API에 Swagger 적용
LeeSM0518 Nov 22, 2024
3e02183
Merge pull request #65 from LeeSM0518/DVK-82-apply-swagger-to-ebook-i…
LeeSM0518 Nov 22, 2024
e625f97
[DVK-101] docs: 서비스 문의 사진 API에 Swagger 적용
LeeSM0518 Nov 22, 2024
64aca1a
Merge pull request #67 from LeeSM0518/DVK-66-apply-swagger-to-service…
LeeSM0518 Nov 22, 2024
2aaca30
[DVK-75] chore: Flyway 적용
LeeSM0518 Nov 22, 2024
1bc77f4
Merge pull request #69 from LeeSM0518/DVK-75-apply-flyway
LeeSM0518 Nov 22, 2024
a1fb4ab
[DVK-100] refactor: 전자책 페이징 리팩토링
LeeSM0518 Nov 23, 2024
f8adb69
[DVK-100] refactor: 전자책 페이징 리팩토링
LeeSM0518 Nov 23, 2024
fefa11f
Merge pull request #71 from LeeSM0518/DVK-100-unification-of-paging-m…
LeeSM0518 Nov 23, 2024
41da3e2
[DVK-72] fix: 예외 처리 수정
LeeSM0518 Nov 23, 2024
3e45bf9
Merge pull request #73 from LeeSM0518/DVK-72-edit-exception-handling
LeeSM0518 Nov 23, 2024
eb733db
[DVK-102] refactor: 전자책 문의 페이징 리팩토링
LeeSM0518 Nov 23, 2024
56bc7a0
Merge branch 'develop' into DVK-102-refactoring-ebook-inquiry
LeeSM0518 Nov 23, 2024
baef212
Merge pull request #75 from LeeSM0518/DVK-102-refactoring-ebook-inquiry
LeeSM0518 Nov 23, 2024
9f120dc
[DVK-103] refactor: 전자책 문의 댓글 페이징 리팩토링
LeeSM0518 Nov 23, 2024
50f8d5e
Merge pull request #77 from LeeSM0518/DVK-103-refactoring-ebook-inqui…
LeeSM0518 Nov 23, 2024
3806546
[DVK-104] refactor: 리뷰 페이징 리팩토링
LeeSM0518 Nov 23, 2024
9ef2c20
Merge pull request #79 from LeeSM0518/DVK-104-refactoring-review-paging
LeeSM0518 Nov 23, 2024
94694ff
[DVK-110] fix: 전자책 메인 사진 업로드 수정
LeeSM0518 Nov 23, 2024
fed0bab
[DVK-110] fix: 전자책 메인 사진 업로드 수정
LeeSM0518 Nov 23, 2024
5e2b43e
Merge pull request #82 from LeeSM0518/DVK-110-fix-swagger-of-ebook-im…
LeeSM0518 Nov 23, 2024
e2f713d
[DVK-105] refactor: 서비스 문의 페이징 리팩토링
LeeSM0518 Nov 23, 2024
bda43b4
Merge pull request #83 from LeeSM0518/DVK-105-refactoring-service-inq…
LeeSM0518 Nov 23, 2024
1956db1
[DVK-108] refactor: 찜 페이징 리팩토링
LeeSM0518 Nov 23, 2024
e0d1399
Merge pull request #86 from LeeSM0518/DVK-108-refactoring-wishlist-pa…
LeeSM0518 Nov 23, 2024
c97fdc5
[DVK-109] refactor: 리뷰 댓글 페이징 리팩토링
LeeSM0518 Nov 23, 2024
073f3ee
Merge pull request #88 from LeeSM0518/DVK-109-refactoring-review-comm…
LeeSM0518 Nov 23, 2024
270ca0d
[DVK-110] fix: 전자책 사진 저장 수정
LeeSM0518 Nov 23, 2024
b2d1e08
Merge branch 'develop' into DVK-110-fix-to-save-ebook-image
LeeSM0518 Nov 23, 2024
4a408ce
Merge pull request #90 from LeeSM0518/DVK-110-fix-to-save-ebook-image
LeeSM0518 Nov 23, 2024
4fcf9fe
[DVK-113] 전자책 사진 저장 API 수정
LeeSM0518 Nov 23, 2024
f1c5af7
Merge pull request #93 from LeeSM0518/DVK-113-modify-to-save-ebook-im…
LeeSM0518 Nov 23, 2024
d90c917
[DVK-98] fix: 전자책 사진 저장 API 수정
LeeSM0518 Nov 24, 2024
c66a725
Merge pull request #94 from LeeSM0518/DVK-98-supplementation-of-ebook…
LeeSM0518 Nov 24, 2024
897466c
[DVK-115] fix: 회원의 관심 카테고리 응답 수정
LeeSM0518 Nov 24, 2024
2ed3ea6
Merge pull request #96 from LeeSM0518/DVK-115-fix-favorite-category
LeeSM0518 Nov 24, 2024
0587a80
[DVK-78] fix: 회원 API 값 검증 로직 수정
LeeSM0518 Nov 24, 2024
d9769bc
[DVK-78] fix: 인증 API 값 검증 로직 수정
LeeSM0518 Nov 24, 2024
9cf9c1c
[DVK-78] fix: 전자책 API 값 검증 로직 수정
LeeSM0518 Nov 24, 2024
e7c111d
[DVK-78] fix: 알림 API 값 검증 로직 수정
LeeSM0518 Nov 24, 2024
27cf356
[DVK-78] fix: 리뷰 API 값 검증 로직 수정
LeeSM0518 Nov 24, 2024
8c7ae57
[DVK-78] fix: 리뷰 API 값 검증 로직 수정
LeeSM0518 Nov 24, 2024
fe48de4
[DVK-78] fix: 서비스 문의 API 값 검증 로직 수정
LeeSM0518 Nov 24, 2024
d4155b3
[DVK-78] fix: 서비스 문의 API 값 검증 로직 수정
LeeSM0518 Nov 24, 2024
8995871
[DVK-78] fix: 거래 API 값 검증 로직 수정
LeeSM0518 Nov 24, 2024
ea1bd83
[DVK-78] fix: 찜 API 값 검증 로직 수정
LeeSM0518 Nov 24, 2024
2e38268
[DVK-78] test: 테스트 버그 수정
LeeSM0518 Nov 24, 2024
1bd99de
[DVK-78] test: 테스트 버그 수정
LeeSM0518 Nov 24, 2024
2bcab44
Merge pull request #97 from LeeSM0518/DVK-78-modify-value-validation-…
LeeSM0518 Nov 24, 2024
c4ee231
[DVK-117] fix: 찜 목록 조회 수정
LeeSM0518 Nov 25, 2024
364cd52
Merge pull request #100 from LeeSM0518/DVK-117-edit-wish-list-view
LeeSM0518 Nov 25, 2024
a9acef1
[DVK-118] fix: 전자책 사진 저장 수정
LeeSM0518 Nov 25, 2024
af6815b
[DVK-118] fix: 전자책 사진 저장 수정
LeeSM0518 Nov 25, 2024
cdd1248
[DVK-118] fix: 전자책 사진 저장 수정
LeeSM0518 Nov 25, 2024
1c4590d
Merge pull request #102 from LeeSM0518/DVK-118-edit-to-save-ebook-image
LeeSM0518 Nov 25, 2024
e2fc12c
[DVK-119] fix: CORS 수정
LeeSM0518 Nov 25, 2024
2d1a2d5
Merge pull request #104 from LeeSM0518/DVK-119-fix-cors
LeeSM0518 Nov 25, 2024
f72a834
[DVK-121] fix: 알림 확인 API 수정
LeeSM0518 Nov 26, 2024
e098ba8
Merge pull request #106 from LeeSM0518/DVK-121-notification-confirmat…
LeeSM0518 Nov 26, 2024
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,4 @@ gradle-app.setting
docker/data
src/main/resources/application.yml

dev.application.yml
12 changes: 8 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ dependencies {

// r2dbc
implementation("org.springframework.boot:spring-boot-starter-data-r2dbc:3.0.4")
implementation("org.postgresql:r2dbc-postgresql:1.0.1.RELEASE")
runtimeOnly("org.postgresql:postgresql")
implementation("org.postgresql:r2dbc-postgresql:1.0.7.RELEASE")
implementation("org.postgresql:postgresql:42.7.4")

// feign client
implementation("org.springframework.cloud:spring-cloud-starter-openfeign")
Expand All @@ -50,7 +50,7 @@ dependencies {
implementation("io.projectreactor.kotlin:reactor-kotlin-extensions")

// validation
implementation("org.hibernate.validator:hibernate-validator:8.0.0.Final")
implementation("org.springframework.boot:spring-boot-starter-validation")

// jwt
implementation("io.jsonwebtoken:jjwt-api:$jwtVersion")
Expand Down Expand Up @@ -93,6 +93,10 @@ dependencies {
jooqCodegen("org.jooq:jooq-meta-kotlin:${jooqVersion}")
// workaround of array type codegen, see: https://github.com/jOOQ/jOOQ/issues/13322
jooqCodegen("com.h2database:h2:2.3.232")

// flyway
implementation("org.flywaydb:flyway-core:10.22.0")
implementation("org.flywaydb:flyway-database-postgresql:10.22.0")
}

jooq {
Expand Down Expand Up @@ -125,7 +129,7 @@ jooq {
// - ? matches a single character in a directory / file name
property {
key = "scripts"
value = "src/main/resources/schema.sql"
value = "src/main/resources/db/jooq/schema.sql"
}

// The sort order of the scripts within a directory, where:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import com.devooks.backend.auth.v1.service.OauthService
import com.devooks.backend.auth.v1.service.TokenService
import com.devooks.backend.member.v1.domain.Member
import com.devooks.backend.member.v1.service.MemberService
import jakarta.validation.Valid
import java.util.*
import org.springframework.transaction.annotation.Transactional
import org.springframework.web.bind.annotation.PostMapping
Expand All @@ -38,6 +39,7 @@ class AuthController(

@PostMapping("/login")
override suspend fun login(
@Valid
@RequestBody
request: LoginRequest,
): LoginResponse {
Expand All @@ -51,6 +53,7 @@ class AuthController(
@Transactional
@PostMapping("/logout")
override suspend fun logout(
@Valid
@RequestBody
request: LogoutRequest,
): LogoutResponse {
Expand All @@ -62,6 +65,7 @@ class AuthController(

@PostMapping("/reissue")
override suspend fun reissue(
@Valid
@RequestBody
request: ReissueRequest,
): ReissueResponse {
Expand All @@ -72,6 +76,7 @@ class AuthController(

@PostMapping("/check/email")
override suspend fun checkEmail(
@Valid
@RequestBody
request: CheckEmailRequest,
): CheckEmailResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ interface AuthControllerDocs {
),
ApiResponse(
responseCode = "400",
description =
"- AUTH-400-1 : 인증 코드(authorizationCode)가 NULL이거나 빈 문자일 경우\n" +
"- AUTH-400-2 : 인증 유형(oauthType)이 NAVER, KAKAO, GOOGLE 이 아닐 경우 ",
description = "- COMMON-400-0 : 유효하지 않은 요청입니다.",
content = arrayOf(
Content(
mediaType = APPLICATION_JSON_VALUE,
Expand Down Expand Up @@ -102,8 +100,7 @@ interface AuthControllerDocs {
),
ApiResponse(
responseCode = "400",
description =
"- AUTH-400-3 : 리프래시 토큰(refreshToken)이 NULL이거나 빈 문자일 경우",
description = "- COMMON-400-0 : 유효하지 않은 요청입니다.",
content = arrayOf(
Content(
mediaType = APPLICATION_JSON_VALUE,
Expand Down Expand Up @@ -152,8 +149,7 @@ interface AuthControllerDocs {
),
ApiResponse(
responseCode = "400",
description =
"- AUTH-400-3 : 리프래시 토큰(refreshToken)이 NULL이거나 빈 문자일 경우",
description = "- COMMON-400-0 : 유효하지 않은 요청입니다.",
content = arrayOf(
Content(
mediaType = APPLICATION_JSON_VALUE,
Expand Down Expand Up @@ -214,9 +210,7 @@ interface AuthControllerDocs {
),
ApiResponse(
responseCode = "400",
description =
"- AUTH-400-16 : 이메일 값이 존재하지 않을 경우" +
"- AUTH-400-17 : 이메일 형식이 아닐 경우",
description = "- COMMON-400-0 : 유효하지 않은 요청입니다.",
content = arrayOf(
Content(
mediaType = APPLICATION_JSON_VALUE,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package com.devooks.backend.auth.v1.dto

import com.devooks.backend.member.v1.error.validateEmail
import io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.Pattern

data class CheckEmailRequest(
@Schema(description = "이메일", required = true, nullable = false)
val email: String?,
@field:Pattern(regexp = "^[A-Za-z0-9+_.-]+@[A-Za-z0-9]+\\.[A-Za-z]+$")
@Schema(description = "이메일", required = true)
val email: String,
) {
fun toCommand() =
CheckEmailCommand(
email = email.validateEmail()
)
fun toCommand() = CheckEmailCommand(email = email)
}
22 changes: 9 additions & 13 deletions src/main/kotlin/com/devooks/backend/auth/v1/dto/LoginRequest.kt
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
package com.devooks.backend.auth.v1.dto

import com.devooks.backend.auth.v1.error.validateAuthorizationCode
import com.devooks.backend.auth.v1.error.validateOauthType
import com.devooks.backend.auth.v1.domain.OauthType
import io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotBlank

data class LoginRequest(
@Schema(description = "OAuth2 인증 코드", required = true, nullable = false)
val authorizationCode: String?,
@Schema(
description = "OAuth2 인증 유형 (ex. NAVER, KAKAO, GOOGLE)",
required = true,
nullable = false,
example = "NAVER"
)
val oauthType: String?,
@field:NotBlank
@Schema(description = "OAuth2 인증 코드", required = true)
val authorizationCode: String,
@Schema(description = "OAuth2 인증 유형 (ex. NAVER, KAKAO, GOOGLE)", required = true)
val oauthType: OauthType,
) {
fun toCommand(): LoginCommand =
LoginCommand(
authorizationCode = authorizationCode.validateAuthorizationCode(),
oauthType = oauthType.validateOauthType()
authorizationCode = authorizationCode,
oauthType = oauthType
)
}
11 changes: 5 additions & 6 deletions src/main/kotlin/com/devooks/backend/auth/v1/dto/LogoutRequest.kt
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package com.devooks.backend.auth.v1.dto

import com.devooks.backend.auth.v1.error.validateRefreshToken
import io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotBlank

data class LogoutRequest(
@Schema(description = "Refresh 토큰", required = true, nullable = false)
val refreshToken: String?,
@field:NotBlank
@Schema(description = "Refresh 토큰", required = true)
val refreshToken: String,
) {
fun toCommand(): LogoutCommand =
LogoutCommand(
refreshToken = refreshToken.validateRefreshToken()
)
LogoutCommand(refreshToken = refreshToken)
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package com.devooks.backend.auth.v1.dto

import com.devooks.backend.auth.v1.error.validateRefreshToken
import io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotBlank

data class ReissueRequest(
@Schema(description = "리프래시 토큰", required = true, nullable = false)
val refreshToken: String?,
@field:NotBlank
@Schema(description = "리프래시 토큰", required = true)
val refreshToken: String,
) {
fun toCommand(): ReissueCommand =
ReissueCommand(
refreshToken = refreshToken.validateRefreshToken()
)
fun toCommand(): ReissueCommand = ReissueCommand(refreshToken = refreshToken)
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,12 @@ package com.devooks.backend.auth.v1.error

import com.devooks.backend.common.exception.GeneralException
import org.springframework.http.HttpStatus
import org.springframework.http.HttpStatus.BAD_REQUEST
import org.springframework.http.HttpStatus.CONFLICT
import org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR
import org.springframework.http.HttpStatus.NOT_FOUND
import org.springframework.http.HttpStatus.UNAUTHORIZED

enum class AuthError(val exception: GeneralException) {
// 400
REQUIRED_AUTHORIZATION_CODE(GeneralException("AUTH-400-1", BAD_REQUEST, "인증 코드가 반드시 필요합니다.")),
INVALID_OAUTH_TYPE(GeneralException("AUTH-400-2", BAD_REQUEST, "인증 유형은 NAVER, KAKAO, GOOGLE 만 가능합니다.")),
REQUIRED_TOKEN(GeneralException("AUTH-400-3", BAD_REQUEST, "토큰이 반드시 필요합니다.")),
REQUIRED_OAUTH_ID(GeneralException("AUTH-400-4", BAD_REQUEST, "인증 식별자는 반드시 필요합니다.")),

// 401
EXPIRED_TOKEN(GeneralException("AUTH-401-1", UNAUTHORIZED, "만료된 토큰입니다.")),
INVALID_REFRESH_TOKEN(GeneralException("AUTH-401-2", UNAUTHORIZED, "유효하지 않는 리프래시 토큰입니다.")),
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ class CorsGlobalConfig : WebFluxConfigurer {
registry
.addMapping("/**")
.allowedOrigins("http://localhost:3000", "http://localhost:3001")
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
.allowedHeaders("Authorization", "Content-Type", "X-Requested-With")
.allowedMethods("GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS")
.allowedHeaders("Authorization", "Content-Type", "X-Requested-With", "Accepts")
.allowCredentials(true)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ import io.r2dbc.spi.ConnectionFactoryOptions
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.core.convert.converter.Converter
import org.springframework.core.io.ClassPathResource
import org.springframework.data.r2dbc.config.AbstractR2dbcConfiguration
import org.springframework.data.r2dbc.convert.R2dbcCustomConversions
import org.springframework.data.r2dbc.repository.config.EnableR2dbcRepositories
import org.springframework.r2dbc.connection.init.ConnectionFactoryInitializer
import org.springframework.r2dbc.connection.init.ResourceDatabasePopulator

@Configuration
@EnableR2dbcRepositories
Expand Down Expand Up @@ -43,11 +41,5 @@ class R2dbcConfiguration(
ConnectionFactoryInitializer()
.apply {
setConnectionFactory(connectionFactory())
setDatabasePopulator(
ResourceDatabasePopulator(
ClassPathResource("schema.sql"),
ClassPathResource("data.sql")
)
)
}
}
14 changes: 3 additions & 11 deletions src/main/kotlin/com/devooks/backend/common/domain/Image.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,14 @@ import java.util.*
class Image(
val base64Raw: String,
val extension: ImageExtension,
val byteSize: Long,
val byteSize: Int,
val order: Int
) {

fun convertDecodedImage(): ByteArray =
runCatching {
Base64.getMimeDecoder().decode(base64Raw)
Base64.getDecoder().decode(base64Raw)
}.getOrElse {
throw CommonError.FAIL_SAVE_IMAGE.exception
}

companion object {
private const val MAX_BYTE_SIZE = 50_000_000

fun Long?.validateByteSize(): Long =
this?.takeIf { it <= MAX_BYTE_SIZE }
?: throw CommonError.INVALID_BYTE_SIZE.exception
}
}
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,10 @@
package com.devooks.backend.common.domain

import com.devooks.backend.common.error.CommonError
import java.util.*

enum class ImageExtension {
JPG, PNG, JPEG;

override fun toString(): String =
this.name.lowercase(Locale.getDefault())

companion object {
fun String?.validateImageExtension(): ImageExtension =
runCatching {
this?.takeIf { it.isNotBlank() }
?.let { ImageExtension.valueOf(it.uppercase()) }
?: throw CommonError.INVALID_IMAGE_EXTENSION.exception
}.getOrElse {
throw CommonError.INVALID_IMAGE_EXTENSION.exception
}
}
}
Loading
Loading