package adt.mainnode.service; import adt.mainnode.dto.NotificationDto; import adt.mainnode.entity.Credentials; import adt.mainnode.entity.Node; import adt.mainnode.entity.Notification; import adt.mainnode.repository.NodeRepository; import adt.mainnode.repository.NotificationRepository; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service @Slf4j public class NotificationService { private final NodeRepository nodeRepository; private final NotificationRepository notificationRepository; @Autowired public NotificationService(NodeRepository nodeRepository, NotificationRepository notificationRepository){ this.nodeRepository = nodeRepository; this.notificationRepository = notificationRepository; } public void saveNotification(Notification notification, Credentials credential){ Node node = nodeRepository.findByNodeId(credential.getName()); NotificationDto notificationDto = NotificationDto.createNotification(notification, node.getNodeId()); //TODO Hacer en la web la visualizacion de la notificacion notificationRepository.save(notificationDto); } }