|
| 1 | +package com.backgu.amaker.api.notification.service |
| 2 | + |
| 3 | +import com.backgu.amaker.api.notification.dto.EventNotificationDto |
| 4 | +import com.backgu.amaker.application.event.service.EventAssignedUserService |
| 5 | +import com.backgu.amaker.application.event.service.ReactionCommentService |
| 6 | +import com.backgu.amaker.application.event.service.ReactionEventService |
| 7 | +import com.backgu.amaker.application.event.service.ReactionOptionService |
| 8 | +import com.backgu.amaker.application.event.service.ReplyCommentService |
| 9 | +import com.backgu.amaker.application.event.service.ReplyEventService |
| 10 | +import com.backgu.amaker.application.notification.service.NotificationQueryService |
| 11 | +import com.backgu.amaker.application.user.service.UserService |
| 12 | +import com.backgu.amaker.application.workspace.WorkspaceUserService |
| 13 | +import org.springframework.context.ApplicationEventPublisher |
| 14 | +import org.springframework.data.domain.Page |
| 15 | +import org.springframework.data.domain.Pageable |
| 16 | +import org.springframework.stereotype.Service |
| 17 | +import org.springframework.transaction.annotation.Transactional |
| 18 | + |
| 19 | +@Service |
| 20 | +@Transactional(readOnly = true) |
| 21 | +class NotificationFacadeService( |
| 22 | + private val userService: UserService, |
| 23 | + private val replyEventService: ReplyEventService, |
| 24 | + private val reactionEventService: ReactionEventService, |
| 25 | + private val eventAssignedUserService: EventAssignedUserService, |
| 26 | + private val replyCommentService: ReplyCommentService, |
| 27 | + private val reactionCommentService: ReactionCommentService, |
| 28 | + private val reactionOptionService: ReactionOptionService, |
| 29 | + private val workspaceUserService: WorkspaceUserService, |
| 30 | + private val notificationQueryService: NotificationQueryService, |
| 31 | + private val eventPublisher: ApplicationEventPublisher, |
| 32 | +) { |
| 33 | + fun getNotifications( |
| 34 | + userId: String, |
| 35 | + workspaceId: Long, |
| 36 | + pageable: Pageable, |
| 37 | + ): Page<EventNotificationDto> { |
| 38 | + workspaceUserService.validateUserInWorkspace(userId, workspaceId) |
| 39 | + |
| 40 | + return notificationQueryService.getNotification(userId, workspaceId, pageable).map { EventNotificationDto.from(it) } |
| 41 | + } |
| 42 | +} |
0 commit comments