< Summary

Information
Class: WebApi.Controllers.GetEnvironmentDataController
Assembly: IndeklimaWebApi
File(s): /home/runner/work/SEP4/SEP4/backend/microservices/indeklima/WebApi/Controllers/Frontend_Endpoints/GetEnviromentDataController.cs
Line coverage
100%
Covered lines: 13
Uncovered lines: 0
Coverable lines: 13
Total lines: 40
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%
GetSensorData()100%11100%
GetSensorData()100%11100%
GetSensorData()100%11100%

File(s)

/home/runner/work/SEP4/SEP4/backend/microservices/indeklima/WebApi/Controllers/Frontend_Endpoints/GetEnviromentDataController.cs

#LineLine coverage
 1using Microsoft.AspNetCore.Authorization;
 2using Microsoft.AspNetCore.Mvc;
 3using WebApi.Models;
 4using WebApi.Services;
 5
 6namespace WebApi.Controllers;
 7
 8[ApiController]
 9[Route("[controller]")]
 10public class GetEnvironmentDataController : ControllerBase
 11{
 12    private ISensorDataService _sensorDataService;
 13
 614    public GetEnvironmentDataController(ISensorDataService sensorDataService)
 615    {
 616        _sensorDataService = sensorDataService;
 617    }
 18
 19
 20    [HttpGet("{hallId}")]
 21    [Authorize(Policy = "MustBeAdmin")]
 22    public async Task<List<SensorData>> GetSensorData(int hallId)
 223    {
 224        return await _sensorDataService.GetSensorData(hallId);
 225    }
 26
 27    [HttpGet("{hallId}/{limit}")]
 28    [Authorize(Policy = "MustBeAdmin")]
 29    public async Task<List<SensorData>> GetSensorData(int hallId, int limit)
 330    {
 331        return await _sensorDataService.GetSensorData(hallId,limit);
 332    }
 33
 34    [HttpGet("{hallId}/range")]
 35    [Authorize(Policy = "MustBeAdmin")]
 36    public async Task<List<SensorData>> GetSensorData(int hallId, DateTime startDate, DateTime endDate)
 137    {
 138        return await _sensorDataService.GetSensorData(hallId, startDate, endDate);
 139    }
 40}