< Summary - Syki

Information
Class: Syki.Back.Features.Teacher.CreateClassActivity.NotifyTeacherNewClassActivityEmailsSendedCommandHandler
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Features/Teacher/CreateClassActivity/NotifyTeacherNewClassActivityEmailsSendedCommand.cs
Tag: 4_16869239191
Line coverage
0%
Covered lines: 0
Uncovered lines: 12
Coverable lines: 12
Total lines: 25
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%210%
Handle()100%210%

File(s)

/home/runner/work/syki/syki/Back/Features/Teacher/CreateClassActivity/NotifyTeacherNewClassActivityEmailsSendedCommand.cs

#LineLine coverage
 1using Syki.Back.Features.Academic.CreateNotification;
 2
 3namespace Syki.Back.Features.Teacher.CreateClassActivity;
 4
 5[CommandDescription("Notificar professor (emails da nova atividade)")]
 6public record NotifyTeacherNewClassActivityEmailsSendedCommand(Guid InstitutionId, Guid TeacherId, Guid ClassActivityId)
 7
 08public class NotifyTeacherNewClassActivityEmailsSendedCommandHandler(SykiDbContext ctx) : ICommandHandler<NotifyTeacherN
 9{
 10    public async Task Handle(CommandId commandId, NotifyTeacherNewClassActivityEmailsSendedCommand command)
 11    {
 012        var activity = await ctx.ClassActivities
 013            .Where(x => x.Id == command.ClassActivityId).Select(x => new { x.Title }).FirstAsync();
 14
 015        var notification = new Notification(
 016            command.InstitutionId,
 017            "Nova atividade enviada",
 018            $"'{activity.Title}' enviada com sucesso!",
 019            UsersGroup.Teachers,
 020            false
 021        );
 22
 023        ctx.AddRange(notification, new UserNotification(command.TeacherId, notification.Id));
 024    }
 25}