콘텐츠 업로드
- 예약 업로드를 위해 공개날짜를 추가
This commit is contained in:
		| @@ -5,6 +5,7 @@ import kr.co.vividnext.sodalive.content.hashtag.AudioContentHashTag | ||||
| import kr.co.vividnext.sodalive.content.main.curation.AudioContentCuration | ||||
| import kr.co.vividnext.sodalive.content.theme.AudioContentTheme | ||||
| import kr.co.vividnext.sodalive.member.Member | ||||
| import java.time.LocalDateTime | ||||
| import javax.persistence.CascadeType | ||||
| import javax.persistence.Column | ||||
| import javax.persistence.Entity | ||||
| @@ -32,6 +33,7 @@ data class AudioContent( | ||||
|     @Column(columnDefinition = "TEXT", nullable = false) | ||||
|     var detail: String, | ||||
|     val price: Int = 0, | ||||
|     var releaseDate: LocalDateTime? = null, | ||||
|     @Enumerated(value = EnumType.STRING) | ||||
|     val type: AudioContentType = AudioContentType.INDIVIDUAL, | ||||
|     val isGeneratePreview: Boolean = true, | ||||
|   | ||||
| @@ -18,6 +18,7 @@ import kr.co.vividnext.sodalive.content.order.OrderRepository | ||||
| import kr.co.vividnext.sodalive.content.order.OrderType | ||||
| import kr.co.vividnext.sodalive.content.theme.AudioContentThemeQueryRepository | ||||
| import kr.co.vividnext.sodalive.explorer.ExplorerQueryRepository | ||||
| import kr.co.vividnext.sodalive.extensions.convertLocalDateTime | ||||
| import kr.co.vividnext.sodalive.fcm.FcmEvent | ||||
| import kr.co.vividnext.sodalive.fcm.FcmEventType | ||||
| import kr.co.vividnext.sodalive.member.Member | ||||
| @@ -143,6 +144,15 @@ class AudioContentService( | ||||
|         // 미리듣기 시간 체크 | ||||
|         validatePreviewTime(request.previewStartTime, request.previewEndTime) | ||||
|  | ||||
|         val releaseDate = if (request.releaseDate != null) { | ||||
|             request.releaseDate.convertLocalDateTime("yyyy-MM-dd HH:mm") | ||||
|                 .atZone(ZoneId.of(request.timezone)) | ||||
|                 .withZoneSameInstant(ZoneId.of("UTC")) | ||||
|                 .toLocalDateTime() | ||||
|         } else { | ||||
|             null | ||||
|         } | ||||
|  | ||||
|         // contentFile 체크 | ||||
|         if (contentFile == null && request.type == AudioContentType.INDIVIDUAL) { | ||||
|             throw SodaException("콘텐츠를 선택해 주세요.") | ||||
| @@ -168,6 +178,7 @@ class AudioContentService( | ||||
|             } else { | ||||
|                 0 | ||||
|             }, | ||||
|             releaseDate = releaseDate, | ||||
|             isAdult = request.isAdult, | ||||
|             isGeneratePreview = if (request.type == AudioContentType.INDIVIDUAL) { | ||||
|                 request.isGeneratePreview | ||||
| @@ -346,29 +357,31 @@ class AudioContentService( | ||||
|             ) | ||||
|         ) | ||||
|  | ||||
|         applicationEventPublisher.publishEvent( | ||||
|             FcmEvent( | ||||
|                 type = FcmEventType.UPLOAD_CONTENT, | ||||
|                 title = audioContent.member!!.nickname, | ||||
|                 message = "콘텐츠를 업로드 하였습니다. - ${audioContent.title}", | ||||
|                 isAuth = audioContent.isAdult, | ||||
|                 contentId = contentId, | ||||
|                 creatorId = audioContent.member!!.id, | ||||
|                 container = "ios" | ||||
|         if (audioContent.releaseDate == null) { | ||||
|             applicationEventPublisher.publishEvent( | ||||
|                 FcmEvent( | ||||
|                     type = FcmEventType.UPLOAD_CONTENT, | ||||
|                     title = audioContent.member!!.nickname, | ||||
|                     message = "콘텐츠를 업로드 하였습니다. - ${audioContent.title}", | ||||
|                     isAuth = audioContent.isAdult, | ||||
|                     contentId = contentId, | ||||
|                     creatorId = audioContent.member!!.id, | ||||
|                     container = "ios" | ||||
|                 ) | ||||
|             ) | ||||
|         ) | ||||
|  | ||||
|         applicationEventPublisher.publishEvent( | ||||
|             FcmEvent( | ||||
|                 type = FcmEventType.UPLOAD_CONTENT, | ||||
|                 title = audioContent.member!!.nickname, | ||||
|                 message = "콘텐츠를 업로드 하였습니다. - ${audioContent.title}", | ||||
|                 isAuth = audioContent.isAdult, | ||||
|                 contentId = contentId, | ||||
|                 creatorId = audioContent.member!!.id, | ||||
|                 container = "aos" | ||||
|             applicationEventPublisher.publishEvent( | ||||
|                 FcmEvent( | ||||
|                     type = FcmEventType.UPLOAD_CONTENT, | ||||
|                     title = audioContent.member!!.nickname, | ||||
|                     message = "콘텐츠를 업로드 하였습니다. - ${audioContent.title}", | ||||
|                     isAuth = audioContent.isAdult, | ||||
|                     contentId = contentId, | ||||
|                     creatorId = audioContent.member!!.id, | ||||
|                     container = "aos" | ||||
|                 ) | ||||
|             ) | ||||
|         ) | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     fun getDetail(id: Long, member: Member, timezone: String): GetAudioContentDetailResponse { | ||||
|   | ||||
| @@ -5,6 +5,8 @@ data class CreateAudioContentRequest( | ||||
|     val detail: String, | ||||
|     val tags: String, | ||||
|     val price: Int, | ||||
|     val timezone: String, | ||||
|     val releaseDate: String? = null, | ||||
|     val themeId: Long = 0, | ||||
|     val isAdult: Boolean = false, | ||||
|     val isGeneratePreview: Boolean = true, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user