diff --git a/src/Server/.idea/.idea.REST API/.idea/dataSources.local.xml b/src/Server/.idea/.idea.REST API/.idea/dataSources.local.xml index 1cbe770..94e5a50 100755 --- a/src/Server/.idea/.idea.REST API/.idea/dataSources.local.xml +++ b/src/Server/.idea/.idea.REST API/.idea/dataSources.local.xml @@ -1,6 +1,6 @@ - + " diff --git a/src/Server/.idea/.idea.REST API/.idea/dataSources/469f6bec-f113-4467-9d39-7ac38558045a.xml b/src/Server/.idea/.idea.REST API/.idea/dataSources/469f6bec-f113-4467-9d39-7ac38558045a.xml deleted file mode 100644 index 60d559b..0000000 --- a/src/Server/.idea/.idea.REST API/.idea/dataSources/469f6bec-f113-4467-9d39-7ac38558045a.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - 3.0.8 - - - 1 - 1 - - - 1 - durable_writes:true -replication:{'class': 'org.apache.cassandra.locator.NetworkTopologyStrategy', 'datacenter1': '1'} - - - - durable_writes:true -replication:{'class': 'org.apache.cassandra.locator.LocalStrategy'} - - - - durable_writes:true -replication:{'class': 'org.apache.cassandra.locator.SimpleStrategy', 'replication_factor': '1'} - - - - durable_writes:true -replication:{'class': 'org.apache.cassandra.locator.SimpleStrategy', 'replication_factor': '3'} - - - - durable_writes:true -replication:{'class': 'org.apache.cassandra.locator.EverywhereStrategy'} - - - - durable_writes:true -replication:{'class': 'org.apache.cassandra.locator.LocalStrategy'} - - - - durable_writes:true -replication:{'class': 'org.apache.cassandra.locator.SimpleStrategy', 'replication_factor': '2'} - - - - \ No newline at end of file diff --git a/src/Server/.idea/.idea.REST API/.idea/workspace.xml b/src/Server/.idea/.idea.REST API/.idea/workspace.xml index d66bcc8..bb348da 100755 --- a/src/Server/.idea/.idea.REST API/.idea/workspace.xml +++ b/src/Server/.idea/.idea.REST API/.idea/workspace.xml @@ -58,13 +58,13 @@ "cassandra" ], "rider.external.source.directories": [ - "C:\\Users\\wesse\\AppData\\Roaming\\JetBrains\\Rider2024.1\\resharper-host\\DecompilerCache", - "C:\\Users\\wesse\\AppData\\Roaming\\JetBrains\\Rider2024.1\\resharper-host\\SourcesCache", - "C:\\Users\\wesse\\AppData\\Local\\Symbols\\src" + "C:\\Users\\Wessel\\AppData\\Roaming\\JetBrains\\Rider2023.3\\resharper-host\\DecompilerCache", + "C:\\Users\\Wessel\\AppData\\Roaming\\JetBrains\\Rider2023.3\\resharper-host\\SourcesCache", + "C:\\Users\\Wessel\\AppData\\Local\\Symbols\\src" ] } }]]> - + diff --git a/src/Server/REST API.sln b/src/Server/REST API.sln index 081c13b..b038bfe 100755 --- a/src/Server/REST API.sln +++ b/src/Server/REST API.sln @@ -11,6 +11,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibParse", "LibParse\LibPar EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{56E0FEEA-8155-4979-8E90-EF2F3DA4B9E4}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CoveragePathPlanner", "..\CoveragePathPlanner\CoveragePathPlanner.csproj", "{5AB45288-CD7F-45E6-AA61-10FBC92EAEAB}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -33,6 +35,10 @@ Global {56E0FEEA-8155-4979-8E90-EF2F3DA4B9E4}.Debug|Any CPU.Build.0 = Debug|Any CPU {56E0FEEA-8155-4979-8E90-EF2F3DA4B9E4}.Release|Any CPU.ActiveCfg = Release|Any CPU {56E0FEEA-8155-4979-8E90-EF2F3DA4B9E4}.Release|Any CPU.Build.0 = Release|Any CPU + {5AB45288-CD7F-45E6-AA61-10FBC92EAEAB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5AB45288-CD7F-45E6-AA61-10FBC92EAEAB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5AB45288-CD7F-45E6-AA61-10FBC92EAEAB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5AB45288-CD7F-45E6-AA61-10FBC92EAEAB}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Server/RobotControlServer/Program.cs b/src/Server/RobotControlServer/Program.cs index dded61d..e9dec91 100644 --- a/src/Server/RobotControlServer/Program.cs +++ b/src/Server/RobotControlServer/Program.cs @@ -14,6 +14,7 @@ internal static class Program { { "database", new RouteDatabase(cassandraSession) }, { "database/metadata", new RouteMetadata(cassandraSession) }, { "database/path", new RoutePath(cassandraSession) }, + { "database/path/plan", new RoutePlan() }, { "roomba/control", new RouteControl() } }; diff --git a/src/Server/RobotControlServer/Routes/RoutePlan.cs b/src/Server/RobotControlServer/Routes/RoutePlan.cs new file mode 100644 index 0000000..a631238 --- /dev/null +++ b/src/Server/RobotControlServer/Routes/RoutePlan.cs @@ -0,0 +1,34 @@ +using Cassandra; +using LibParse.Json; +using LibServer.Http; +using LibServer.Router; +using RobotControlServer.JsonClasses; + +namespace RobotControlServer.Routes; + +public class RoutePlan: IRoute { + /// + /// POST request for the database/path/plan route, generate a new path + /// from a certain map of objects. + /// + public HttpResponse Post(HttpRequest request) { + try { + // Parse request body to Data object, give error if non-nullable fields + // are null. + var parsedBody = request.Body?.FromJson(); + if (parsedBody?.objects == null) { + throw new Exception("objectData is null"); + } + + // ParsedBody?.objects = [[0,1],[0,2],...] + // Implement path planning algorithm + // var path; + + // Return success message with the path + return new HttpResponse($"{{\"message\":\"success\",\"path\":\"{path}\"}}"); + } catch (Exception ex) { + // Return error message if failed for any reason + return new HttpResponse($"{{\"message\": \"{ex.Message.Replace("\"", "\\\"")}\"}}", 400); + } + } +} diff --git a/src/Server/Tests/bin/Debug/net8.0/CoverletSourceRootsMapping_Tests b/src/Server/Tests/bin/Debug/net8.0/CoverletSourceRootsMapping_Tests index 84e94b0..5f1a55e 100755 Binary files a/src/Server/Tests/bin/Debug/net8.0/CoverletSourceRootsMapping_Tests and b/src/Server/Tests/bin/Debug/net8.0/CoverletSourceRootsMapping_Tests differ