-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/feat/mock-auth' into feat/mock-auth
- Loading branch information
Showing
14 changed files
with
214 additions
and
84 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
src/main/kotlin/com/wafflestudio/csereal/common/utils/StringListConverter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.wafflestudio.csereal.common.utils | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper | ||
import com.fasterxml.jackson.module.kotlin.readValue | ||
import jakarta.persistence.AttributeConverter | ||
import jakarta.persistence.Converter | ||
|
||
@Converter | ||
class StringListConverter : AttributeConverter<MutableList<String>, String> { | ||
override fun convertToDatabaseColumn(p0: MutableList<String>?): String = | ||
ObjectMapper().writeValueAsString(p0 ?: mutableListOf<String>()) | ||
|
||
override fun convertToEntityAttribute(p0: String?): MutableList<String> = | ||
ObjectMapper().readValue(p0 ?: "[]") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 0 additions & 27 deletions
27
src/main/kotlin/com/wafflestudio/csereal/core/about/database/LocationEntity.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/main/kotlin/com/wafflestudio/csereal/core/admissions/api/res/AdmissionSearchResElem.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.wafflestudio.csereal.core.admissions.api.res | ||
|
||
import com.wafflestudio.csereal.common.properties.LanguageType | ||
import com.wafflestudio.csereal.core.admissions.database.AdmissionsEntity | ||
|
||
data class AdmissionSearchResBody( | ||
val admissions: List<AdmissionSearchResElem> | ||
) | ||
|
||
data class AdmissionSearchResElem( | ||
val id: Long, | ||
val name: String, | ||
val mainType: String, | ||
val postType: String, | ||
val language: String | ||
) { | ||
companion object { | ||
fun of( | ||
admissions: AdmissionsEntity | ||
) = AdmissionSearchResElem( | ||
id = admissions.id, | ||
name = admissions.name, | ||
mainType = admissions.mainType.toJsonValue(), | ||
postType = admissions.postType.toJsonValue(), | ||
language = LanguageType.makeLowercase(admissions.language) | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 35 additions & 1 deletion
36
src/main/kotlin/com/wafflestudio/csereal/core/admissions/database/AdmissionsRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,48 @@ | ||
package com.wafflestudio.csereal.core.admissions.database | ||
|
||
import com.querydsl.jpa.impl.JPAQueryFactory | ||
import com.wafflestudio.csereal.common.properties.LanguageType | ||
import com.wafflestudio.csereal.common.repository.CommonRepository | ||
import com.wafflestudio.csereal.core.admissions.database.QAdmissionsEntity.admissionsEntity | ||
import com.wafflestudio.csereal.core.admissions.type.AdmissionsMainType | ||
import com.wafflestudio.csereal.core.admissions.type.AdmissionsPostType | ||
import org.springframework.data.jpa.repository.JpaRepository | ||
import org.springframework.stereotype.Repository | ||
|
||
interface AdmissionsRepository : JpaRepository<AdmissionsEntity, Long> { | ||
interface AdmissionsRepository : JpaRepository<AdmissionsEntity, Long>, AdmissionsCustomRepository { | ||
fun findByMainTypeAndPostTypeAndLanguage( | ||
mainType: AdmissionsMainType, | ||
postType: AdmissionsPostType, | ||
language: LanguageType | ||
): AdmissionsEntity? | ||
} | ||
|
||
interface AdmissionsCustomRepository { | ||
fun searchTopAdmissions(keyword: String, language: LanguageType, number: Int): List<AdmissionsEntity> | ||
} | ||
|
||
@Repository | ||
class AdmissionsCustomRepositoryImpl( | ||
private val commonRepository: CommonRepository, | ||
private val queryFactory: JPAQueryFactory | ||
) : AdmissionsCustomRepository { | ||
override fun searchTopAdmissions( | ||
keyword: String, | ||
language: LanguageType, | ||
number: Int | ||
): List<AdmissionsEntity> = | ||
searchQueryOfLanguage(keyword, language) | ||
.limit(number.toLong()) | ||
.fetch() | ||
|
||
fun searchQueryOfLanguage(keyword: String, language: LanguageType) = | ||
queryFactory.selectFrom( | ||
admissionsEntity | ||
).where( | ||
commonRepository.searchFullSingleTextTemplate( | ||
keyword, | ||
admissionsEntity.searchContent | ||
).gt(0.0), | ||
admissionsEntity.language.eq(language) | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.