Skip to content

Commit

Permalink
Refactor | CAKK-82 | 클래스 메서드 공백 및 개행 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
YongsHub committed Sep 16, 2024
1 parent d4674e3 commit 4a58014
Show file tree
Hide file tree
Showing 27 changed files with 58 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import com.cakk.domain.mysql.repository.jpa.BusinessInformationJpaRepository
class BusinessInformationReadFacade(
private val businessInformationJpaRepository: BusinessInformationJpaRepository
) {

fun isExistBusinessInformation(owner: User, cakeShopId: Long): Boolean {
return businessInformationJpaRepository.existsBusinessInformationByUserAndCakeShop_Id(owner, cakeShopId)
}
Expand All @@ -28,3 +29,4 @@ class BusinessInformationReadFacade(
return businessInformationJpaRepository.findBusinessInformationByUserId(userId) ?: throw CakkException(ReturnCode.NOT_EXIST_CAKE_SHOP)
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class CakeReadFacade(
private val cakeCategoryJpaRepository: CakeCategoryJpaRepository,
private val cakeQueryRepository: CakeQueryRepository
) {

fun findById(cakeId: Long): Cake {
return cakeJpaRepository.findById(cakeId).orElseThrow { CakkException(ReturnCode.NOT_EXIST_CAKE) }
}
Expand Down Expand Up @@ -79,3 +80,4 @@ class CakeReadFacade(
return cakeCategoryJpaRepository.findByCakeId(cakeId) ?: throw CakkException(ReturnCode.NOT_EXIST_CAKE_CATEGORY)
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class CakeShopReadFacade(
private val cakeShopLinkJpaRepository: CakeShopLinkJpaRepository,
private val businessInformationJpaRepository: BusinessInformationJpaRepository
) {

fun findById(cakeShopId: Long): CakeShop {
return cakeShopJpaRepository.findById(cakeShopId).orElseThrow { CakkException(ReturnCode.NOT_EXIST_CAKE_SHOP) }
}
Expand Down Expand Up @@ -100,3 +101,4 @@ class CakeShopReadFacade(
return cakeShopLinkJpaRepository.findAllByCakeShopId(cakeShopId)
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class CakeShopUserReadFacade(
private val cakeShopHeartQueryRepository: CakeShopHeartQueryRepository,
private val cakeHeartQueryRepository: CakeHeartQueryRepository
) {

fun searchAllCakeShopsByCursorAndHeart(
cakeShopHeartId: Long?,
userId: Long?,
Expand All @@ -29,3 +30,4 @@ class CakeShopUserReadFacade(
return cakeHeartQueryRepository.searchCakeImagesByCursorAndHeart(cakeHeartId, userId, pageSize)
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ class TagReadFacade(
}.toList()
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class UserReadFacade(
private val userJpaRepository: UserJpaRepository,
private val userQueryRepository: UserQueryRepository
) {

fun findByUserId(userId: Long): User {
return userJpaRepository.findById(userId).orElseThrow { CakkException(ReturnCode.NOT_EXIST_USER) }
}
Expand All @@ -31,3 +32,4 @@ class UserReadFacade(
return userJpaRepository.findAll()
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ class DataSourceConfig {
return HikariDataSource(hikariConfig())
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ class JacksonConfig {
return objectMapper
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ class P6spyConfig {
P6SpyOptions.getActiveInstance().logMessageFormat = P6spySqlFormatterConfig::class.java.name
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import java.util.*
import java.util.function.Predicate

class P6spySqlFormatterConfig : MessageFormattingStrategy {
override fun formatMessage(

override fun formatMessage(
connectionId: Int,
now: String,
elapsed: Long,
Expand Down Expand Up @@ -96,3 +97,4 @@ class P6spySqlFormatterConfig : MessageFormattingStrategy {
private const val COMMENT = "comment"
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ import org.springframework.context.annotation.Configuration

@Configuration
class QuerydslConfig {

@PersistenceContext
private val entityManager: EntityManager? = null
@Bean
fun queryFactory(): JPAQueryFactory {
return JPAQueryFactory(JPQLTemplates.DEFAULT, entityManager)
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import jakarta.persistence.AttributeConverter
import java.util.stream.Stream

class DayOfWeekConverter : AttributeConverter<Days?, Int?> {
override fun convertToDatabaseColumn(days: Days?): Int? {

override fun convertToDatabaseColumn(days: Days?): Int? {
return days?.code
}

Expand All @@ -20,3 +21,4 @@ class DayOfWeekConverter : AttributeConverter<Days?, Int?> {
.orElseThrow { CakkException(ReturnCode.INTERNAL_SERVER_ERROR) }
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import jakarta.persistence.AttributeConverter
import java.util.stream.Stream

class LinkKindConverter : AttributeConverter<LinkKind?, String?> {
override fun convertToDatabaseColumn(linkKind: LinkKind?): String? {

override fun convertToDatabaseColumn(linkKind: LinkKind?): String? {
return linkKind?.value
}

Expand All @@ -20,3 +21,4 @@ class LinkKindConverter : AttributeConverter<LinkKind?, String?> {
.orElseThrow { CakkException(ReturnCode.INTERNAL_SERVER_ERROR) }
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import jakarta.persistence.AttributeConverter
import java.util.stream.Stream

class VerificationStatusConverter : AttributeConverter<VerificationStatus?, Int?> {
override fun convertToDatabaseColumn(verificationStatus: VerificationStatus?): Int? {

override fun convertToDatabaseColumn(verificationStatus: VerificationStatus?): Int? {
return verificationStatus?.code
}

Expand All @@ -20,3 +21,4 @@ class VerificationStatusConverter : AttributeConverter<VerificationStatus?, Int?
.orElseThrow { CakkException(ReturnCode.INTERNAL_SERVER_ERROR) }
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import org.springframework.data.repository.query.Param
import java.util.*

interface BusinessInformationJpaRepository : JpaRepository<BusinessInformation, Long> {
@Query("select bi from BusinessInformation as bi join fetch bi.cakeShop "

@Query("select bi from BusinessInformation as bi join fetch bi.cakeShop "
+ "where bi.cakeShop.id =:cakeShopId")
fun findBusinessInformationWithCakeShop(@Param("cakeShopId") cakeShopId: Long): BusinessInformation?

Expand All @@ -28,3 +29,4 @@ interface BusinessInformationJpaRepository : JpaRepository<BusinessInformation,
+ " where bi.user.id =:userId")
fun findBusinessInformationByUserId(userId: Long): BusinessInformation?
}

Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ import org.springframework.data.jpa.repository.JpaRepository
import java.util.*

interface CakeCategoryJpaRepository : JpaRepository<CakeCategory, Long> {
fun findByCakeId(cakeId: Long?): CakeCategory?

fun findByCakeId(cakeId: Long?): CakeCategory?
}

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import org.springframework.data.jpa.repository.JpaRepository
import java.util.*

interface CakeHeartJpaRepository : JpaRepository<CakeHeart, Long> {
fun findAllByUser(user: User): List<CakeHeart>

fun findAllByUser(user: User): List<CakeHeart>
fun findByUserAndCake(user: User, cake: Cake): CakeHeart?
fun existsByUserAndCake(user: User, cake: Cake): Boolean
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ import com.cakk.domain.mysql.entity.shop.CakeShopLink
import org.springframework.data.jpa.repository.JpaRepository

interface CakeShopLinkJpaRepository : JpaRepository<CakeShopLink, Long> {
fun findAllByCakeShopId(cakeShopId: Long): List<CakeShopLink>

fun findAllByCakeShopId(cakeShopId: Long): List<CakeShopLink>
}

Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ import com.cakk.domain.mysql.entity.shop.CakeShopOperation
import org.springframework.data.jpa.repository.JpaRepository

interface CakeShopOperationJpaRepository : JpaRepository<CakeShopOperation, Long> {
fun findAllByCakeShopId(cakeShopId: Long): List<CakeShopOperation>

fun findAllByCakeShopId(cakeShopId: Long): List<CakeShopOperation>
}

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import java.util.*

@Repository
interface TagJpaRepository : JpaRepository<Tag, Long> {
fun findTagByTagName(tagName: String?): Tag?

fun findTagByTagName(tagName: String?): Tag?
fun findTagsByTagNameIsIn(tagNames: List<String>): List<Tag>
}

Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ import org.springframework.data.jpa.repository.JpaRepository
import java.util.*

interface UserJpaRepository : JpaRepository<User, Long> {

fun findByProviderId(providerId: String): User?
}

Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ import org.locationtech.jts.geom.Point
import org.locationtech.jts.geom.PrecisionModel

abstract class DomainTest {
protected val reflectionMonkey: FixtureMonkey

protected val reflectionMonkey: FixtureMonkey
protected get() = FixtureMonkey.builder()
.plugin(JakartaValidationPlugin())
.objectIntrospector(FieldReflectionArbitraryIntrospector.INSTANCE)
Expand Down Expand Up @@ -99,3 +100,4 @@ abstract class DomainTest {
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,4 @@ abstract class FacadeTest {
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Test

internal class BusinessInformationTest : DomainTest() {
private fun getBusinessInformationFixtureWithUser(verificationStatus: VerificationStatus, role: Role): BusinessInformation {

private fun getBusinessInformationFixtureWithUser(verificationStatus: VerificationStatus, role: Role): BusinessInformation {
return constructorMonkey.giveMeBuilder(BusinessInformation::class.java)
.setNotNull("businessNumber")
.set("businessNumber", Arbitraries.strings().withCharRange('a', 'z').ofMaxLength(20))
Expand Down Expand Up @@ -102,3 +103,4 @@ internal class BusinessInformationTest : DomainTest() {
Assertions.assertThat(businessInformation.isBusinessOwnerCandidate(verificationPolicy)).isFalse
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Test

class VerificationPolicyTest : DomainTest() {
@Test

@Test
@DisplayName("인증 정책은 사용자를 케이크샵 주인으로 승격시켜준다")
fun approveToBusinessOwner() {
val verificationPolicy = verificationPolicy
Expand Down Expand Up @@ -67,3 +68,4 @@ class VerificationPolicyTest : DomainTest() {
) { verificationPolicy.requestCertificationBusinessOwner(businessInformation, param) }
}
}

0 comments on commit 4a58014

Please sign in to comment.