Clean GetAllBeaconsForInstance accept return empty list

This commit is contained in:
Fransolet Thomas 2023-02-20 14:43:35 +01:00
parent 33f782346b
commit f5921180cf

View File

@ -238,16 +238,13 @@ namespace ManagerService.Controllers
[ProducesResponseType(typeof(List<SectionDTO>), 200)]
[ProducesResponseType(typeof(string), 404)]
[ProducesResponseType(typeof(string), 500)]
[HttpGet("beacons/{id}")]
[HttpGet("beacons/{instanceId}")]
public ObjectResult GetAllBeaconsForInstance(string instanceId)
{
try
{
List<Section> sections = _sectionService.GetAll(instanceId);
if (sections.Count == 0)
throw new KeyNotFoundException("No section has beacon");
sections = sections.Where(s => s.IsBeacon && s.BeaconId != null).ToList();
return new OkObjectResult(sections.Select(s => s.ToDTO()));