Files
gremiumhub/legalconsenthub-backend/src/main/kotlin/com/betriebsratkanzlei/legalconsenthub/notification/PagedNotificationMapper.kt

24 lines
857 B
Kotlin

package com.betriebsratkanzlei.legalconsenthub.notification
import com.betriebsratkanzlei.legalconsenthub_api.model.PagedNotificationDto
import org.springframework.data.domain.Page
import org.springframework.stereotype.Component
@Component
class PagedNotificationMapper(
private val notificationMapper: NotificationMapper,
) {
fun toPagedNotificationDto(page: Page<Notification>): PagedNotificationDto =
PagedNotificationDto(
content = page.content.map { notificationMapper.toNotificationDto(it) },
number = page.number,
propertySize = page.size,
numberOfElements = page.numberOfElements,
totalElements = page.totalElements,
totalPages = page.totalPages,
first = page.isFirst,
last = page.isLast,
empty = page.isEmpty,
)
}