< Summary - Syki

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

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")]
 5public 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    {
 18        var notifications = await service.Get(User.InstitutionId, User.Id);
 19        return Ok(notifications);
 20    }
 21}
 22
 23internal class ResponseExamples : IMultipleExamplesProvider<List<UserNotificationOut>>
 24{
 25    public IEnumerable<SwaggerExample<List<UserNotificationOut>>> GetExamples()
 26    {
 027        yield return SwaggerExample.Create(
 028      "Nofitications",
 029      new List<UserNotificationOut>()
 030      {
 031        new()
 032        {
 033          NotificationId = Guid.CreateVersion7(),
 034          Title = "Boas-vindas!",
 035          Description = "Agradecemos a confiança na nossa instituição, que seja uma jornada cheia de aprendizado!",
 036          CreatedAt = DateTime.UtcNow.AddDays(-50),
 037          ViewedAt = DateTime.UtcNow.AddDays(-48),
 038        },
 039        new()
 040        {
 041          NotificationId = Guid.CreateVersion7(),
 042          Title = "Semana de prova chegando!",
 043          Description = "Preparado(a) pras avaliações? Elas começam semana que vem, revise os assuntos e boas provas!",
 044          CreatedAt = DateTime.UtcNow,
 045          ViewedAt = null,
 046        }
 047      }
 048    );
 049    }
 50}

Methods/Properties

GetExamples()