feat: Update UML diagram

This commit is contained in:
2024-06-15 15:00:06 +02:00
parent 31b17a4762
commit 06cc843077
21 changed files with 85 additions and 57 deletions

View File

@@ -330,6 +330,20 @@ version: 3.1.0
robot nogmaals herschrijven maar nu met de nieuwe libraries. Ook zullen alle
benodigde routes geimplementeert worden om de Server set af te maken.
* [XVII 06-06-2024] UML diagrammen bijgewerkt
Nu de broncode van de Server en WebUI compleet zijn heb ik de UML diagrammen
bijgewerkt om overeen te komen met de broncode.
* [XVII 11-06-2024] Route planning toegevoegd
Nu er met Tom afgepsroken is om de routes net zoals de objecten op te slaan,
heb ik een endpoint gemaakt die het zelfde werkt als de mapping, maar dan voor
de routes. Ook heb ik een endpoint gemaakt die de route op de kaart tekent
voor de webUI.
** Map identificatie
In eerste instantie gebruikte ik steeds de `Id` van een map om hem te
identificeren. In de praktijk is dit helemaal niet handig, dus daarom ben ik
overgestapt op het gebruik van gebruiker invulbare namen. Dit maakt het veel
makkelijker om een bepaalde map te laten zien.
* [XVII 15-06-2024] UML diagrammen bijgewerkt
Nu de broncode van de Server compleet zijn heb ik de UML diagrammen
bijgewerkt om overeen te komen met de broncode. Ook heb ik de desbetreffende
modules bij elkaar gegroepeerd en de correcte lijntjes getrokken.

Binary file not shown.

View File

@@ -1,10 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="dataSourceStorageLocal" created-in="RD-241.15989.179">
<component name="dataSourceStorageLocal" created-in="RD-241.14494.307">
<data-source name="roommapper@localhost" uuid="469f6bec-f113-4467-9d39-7ac38558045a">
<database-info product="Cassandra" version="3.0.8" jdbc-version="4.2" driver-name="Cassandra JDBC Driver" driver-version="1.4" dbms="CASSANDRA" exact-version="3.0.8" exact-driver-version="1.4">
<identifier-quote-string>&quot;</identifier-quote-string>
<jdbc-catalog-is-schema>true</jdbc-catalog-is-schema>
</database-info>
<case-sensitivity plain-identifiers="lower" quoted-identifiers="exact" />
<secret-storage>master_key</secret-storage>

View File

