public async Task SendUserNotification(CreateUserNotification notification)
        {
            UserNotification appNotification = new UserNotification()
            {
                Title                = notification.Title,
                Description          = notification.Description,
                UserId               = notification.UserId,
                ReportId             = notification.ReportId,
                InteractionHistoryId = notification.InteractionHistoryId,
                Read = false,
            };

            await SendAppUserNotification(appNotification);
        }
        private async Task SendNotifications(Report report, Guid interactionId)
        {
            InteractionHistory interaction = await _interactionRepository.GetById(interactionId);

            string description = "A denúncia {0} sofreu uma atualização de status.\n Data de alteração: {1}";

            CreateUserNotification notification = new CreateUserNotification()
            {
                Description          = string.Format(description, report.Title, interaction.CreationDate.ToShortDateString()),
                ReportId             = report.Id,
                Title                = $"Alteração de status na denúncia {report.Title}",
                InteractionHistoryId = interactionId,
                UserId               = report.UserId
            };

            await _notificationHandler.SendUserNotification(notification);
        }
Ejemplo n.º 3
0
        public async Task <bool> CoordinatorUpdate(Guid reportId, Guid coordinatorId)
        {
            var reportToUpdate = await _reportRepository.GetById(reportId);

            reportToUpdate.CoordinatorId = coordinatorId;
            await _reportRepository.Update(reportToUpdate);

            CreateUserNotification notification = new CreateUserNotification()
            {
                Description = "Uma nova denúncia foi atribuída para você.",
                ReportId    = reportId,
                Title       = "Nova denúncia moderada.",
                UserId      = coordinatorId
            };

            await _notificationHandler.SendUserNotification(notification);

            return(true);
        }