Merge pull request #2 from Flight-Simulator-EFB/models

Added Base Models
This commit is contained in:
Luke Else 2021-11-07 20:20:37 +00:00 committed by GitHub
commit 35def9de5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 162 additions and 0 deletions

19
Models/Route/IWaypoint.cs Normal file
View File

@ -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; }
}
}

View File

@ -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;
}
}

View File

@ -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; }
}
}

22
Models/RouteModel.cs Normal file
View File

@ -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;
}
}

26
Models/TokenModel.cs Normal file
View File

@ -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;
}
}
}

39
Models/UserModel.cs Normal file
View File

@ -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;
}
}