@@ -8,15 +8,26 @@
</component>
<component name="ChangeListManager">
<list default="true" id="79f184c3-e88e-45be-9116-5fa813562754" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/.idea/.idea.REST API/.idea/dataSources.local.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.REST API/.idea/dataSources.local.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/.idea.REST API/.idea/dataSources/469f6bec-f113-4467-9d39-7ac38558045a.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.REST API/.idea/dataSources/469f6bec-f113-4467-9d39-7ac38558045a.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/.idea.REST API/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.REST API/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Console/JsonClasses/Database.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Console/JsonClasses/Database.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Console/Program.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Console/Program.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Console/Routes/RouteDatabase.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Console/Routes/RouteDatabase.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Console/Routes/RoutePath.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Console/Routes/RoutePath.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Console/Routes/RouteControl.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Console/Routes/RouteControl.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Console/bin/Debug/net8.0/Console.dll" beforeDir="false" afterPath="$PROJECT_DIR$/Console/bin/Debug/net8.0/Console.dll" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Console/bin/Debug/net8.0/Console.exe" beforeDir="false" afterPath="$PROJECT_DIR$/Console/bin/Debug/net8.0/Console.exe" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Console/bin/Debug/net8.0/Console.pdb" beforeDir="false" afterPath="$PROJECT_DIR$/Console/bin/Debug/net8.0/Console.pdb" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../Web/src/components/mapCanvas.jsx" beforeDir="false" afterPath="$PROJECT_DIR$/../Web/src/components/mapCanvas.jsx" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Console/bin/Debug/net8.0/LibParse.dll" beforeDir="false" afterPath="$PROJECT_DIR$/Console/bin/Debug/net8.0/LibParse.dll" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Console/bin/Debug/net8.0/LibParse.pdb" beforeDir="false" afterPath="$PROJECT_DIR$/Console/bin/Debug/net8.0/LibParse.pdb" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Console/bin/Debug/net8.0/LibServer.dll" beforeDir="false" afterPath="$PROJECT_DIR$/Console/bin/Debug/net8.0/LibServer.dll" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Console/bin/Debug/net8.0/LibServer.pdb" beforeDir="false" afterPath="$PROJECT_DIR$/Console/bin/Debug/net8.0/LibServer.pdb" afterDir="false" />
<change beforePath="$PROJECT_DIR$/LibParse/bin/Debug/net8.0/LibParse.dll" beforeDir="false" afterPath="$PROJECT_DIR$/LibParse/bin/Debug/net8.0/LibParse.dll" afterDir="false" />
<change beforePath="$PROJECT_DIR$/LibParse/bin/Debug/net8.0/LibParse.pdb" beforeDir="false" afterPath="$PROJECT_DIR$/LibParse/bin/Debug/net8.0/LibParse.pdb" afterDir="false" />
<change beforePath="$PROJECT_DIR$/LibServer/Http/Request.cs" beforeDir="false" afterPath="$PROJECT_DIR$/LibServer/Http/Request.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/LibServer/Router/Route.cs" beforeDir="false" afterPath="$PROJECT_DIR$/LibServer/Router/Route.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/LibServer/bin/Debug/net8.0/LibServer.dll" beforeDir="false" afterPath="$PROJECT_DIR$/LibServer/bin/Debug/net8.0/LibServer.dll" afterDir="false" />
<change beforePath="$PROJECT_DIR$/LibServer/bin/Debug/net8.0/LibServer.pdb" beforeDir="false" afterPath="$PROJECT_DIR$/LibServer/bin/Debug/net8.0/LibServer.pdb" afterDir="false" />
<change beforePath="$PROJECT_DIR$/REST API.sln.DotSettings.user" beforeDir="false" afterPath="$PROJECT_DIR$/REST API.sln.DotSettings.user" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Tests/bin/Debug/net8.0/CoverletSourceRootsMapping_Tests" beforeDir="false" afterPath="$PROJECT_DIR$/Tests/bin/Debug/net8.0/CoverletSourceRootsMapping_Tests" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -30,6 +41,8 @@
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/../.." />
</component>
<component name="HighlightingSettingsPerFile">
<setting file="file://$USER_HOME$/AppData/Local/Symbols/src/dotnet/runtime/3b8b000a0e115700b18265d8ec8c6307056dc94d/src/coreclr/System.Private.CoreLib/src/System/Object.CoreCLR.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$USER_HOME$/AppData/Local/Symbols/src/dotnet/runtime/3b8b000a0e115700b18265d8ec8c6307056dc94d/src/libraries/System.Private.CoreLib/src/System/Object.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/Console/Program.cs" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/LibCassandra/Class1.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/LibServer/LibServer.cs" root0="FORCE_HIGHLIGHTING" />
@@ -44,35 +57,35 @@
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">{
&quot;keyToString&quot;: {
&quot;.NET Project.Console.executor&quot;: &quot;Run&quot;,
&quot;ASKED_ADD_EXTERNAL_FILES&quot;: &quot;true&quot;,
&quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;d452b4e4-aa15-4fa9-847f-33d4d7fab23d.executor&quot;: &quot;Run&quot;,
&quot;git-widget-placeholder&quot;: &quot;master&quot;,
&quot;ignore.virus.scanning.warn.message&quot;: &quot;true&quot;,
&quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
&quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
&quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
&quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
&quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
&quot;settings.editor.selected.configurable&quot;: &quot;HotReloadSettingsPage&quot;,
&quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
".NET Project.Console.executor": "Run",
"ASKED_ADD_EXTERNAL_FILES": "true",
"RunOnceActivity.OpenProjectViewOnStart": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"d452b4e4-aa15-4fa9-847f-33d4d7fab23d.executor": "Run",
"git-widget-placeholder": "master",
"ignore.virus.scanning.warn.message": "true",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
"node.js.selected.package.tslint": "(autodetect)",
"nodejs_package_manager_path": "npm",
"settings.editor.selected.configurable": "HotReloadSettingsPage",
"vue.rearranger.settings.migration": "true"
},
&quot;keyToStringList&quot;: {
&quot;DatabaseDriversLRU&quot;: [
&quot;cassandra&quot;
"keyToStringList": {
"DatabaseDriversLRU": [
"cassandra"
],
&quot;rider.external.source.directories&quot;: [
&quot;/home/wessel/.config/JetBrains/Rider2024.1/resharper-host/DecompilerCache&quot;,
&quot;/home/wessel/.config/JetBrains/Rider2024.1/resharper-host/SourcesCache&quot;,
&quot;/home/wessel/.local/share/Symbols/src&quot;
"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"
]
}
}</component>
<component name="RunManager">
}]]></component>
<component name="RunManager" selected=".NET Project.Console">
<configuration name="Console" type="DotNetProject" factoryName=".NET Project">
<option name="EXE_PATH" value="$PROJECT_DIR$/Console/bin/Debug/net8.0/Console.exe" />
<option name="PROGRAM_PARAMETERS" value="" />
@@ -124,6 +137,7 @@
<workItem from="1717670832494" duration="901000" />
<workItem from="1717673464254" duration="1428000" />
<workItem from="1718093417281" duration="4387000" />
<workItem from="1718443610193" duration="8065000" />
</task>
<servers />
</component>

View File

