From d615468fd43f432ee3bba8b9f231604c5a8ddace Mon Sep 17 00:00:00 2001 From: luke-else <52086083+luke-else@users.noreply.github.com> Date: Sun, 7 Nov 2021 20:19:24 +0000 Subject: [PATCH] Added Base Models for EBF Application --- Models/Route/IWaypoint.cs | 19 +++++++++++++++++ Models/Route/NavaidModel.cs | 21 +++++++++++++++++++ Models/Route/WaypointModel.cs | 35 +++++++++++++++++++++++++++++++ Models/RouteModel.cs | 22 ++++++++++++++++++++ Models/TokenModel.cs | 26 +++++++++++++++++++++++ Models/UserModel.cs | 39 +++++++++++++++++++++++++++++++++++ 6 files changed, 162 insertions(+) create mode 100644 Models/Route/IWaypoint.cs create mode 100644 Models/Route/NavaidModel.cs create mode 100644 Models/Route/WaypointModel.cs create mode 100644 Models/RouteModel.cs create mode 100644 Models/TokenModel.cs create mode 100644 Models/UserModel.cs diff --git a/Models/Route/IWaypoint.cs b/Models/Route/IWaypoint.cs new file mode 100644 index 0000000..793fa93 --- /dev/null +++ b/Models/Route/IWaypoint.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace EFB.Models.Route +{ + public interface IWaypoint + { + public string Name { get; set; } + public string Longitude { get; set; } + public string Latitude { get; set; } + + public string Airway { get; set; } + public IWaypoint Next { get; set; } + public IWaypoint Previous { get; set; } + public bool Visited { get; set; } + } +} \ No newline at end of file diff --git a/Models/Route/NavaidModel.cs b/Models/Route/NavaidModel.cs new file mode 100644 index 0000000..b353b9e --- /dev/null +++ b/Models/Route/NavaidModel.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace EFB.Models.Route +{ + public class NavaidModel:IWaypoint + { + public string Name { get; set; } + public string Longitude { get; set; } + public string Latitude { get; set; } + public int Frequency { get; set; } + + public string Airway { get; set; } + public IWaypoint Next { get; set; } = null; + public IWaypoint Previous { get; set; } = null; + public bool Visited { get; set; } = false; + + } +} \ No newline at end of file diff --git a/Models/Route/WaypointModel.cs b/Models/Route/WaypointModel.cs new file mode 100644 index 0000000..ab2e239 --- /dev/null +++ b/Models/Route/WaypointModel.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace EFB.Models.Route +{ + public class WaypointModel:IWaypoint + { + public string Name { get; set; } + public string Longitude { get; set; } + public string Latitude { get; set; } + + public string Airway { get; set; } + public IWaypoint Next { get; set; } = null; + public IWaypoint Previous { get; set; } = null; + public bool Visited { get; set; } + + + + + + + + + + + + + + + + + } +} \ No newline at end of file diff --git a/Models/RouteModel.cs b/Models/RouteModel.cs new file mode 100644 index 0000000..a0468b1 --- /dev/null +++ b/Models/RouteModel.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using EFB.Models.Route; + +namespace EFB.Models +{ + public class RouteModel + { + /* + Route Model - This model contains implementations for different points along the Route + + Route only becomes populated after route is recieved from autorouter API + */ + public WaypointModel Departure { get; init; } = null; + public WaypointModel Arrival { get; set; } = null; + public IWaypoint Current { get; set; } = null; + public uint Cruise { get; set; } = 0; + + } +} \ No newline at end of file diff --git a/Models/TokenModel.cs b/Models/TokenModel.cs new file mode 100644 index 0000000..64ddf38 --- /dev/null +++ b/Models/TokenModel.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace EFB.Models +{ + public class TokenModel + { + /* + Auto Router API Token Model + */ + public string Token { get; init; } + public DateTime Expiration { get; init; } + + public bool IsExpired(){ + //Check if the current time is beyond expiration + if (DateTime.UtcNow > Expiration) + { + return true; + } + return false; + } + + } +} \ No newline at end of file diff --git a/Models/UserModel.cs b/Models/UserModel.cs new file mode 100644 index 0000000..07b6785 --- /dev/null +++ b/Models/UserModel.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace EFB.Models +{ + public class UserModel + { + /* + User - Contains relevant user information as well as current session data such + + #API Token + #Route + #Last Recorded Sim Position + + This is the model that is implemented into MongoDB + */ + public object Id { get; init; } + public string EMail { get; init; } + public TokenModel Token { get; set; } = null; + + //Contains the most recent route generated by the user through the App + public object Route { get; set; } = null; + + //Contains the most recently stored position of the user in the simulator + public object SimPosition { get; set; } = null; + + + + + + + + + + + } +} \ No newline at end of file