Skip to content

Commit

Permalink
Remove option to update installation code from Robot endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
MuhammadUsama-afk-equinor authored and UsamaEquinorAFK committed Feb 15, 2024
1 parent e3677b8 commit 9a55447
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 18 deletions.
13 changes: 1 addition & 12 deletions backend/api/Controllers/RobotController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ public class RobotController(
IIsarService isarService,
IMissionSchedulingService missionSchedulingService,
IRobotModelService robotModelService,
IAreaService areaService,
IInstallationService installationService
IAreaService areaService
) : ControllerBase
{
/// <summary>
Expand Down Expand Up @@ -217,16 +216,6 @@ [FromBody] UpdateRobotQuery query
Robot updatedRobot;
switch (fieldName)
{
case "installationId":
if (query.InstallationId == null)
updatedRobot = await robotService.UpdateCurrentInstallation(id, null);
else
{
var installation = await installationService.ReadById(query.InstallationId);
if (installation == null) return NotFound($"No installation with ID {query.InstallationId} was found");
updatedRobot = await robotService.UpdateCurrentInstallation(id, installation);
}
break;
case "areaId":
if (query.AreaId == null)
updatedRobot = await robotService.UpdateCurrentArea(id, null);
Expand Down
6 changes: 0 additions & 6 deletions backend/api/Services/RobotService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public interface IRobotService
public Task<Robot> UpdateCurrentMissionId(string robotId, string? missionId);
public Task<Robot> UpdateCurrentArea(string robotId, Area? area);
public Task<Robot> UpdateMissionQueueFrozen(string robotId, bool missionQueueFrozen);
public Task<Robot> UpdateCurrentInstallation(string robotId, Installation? installation);
public Task<Robot?> Delete(string id);
public Task SetRobotOffline(string robotId);
}
Expand Down Expand Up @@ -219,11 +218,6 @@ public async Task<Robot> UpdateCurrentMissionId(string robotId, string? currentM

public async Task<Robot> UpdateCurrentArea(string robotId, Area? area) { return await UpdateRobotProperty(robotId, "CurrentArea", area); }

public async Task<Robot> UpdateCurrentInstallation(string robotId, Installation? installation)
{
return await UpdateRobotProperty(robotId, "CurrentInstallation", installation);
}

public async Task<Robot> UpdateMissionQueueFrozen(string robotId, bool missionQueueFrozen)
{
var robotQuery = context.Robots.Where(robot => robot.Id == robotId).Include(robot => robot.CurrentInstallation);
Expand Down

0 comments on commit 9a55447

Please sign in to comment.