From aed62bf78ab32a58333511523460f4212c8ddd54 Mon Sep 17 00:00:00 2001 From: Eddasol Date: Tue, 2 Apr 2024 10:18:47 +0200 Subject: [PATCH] Remove unnecessary parameters from CreateRobotQuery --- backend/api.test/Client/MissionTests.cs | 8 -------- backend/api.test/Client/RobotTests.cs | 2 -- backend/api.test/Database/DatabaseUtilities.cs | 2 -- backend/api.test/Services/RobotService.cs | 2 -- backend/api/Controllers/Models/CreateRobotQuery.cs | 4 ---- backend/api/Database/Context/InitDb.cs | 6 ------ backend/api/Database/Models/Robot.cs | 5 +++-- backend/api/EventHandlers/MqttEventHandler.cs | 2 -- 8 files changed, 3 insertions(+), 28 deletions(-) diff --git a/backend/api.test/Client/MissionTests.cs b/backend/api.test/Client/MissionTests.cs index 0b9da6862..6daa592d2 100644 --- a/backend/api.test/Client/MissionTests.cs +++ b/backend/api.test/Client/MissionTests.cs @@ -423,8 +423,6 @@ public async Task ScheduleDuplicateCustomMissionDefinitions() SerialNumber = "GetNextRun", RobotType = RobotType.Robot, Status = RobotStatus.Available, - IsarConnected = true, - Deprecated = false, Host = "localhost", Port = 3000, CurrentInstallationCode = installationCode, @@ -507,8 +505,6 @@ public async Task GetNextRun() SerialNumber = "GetNextRun", RobotType = RobotType.Robot, Status = RobotStatus.Available, - IsarConnected = true, - Deprecated = false, Host = "localhost", Port = 3000, CurrentInstallationCode = installation.InstallationCode, @@ -691,8 +687,6 @@ public async Task MissionDoesNotStartIfRobotIsNotInSameInstallationAsMission() SerialNumber = "GetNextRun", RobotType = RobotType.Robot, Status = RobotStatus.Available, - IsarConnected = true, - Deprecated = false, Host = "localhost", Port = 3000, CurrentInstallationCode = otherInstallation.InstallationCode, @@ -760,8 +754,6 @@ public async Task MissionFailsIfRobotIsNotInSameDeckAsMission() SerialNumber = "GetMissionFailsIfRobotIsNotInSameDeckAsMission", RobotType = RobotType.Robot, Status = RobotStatus.Available, - IsarConnected = true, - Deprecated = false, Host = "localhost", Port = 3000, CurrentInstallationCode = installation.InstallationCode, diff --git a/backend/api.test/Client/RobotTests.cs b/backend/api.test/Client/RobotTests.cs index e265cbc97..31cfda0cc 100644 --- a/backend/api.test/Client/RobotTests.cs +++ b/backend/api.test/Client/RobotTests.cs @@ -116,8 +116,6 @@ public async Task RobotIsNotCreatedWithAreaNotInInstallation() SerialNumber = "GetNextRun", RobotType = RobotType.Robot, Status = RobotStatus.Available, - IsarConnected = true, - Deprecated = false, Host = "localhost", Port = 3000, CurrentInstallationCode = wrongInstallation.InstallationCode, diff --git a/backend/api.test/Database/DatabaseUtilities.cs b/backend/api.test/Database/DatabaseUtilities.cs index b36fb0f16..c2d32ec18 100644 --- a/backend/api.test/Database/DatabaseUtilities.cs +++ b/backend/api.test/Database/DatabaseUtilities.cs @@ -136,8 +136,6 @@ public async Task NewRobot(RobotStatus status, Installation installation, VideoStreams = new List(), Host = "localhost", Port = 3000, - IsarConnected = true, - Deprecated = false, Status = status }; diff --git a/backend/api.test/Services/RobotService.cs b/backend/api.test/Services/RobotService.cs index 4dfb0178f..9570a8e84 100644 --- a/backend/api.test/Services/RobotService.cs +++ b/backend/api.test/Services/RobotService.cs @@ -109,8 +109,6 @@ public async Task Create() RobotType = RobotType.Robot, Host = "", Port = 1, - IsarConnected = true, - Deprecated = false, Status = RobotStatus.Available }; diff --git a/backend/api/Controllers/Models/CreateRobotQuery.cs b/backend/api/Controllers/Models/CreateRobotQuery.cs index e6b56745a..b9cd4b34d 100644 --- a/backend/api/Controllers/Models/CreateRobotQuery.cs +++ b/backend/api/Controllers/Models/CreateRobotQuery.cs @@ -22,10 +22,6 @@ public struct CreateRobotQuery public int Port { get; set; } - public bool IsarConnected { get; set; } - - public bool Deprecated { get; set; } - public RobotStatus Status { get; set; } } } diff --git a/backend/api/Database/Context/InitDb.cs b/backend/api/Database/Context/InitDb.cs index 3c4ad9836..97a0a9a99 100644 --- a/backend/api/Database/Context/InitDb.cs +++ b/backend/api/Database/Context/InitDb.cs @@ -283,8 +283,6 @@ private static List GetRobots() Name = "R2-D2", SerialNumber = "D2", Status = RobotStatus.Available, - IsarConnected = true, - Deprecated = false, Host = "localhost", Port = 3000, CurrentInstallation = installations[0], @@ -299,8 +297,6 @@ private static List GetRobots() IsarId = "c68b679d-308b-460f-9fe0-87eaadbd1234", SerialNumber = "SS79", Status = RobotStatus.Busy, - IsarConnected = true, - Deprecated = false, Host = "localhost", Port = 3000, CurrentInstallation = installations[0], @@ -314,8 +310,6 @@ private static List GetRobots() IsarId = "c68b679d-308b-460f-9fe0-87eaadbd5678", SerialNumber = "Earth616", Status = RobotStatus.Available, - IsarConnected = true, - Deprecated = false, Host = "localhost", Port = 3000, CurrentInstallation = installations[0], diff --git a/backend/api/Database/Models/Robot.cs b/backend/api/Database/Models/Robot.cs index 420fdb9a8..b51f2f099 100644 --- a/backend/api/Database/Models/Robot.cs +++ b/backend/api/Database/Models/Robot.cs @@ -13,6 +13,7 @@ public Robot() Name = "defaultId"; SerialNumber = "defaultSerialNumber"; Status = RobotStatus.Offline; + IsarConnected = true; Deprecated = false; Host = "localhost"; Port = 3000; @@ -41,8 +42,8 @@ public Robot(CreateRobotQuery createQuery, Installation installation, Area? area VideoStreams = videoStreams; Host = createQuery.Host; Port = createQuery.Port; - IsarConnected = createQuery.IsarConnected; - Deprecated = createQuery.Deprecated; + IsarConnected = true; + Deprecated = false; Status = createQuery.Status; Pose = new Pose(); } diff --git a/backend/api/EventHandlers/MqttEventHandler.cs b/backend/api/EventHandlers/MqttEventHandler.cs index 133c07ae7..c2da9a587 100644 --- a/backend/api/EventHandlers/MqttEventHandler.cs +++ b/backend/api/EventHandlers/MqttEventHandler.cs @@ -129,8 +129,6 @@ private async void OnIsarRobotInfo(object? sender, MqttReceivedArgs mqttArgs) Host = isarRobotInfo.Host, Port = isarRobotInfo.Port, Status = RobotStatus.Available, - IsarConnected = true, - Deprecated = false }; var newRobot = await robotService.CreateFromQuery(robotQuery);