From 820671b9140bd1e9e1deef58b1b5734dacb5cc4d Mon Sep 17 00:00:00 2001 From: Eddasol Date: Thu, 16 Jan 2025 13:48:20 +0100 Subject: [PATCH] Format to new csharper version --- backend/api.test/Mocks/MissionLoaderMock.cs | 21 +++++++++-------- backend/api/Database/Context/InitDb.cs | 17 +++++++------- backend/api/MQTT/MqttService.cs | 6 +++-- backend/api/MQTT/MqttTopics.cs | 25 ++++++++++----------- 4 files changed, 34 insertions(+), 35 deletions(-) diff --git a/backend/api.test/Mocks/MissionLoaderMock.cs b/backend/api.test/Mocks/MissionLoaderMock.cs index 2d1bf894..35fe738b 100644 --- a/backend/api.test/Mocks/MissionLoaderMock.cs +++ b/backend/api.test/Mocks/MissionLoaderMock.cs @@ -73,17 +73,16 @@ public class MockMissionLoader() : IMissionLoader ), ]; - private readonly MissionDefinition _mockMissionDefinition = - new() - { - InspectionArea = new InspectionArea(), - Comment = "", - Id = "", - InstallationCode = "TTT", - IsDeprecated = false, - Name = "test", - Source = new Source { Id = "", SourceId = "" }, - }; + private readonly MissionDefinition _mockMissionDefinition = new() + { + InspectionArea = new InspectionArea(), + Comment = "", + Id = "", + InstallationCode = "TTT", + IsDeprecated = false, + Name = "test", + Source = new Source { Id = "", SourceId = "" }, + }; public async Task GetMissionById(string sourceMissionId) { diff --git a/backend/api/Database/Context/InitDb.cs b/backend/api/Database/Context/InitDb.cs index d17a0e2e..d2ac0502 100644 --- a/backend/api/Database/Context/InitDb.cs +++ b/backend/api/Database/Context/InitDb.cs @@ -576,15 +576,14 @@ public static void AddRobotModelsToContext(FlotillaDbContext context) { foreach (var type in Enum.GetValues()) { - RobotModel model = - new() - { - Type = type, - BatteryWarningThreshold = null, - BatteryMissionStartThreshold = null, - LowerPressureWarningThreshold = null, - UpperPressureWarningThreshold = null, - }; + RobotModel model = new() + { + Type = type, + BatteryWarningThreshold = null, + BatteryMissionStartThreshold = null, + LowerPressureWarningThreshold = null, + UpperPressureWarningThreshold = null, + }; context.Add(model); } } diff --git a/backend/api/MQTT/MqttService.cs b/backend/api/MQTT/MqttService.cs index 5b3f2b7a..19da6961 100644 --- a/backend/api/MQTT/MqttService.cs +++ b/backend/api/MQTT/MqttService.cs @@ -28,8 +28,10 @@ public class MqttService : BackgroundService private readonly int _serverPort; private readonly bool _shouldFailOnMaxRetries; - private static readonly JsonSerializerOptions serializerOptions = - new() { Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) } }; + private static readonly JsonSerializerOptions serializerOptions = new() + { + Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) }, + }; private CancellationToken _cancellationToken; private int _reconnectAttempts; diff --git a/backend/api/MQTT/MqttTopics.cs b/backend/api/MQTT/MqttTopics.cs index 93f05290..c984f473 100644 --- a/backend/api/MQTT/MqttTopics.cs +++ b/backend/api/MQTT/MqttTopics.cs @@ -11,19 +11,18 @@ public static class MqttTopics /// /// A dictionary linking MQTT topics to their respective message models /// - public static readonly Dictionary TopicsToMessages = - new() - { - { "isar/+/status", typeof(IsarStatusMessage) }, - { "isar/+/robot_info", typeof(IsarRobotInfoMessage) }, - { "isar/+/robot_heartbeat", typeof(IsarRobotHeartbeatMessage) }, - { "isar/+/mission", typeof(IsarMissionMessage) }, - { "isar/+/task", typeof(IsarTaskMessage) }, - { "isar/+/battery", typeof(IsarBatteryMessage) }, - { "isar/+/pressure", typeof(IsarPressureMessage) }, - { "isar/+/pose", typeof(IsarPoseMessage) }, - { "isar/+/cloud_health", typeof(IsarCloudHealthMessage) }, - }; + public static readonly Dictionary TopicsToMessages = new() + { + { "isar/+/status", typeof(IsarStatusMessage) }, + { "isar/+/robot_info", typeof(IsarRobotInfoMessage) }, + { "isar/+/robot_heartbeat", typeof(IsarRobotHeartbeatMessage) }, + { "isar/+/mission", typeof(IsarMissionMessage) }, + { "isar/+/task", typeof(IsarTaskMessage) }, + { "isar/+/battery", typeof(IsarBatteryMessage) }, + { "isar/+/pressure", typeof(IsarPressureMessage) }, + { "isar/+/pose", typeof(IsarPoseMessage) }, + { "isar/+/cloud_health", typeof(IsarCloudHealthMessage) }, + }; /// /// Searches a dictionary for a specific topic name and returns the corresponding value from the wildcarded dictionary