< Summary - Syki

Information
Class: Syki.Back.Features.Cross.GetUserNotifications.GetUserNotificationsController
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Features/Cross/GetUserNotifications/GetUserNotificationsController.cs
Tag: 4_16869239191
Line coverage
100%
Covered lines: 4
Uncovered lines: 0
Coverable lines: 4
Total lines: 50
Line coverage: 100%
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%11100%
Get()100%11100%

File(s)

/home/runner/work/syki/syki/Back/Features/Cross/GetUserNotifications/GetUserNotificationsController.cs

#LineLine coverage
 1namespace Syki.Back.Features.Cross.GetUserNotifications;
 2
 3[ApiController, AuthBearer]
 4[EnableRateLimiting("Medium")]
 265public class GetUserNotificationsController(GetUserNotificationsService service) : ControllerBase
 6{
 7    /// <summary>
 8    /// Notificações
 9    /// </summary>
 10    /// <remarks>
 11    /// Retorna as notificações do usuário.
 12    /// </remarks>
 13    [HttpGet("notifications/user")]
 14    [ProducesResponseType(typeof(List<UserNotificationOut>), 200)]
 15    [SwaggerResponseExample(200, typeof(ResponseExamples))]
 16    public async Task<IActionResult> Get()
 17    {
 2618        var notifications = await service.Get(User.InstitutionId, User.Id);
 2619        return Ok(notifications);
 2620    }
 21}
 22
 23internal class ResponseExamples : IMultipleExamplesProvider<List<UserNotificationOut>>
 24{
 25    public IEnumerable<SwaggerExample<List<UserNotificationOut>>> GetExamples()
 26    {
 27        yield return SwaggerExample.Create(
 28      "Nofitications",
 29      new List<UserNotificationOut>()
 30      {
 31        new()
 32        {
 33          NotificationId = Guid.CreateVersion7(),
 34          Title = "Boas-vindas!",
 35          Description = "Agradecemos a confiança na nossa instituição, que seja uma jornada cheia de aprendizado!",
 36          CreatedAt = DateTime.UtcNow.AddDays(-50),
 37          ViewedAt = DateTime.UtcNow.AddDays(-48),
 38        },
 39        new()
 40        {
 41          NotificationId = Guid.CreateVersion7(),
 42          Title = "Semana de prova chegando!",
 43          Description = "Preparado(a) pras avaliações? Elas começam semana que vem, revise os assuntos e boas provas!",
 44          CreatedAt = DateTime.UtcNow,
 45          ViewedAt = null,
 46        }
 47      }
 48    );
 49    }
 50}