콘텐츠 상단 고정 기능 추가 #120
@@ -566,7 +566,7 @@ class AudioContentService(
 | 
				
			|||||||
            false
 | 
					            false
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        val pinContentListCount = pinContentRepository.getPinContentList(memberId = member.id!!).size
 | 
					        val pinContentListCount = pinContentRepository.getPinContentList(memberId = member.id!!, active = true).size
 | 
				
			||||||
        val isAvailablePin = if (member.id!! == audioContent.member!!.id!!) {
 | 
					        val isAvailablePin = if (member.id!! == audioContent.member!!.id!!) {
 | 
				
			||||||
            pinContentListCount < 3
 | 
					            pinContentListCount < 3
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,16 +7,22 @@ import org.springframework.data.jpa.repository.JpaRepository
 | 
				
			|||||||
interface PinContentRepository : JpaRepository<PinContent, Long>, PinContentQueryRepository
 | 
					interface PinContentRepository : JpaRepository<PinContent, Long>, PinContentQueryRepository
 | 
				
			||||||
 | 
					
 | 
				
			||||||
interface PinContentQueryRepository {
 | 
					interface PinContentQueryRepository {
 | 
				
			||||||
    fun getPinContentList(memberId: Long): List<PinContent>
 | 
					    fun getPinContentList(memberId: Long, active: Boolean? = null): List<PinContent>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fun findByContentIdAndMemberId(contentId: Long, memberId: Long, active: Boolean? = null): PinContent?
 | 
					    fun findByContentIdAndMemberId(contentId: Long, memberId: Long, active: Boolean? = null): PinContent?
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class PinContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) : PinContentQueryRepository {
 | 
					class PinContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) : PinContentQueryRepository {
 | 
				
			||||||
    override fun getPinContentList(memberId: Long): List<PinContent> {
 | 
					    override fun getPinContentList(memberId: Long, active: Boolean?): List<PinContent> {
 | 
				
			||||||
 | 
					        var where = pinContent.member.id.eq(memberId)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (active != null) {
 | 
				
			||||||
 | 
					            where = where.and(pinContent.isActive.eq(active))
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return queryFactory
 | 
					        return queryFactory
 | 
				
			||||||
            .selectFrom(pinContent)
 | 
					            .selectFrom(pinContent)
 | 
				
			||||||
            .where(pinContent.member.id.eq(memberId))
 | 
					            .where(where)
 | 
				
			||||||
            .orderBy(pinContent.updatedAt.asc())
 | 
					            .orderBy(pinContent.updatedAt.asc())
 | 
				
			||||||
            .fetch()
 | 
					            .fetch()
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user