앱 이벤트 배너 조회 API
- 앱에서 불필요한 날짜, 팝업용, 본인인증 데이터 제거
This commit is contained in:
		| @@ -14,8 +14,6 @@ import org.springframework.cache.annotation.Cacheable | ||||
| import org.springframework.data.domain.Pageable | ||||
| import org.springframework.stereotype.Service | ||||
| import org.springframework.transaction.annotation.Transactional | ||||
| import java.time.ZoneId | ||||
| import java.time.format.DateTimeFormatter | ||||
|  | ||||
| @Service | ||||
| class AudioContentMainService( | ||||
| @@ -93,7 +91,6 @@ class AudioContentMainService( | ||||
|     } | ||||
|  | ||||
|     @Transactional(readOnly = true) | ||||
|     @Cacheable(cacheNames = ["default"], key = "'contentMainBannerList:' + #memberId + ':' + #isAdult") | ||||
|     fun getAudioContentMainBannerList(memberId: Long, isAdult: Boolean) = | ||||
|         repository.getAudioContentMainBannerList(isAdult = isAdult) | ||||
|             .asSequence() | ||||
| @@ -109,17 +106,6 @@ class AudioContentMainService( | ||||
|                     type = it.type, | ||||
|                     thumbnailImageUrl = "$imageHost/${it.thumbnailImage}", | ||||
|                     eventItem = if (it.type == AudioContentBannerType.EVENT && it.event != null) { | ||||
|                         val dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd") | ||||
|                         val startDate = it.event!!.startDate | ||||
|                             .atZone(ZoneId.of("UTC")) | ||||
|                             .withZoneSameInstant(ZoneId.of("Asia/Seoul")) | ||||
|                             .format(dateTimeFormatter) | ||||
|  | ||||
|                         val endDate = it.event!!.endDate | ||||
|                             .atZone(ZoneId.of("UTC")) | ||||
|                             .withZoneSameInstant(ZoneId.of("Asia/Seoul")) | ||||
|                             .format(dateTimeFormatter) | ||||
|  | ||||
|                         EventItem( | ||||
|                             id = it.event!!.id!!, | ||||
|                             thumbnailImageUrl = if (!it.event!!.thumbnailImage.startsWith("https://")) { | ||||
| @@ -136,11 +122,7 @@ class AudioContentMainService( | ||||
|                                 it.event!!.detailImage | ||||
|                             }, | ||||
|                             popupImageUrl = null, | ||||
|                             startDate = startDate, | ||||
|                             endDate = endDate, | ||||
|                             link = it.event!!.link, | ||||
|                             title = it.event!!.title, | ||||
|                             isPopup = false | ||||
|                             link = it.event!!.link | ||||
|                         ) | ||||
|                     } else { | ||||
|                         null | ||||
|   | ||||
| @@ -1,8 +1,5 @@ | ||||
| package kr.co.vividnext.sodalive.event | ||||
|  | ||||
| import com.querydsl.core.types.dsl.DateTimePath | ||||
| import com.querydsl.core.types.dsl.Expressions | ||||
| import com.querydsl.core.types.dsl.StringTemplate | ||||
| import com.querydsl.jpa.impl.JPAQueryFactory | ||||
| import kr.co.vividnext.sodalive.event.QEvent.event | ||||
| import org.springframework.data.jpa.repository.JpaRepository | ||||
| @@ -43,15 +40,10 @@ class EventQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) : Even | ||||
|             .select( | ||||
|                 QEventItem( | ||||
|                     event.id, | ||||
|                     event.title, | ||||
|                     event.thumbnailImage, | ||||
|                     event.detailImage, | ||||
|                     event.popupImage, | ||||
|                     getFormattedDate(event.startDate), | ||||
|                     getFormattedDate(event.endDate), | ||||
|                     event.link, | ||||
|                     event.isAdult, | ||||
|                     event.isPopup | ||||
|                     event.link | ||||
|                 ) | ||||
|             ) | ||||
|             .from(event) | ||||
| @@ -84,15 +76,10 @@ class EventQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) : Even | ||||
|             .select( | ||||
|                 QEventItem( | ||||
|                     event.id, | ||||
|                     event.title, | ||||
|                     event.thumbnailImage, | ||||
|                     event.detailImage, | ||||
|                     event.popupImage, | ||||
|                     getFormattedDate(event.startDate), | ||||
|                     getFormattedDate(event.endDate), | ||||
|                     event.link, | ||||
|                     event.isAdult, | ||||
|                     event.isPopup | ||||
|                     event.link | ||||
|                 ) | ||||
|             ) | ||||
|             .from(event) | ||||
| @@ -100,18 +87,4 @@ class EventQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) : Even | ||||
|             .orderBy(event.id.desc()) | ||||
|             .fetchFirst() | ||||
|     } | ||||
|  | ||||
|     private fun getFormattedDate(dateTimePath: DateTimePath<LocalDateTime>): StringTemplate { | ||||
|         return Expressions.stringTemplate( | ||||
|             "DATE_FORMAT({0}, {1})", | ||||
|             Expressions.dateTimeTemplate( | ||||
|                 LocalDateTime::class.java, | ||||
|                 "CONVERT_TZ({0},{1},{2})", | ||||
|                 dateTimePath, | ||||
|                 "UTC", | ||||
|                 "Asia/Seoul" | ||||
|             ), | ||||
|             "%Y-%m-%d" | ||||
|         ) | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -12,13 +12,8 @@ data class GetEventResponse( | ||||
| @JsonIgnoreProperties(ignoreUnknown = true) | ||||
| data class EventItem @QueryProjection constructor( | ||||
|     @JsonProperty("id") val id: Long, | ||||
|     @JsonProperty("title") val title: String? = null, | ||||
|     @JsonProperty("thumbnailImageUrl") var thumbnailImageUrl: String, | ||||
|     @JsonProperty("detailImageUrl") var detailImageUrl: String? = null, | ||||
|     @JsonProperty("popupImageUrl") var popupImageUrl: String? = null, | ||||
|     @JsonProperty("startDate") var startDate: String, | ||||
|     @JsonProperty("endDate") var endDate: String, | ||||
|     @JsonProperty("link") val link: String? = null, | ||||
|     @JsonProperty("isAdult") val isAdult: Boolean? = null, | ||||
|     @JsonProperty("isPopup") val isPopup: Boolean | ||||
|     @JsonProperty("link") val link: String? = null | ||||
| ) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user