Merge pull request #2 from Flight-Simulator-EFB/models
Added Base Models
This commit is contained in:
commit
35def9de5d
19
Models/Route/IWaypoint.cs
Normal file
19
Models/Route/IWaypoint.cs
Normal 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; }
|
||||
}
|
||||
}
|
21
Models/Route/NavaidModel.cs
Normal file
21
Models/Route/NavaidModel.cs
Normal 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;
|
||||
|
||||
}
|
||||
}
|
35
Models/Route/WaypointModel.cs
Normal file
35
Models/Route/WaypointModel.cs
Normal 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
22
Models/RouteModel.cs
Normal 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
26
Models/TokenModel.cs
Normal 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
39
Models/UserModel.cs
Normal 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;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user