@@ -7,13 +7,7 @@ using Cassandra;
internal static class Program {
public static void Main() {
var cluster = Cluster.Builder()
.AddContactPoints("127.0.0.1")
.WithPort(9042)
.Build();
var cassandraSession = cluster.Connect();
InitializeDatabase(cassandraSession);
var cassandraSession = InitializeDatabase();
Dictionary<string, IRoute> routes = new() {
{ "", new Root() },
@@ -34,7 +28,13 @@ internal static class Program {
}
}
private static void InitializeDatabase(ISession session) {
private static ISession InitializeDatabase() {
var cluster = Cluster.Builder()
.AddContactPoints("127.0.0.1")
.WithPort(9042)
.Build();
var session = cluster.Connect();
session.Execute(@"CREATE KEYSPACE IF NOT EXISTS roommapper
WITH REPLICATION = { 'class' : 'NetworkTopologyStrategy', 'datacenter1' : 1 };");
session.Execute(@"
@@ -53,5 +53,7 @@ internal static class Program {
Path text,
PRIMARY KEY (Id)
)");
return session;
}
}

View File

@@ -56,14 +56,14 @@ public class RouteControl: IRoute {
}
// @todo(wessel): Rewrite, move to other class
public void SendHttpRequest(string Host, string body, string method, string route) {
private void SendHttpRequest(string target, string body, string method, string route) {
using (TcpClient client = new TcpClient()) {
string[] host = Host.Split(":");
string[] host = target.Split(":");
client.Connect(host[0], int.Parse(host[1].Split("/")[0]));
using (NetworkStream stream = client.GetStream()) {
string httpRequestMessage = $"{method} {route} HTTP/1.1\r\n" +
$"Host: {Host}\r\n" +
$"Host: {target}\r\n" +
$"Content-Length: {body.Length}\r\n" +
"\r\n" +
$"{body}";

View File

@@ -4,17 +4,16 @@ public class HttpRequest {
private const string LogPrefix = "\u001b[47m[ WWW ]\u001b[0m";
public string? Route;
public string? _httpVersion, _host, _body, _header;
public Method? _method;
public Dictionary<string, string> QueryString = new();
private string? _httpVersion, _host, _header;
public readonly Dictionary<string, string> QueryString = new();
public Method? Method => _method;
public string? Body => _body;
public Method? Method { get; private set; }
public string? Body { get; private set; }
public int Parse(string raw) {
// _body starts after 2 new lines, cast to `_body`
var body = raw.Split("\r\n\r\n");
_body = body.Length > 1 ? string.Join("\r\n\r\n", body.Skip(1).ToArray()) : "";
Body = body.Length > 1 ? string.Join("\r\n\r\n", body.Skip(1).ToArray()) : "";
// Split the raw request into parts (one line per part)
var parts = raw.Split("\r\n");
@@ -27,7 +26,7 @@ public class HttpRequest {
if (i == 0) {
if (!parts[0].Contains("HTTP")) return -1;
var first = parts[0].Split(" ");
_method = MethodClass.StringToMethod(first[0].ToUpper());
Method = MethodClass.StringToMethod(first[0].ToUpper());
Route = first[1];
_httpVersion = first[2].Split("/")[1];
} else {
@@ -67,8 +66,8 @@ public class HttpRequest {
Console.WriteLine("{0} _httpVersion:\t{1}", LogPrefix, _httpVersion);
Console.WriteLine("{0} _host:\t\t{1}", LogPrefix, _host);
Console.WriteLine("{0} Route:\t\t{1}", LogPrefix, Route);
Console.WriteLine("{0} _method:\t\t{1}", LogPrefix, _method);
Console.WriteLine("{0} _method:\t\t{1}", LogPrefix, Method);
Console.WriteLine("{0} _headers:\n{1}", LogPrefix, _header);
Console.WriteLine("{0} _body:\n{1}", LogPrefix, _body);
Console.WriteLine("{0} _body:\n{1}", LogPrefix, Body);
}
}

View File

@@ -1,6 +1,6 @@
namespace LibServer.Router;
using LibServer.Http;
using Http;
public interface IRoute {
public HttpResponse Get(HttpRequest _) { return MethodNotAllowed(); }

View File

@@ -1,5 +1,5 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/PencilsConfiguration/ActualSeverity/@EntryValue">INFO</s:String>
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=d452b4e4_002Daa15_002D4fa9_002D847f_002D33d4d7fab23d/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="ParseJsonToAnonymousObject" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;
&lt;Project Location="C:\Users\wesse\OneDrive - Hogeschool Inholland\roommapper\src\Server\Tests" Presentation="&amp;lt;Tests&amp;gt;" /&gt;
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=d452b4e4_002Daa15_002D4fa9_002D847f_002D33d4d7fab23d/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="ParseJsonToAnonymousObject" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD;
&lt;Project Location="C:\Users\wesse\OneDrive - Hogeschool Inholland\roommapper\src\Server\Tests" Presentation="&amp;lt;Tests&amp;gt;" /&gt;&#xD;
&lt;/SessionState&gt;</s:String></wpf:ResourceDictionary>