-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #135 from pkuehnel/feat/useDbChargerPilot
feat(Model): Add TeslaMate DB Model
- Loading branch information
Showing
48 changed files
with
1,390 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
SmartTeslaAmpSetter.Model/Contracts/IDbConnectionStringHelper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace SmartTeslaAmpSetter.Model.Contracts; | ||
|
||
public interface IDbConnectionStringHelper | ||
{ | ||
string GetConnectionString(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using Microsoft.EntityFrameworkCore; | ||
using SmartTeslaAmpSetter.Model.Entities; | ||
|
||
namespace SmartTeslaAmpSetter.Model.Contracts; | ||
|
||
public interface ITeslamateContext | ||
{ | ||
DbSet<Address> Addresses { get; set; } | ||
DbSet<Car> Cars { get; set; } | ||
DbSet<CarSetting> CarSettings { get; set; } | ||
DbSet<Charge> Charges { get; set; } | ||
DbSet<ChargingProcess> ChargingProcesses { get; set; } | ||
DbSet<Drive> Drives { get; set; } | ||
DbSet<Geofence> Geofences { get; set; } | ||
DbSet<Position> Positions { get; set; } | ||
DbSet<SchemaMigration> SchemaMigrations { get; set; } | ||
DbSet<Setting> Settings { get; set; } | ||
DbSet<State> States { get; set; } | ||
DbSet<Token> Tokens { get; set; } | ||
DbSet<Update> Updates { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
namespace SmartTeslaAmpSetter.Model.Entities | ||
{ | ||
public class Address | ||
{ | ||
public Address() | ||
{ | ||
ChargingProcesses = new HashSet<ChargingProcess>(); | ||
DriveEndAddresses = new HashSet<Drive>(); | ||
DriveStartAddresses = new HashSet<Drive>(); | ||
} | ||
|
||
public int Id { get; set; } | ||
public string? DisplayName { get; set; } | ||
public decimal? Latitude { get; set; } | ||
public decimal? Longitude { get; set; } | ||
public string? Name { get; set; } | ||
public string? HouseNumber { get; set; } | ||
public string? Road { get; set; } | ||
public string? Neighbourhood { get; set; } | ||
public string? City { get; set; } | ||
public string? County { get; set; } | ||
public string? Postcode { get; set; } | ||
public string? State { get; set; } | ||
public string? StateDistrict { get; set; } | ||
public string? Country { get; set; } | ||
public string? Raw { get; set; } | ||
public DateTime InsertedAt { get; set; } | ||
public DateTime UpdatedAt { get; set; } | ||
public long? OsmId { get; set; } | ||
public string? OsmType { get; set; } | ||
|
||
public virtual ICollection<ChargingProcess> ChargingProcesses { get; set; } | ||
public virtual ICollection<Drive> DriveEndAddresses { get; set; } | ||
public virtual ICollection<Drive> DriveStartAddresses { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
namespace SmartTeslaAmpSetter.Model.Entities | ||
{ | ||
public class Car | ||
{ | ||
public Car() | ||
{ | ||
ChargingProcesses = new HashSet<ChargingProcess>(); | ||
Drives = new HashSet<Drive>(); | ||
Positions = new HashSet<Position>(); | ||
States = new HashSet<State>(); | ||
Updates = new HashSet<Update>(); | ||
} | ||
|
||
public short Id { get; set; } | ||
public long Eid { get; set; } | ||
public long Vid { get; set; } | ||
public string? Model { get; set; } | ||
public double? Efficiency { get; set; } | ||
public DateTime InsertedAt { get; set; } | ||
public DateTime UpdatedAt { get; set; } | ||
public string? Vin { get; set; } | ||
public string? Name { get; set; } | ||
public string? TrimBadging { get; set; } | ||
public long SettingsId { get; set; } | ||
public string? ExteriorColor { get; set; } | ||
public string? SpoilerType { get; set; } | ||
public string? WheelType { get; set; } | ||
public short DisplayPriority { get; set; } | ||
|
||
public virtual CarSetting Settings { get; set; } = null!; | ||
public virtual ICollection<ChargingProcess> ChargingProcesses { get; set; } | ||
public virtual ICollection<Drive> Drives { get; set; } | ||
public virtual ICollection<Position> Positions { get; set; } | ||
public virtual ICollection<State> States { get; set; } | ||
public virtual ICollection<Update> Updates { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
namespace SmartTeslaAmpSetter.Model.Entities | ||
{ | ||
public class CarSetting | ||
{ | ||
public long Id { get; set; } | ||
public int SuspendMin { get; set; } | ||
public int SuspendAfterIdleMin { get; set; } | ||
public bool ReqNotUnlocked { get; set; } | ||
public bool FreeSupercharging { get; set; } | ||
public bool? UseStreamingApi { get; set; } | ||
|
||
public virtual Car Car { get; set; } = null!; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
namespace SmartTeslaAmpSetter.Model.Entities | ||
{ | ||
public class Charge | ||
{ | ||
public int Id { get; set; } | ||
public DateTime Date { get; set; } | ||
public bool? BatteryHeaterOn { get; set; } | ||
public short? BatteryLevel { get; set; } | ||
public decimal ChargeEnergyAdded { get; set; } | ||
public short? ChargerActualCurrent { get; set; } | ||
public short? ChargerPhases { get; set; } | ||
public short? ChargerPilotCurrent { get; set; } | ||
public short ChargerPower { get; set; } | ||
public short? ChargerVoltage { get; set; } | ||
public bool? FastChargerPresent { get; set; } | ||
public string? ConnChargeCable { get; set; } | ||
public string? FastChargerBrand { get; set; } | ||
public string? FastChargerType { get; set; } | ||
public decimal IdealBatteryRangeKm { get; set; } | ||
public bool? NotEnoughPowerToHeat { get; set; } | ||
public decimal? OutsideTemp { get; set; } | ||
public int ChargingProcessId { get; set; } | ||
public bool? BatteryHeater { get; set; } | ||
public bool? BatteryHeaterNoPower { get; set; } | ||
public decimal? RatedBatteryRangeKm { get; set; } | ||
public short? UsableBatteryLevel { get; set; } | ||
|
||
public virtual ChargingProcess ChargingProcess { get; set; } = null!; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
namespace SmartTeslaAmpSetter.Model.Entities | ||
{ | ||
public class ChargingProcess | ||
{ | ||
public ChargingProcess() | ||
{ | ||
Charges = new HashSet<Charge>(); | ||
} | ||
|
||
public int Id { get; set; } | ||
public DateTime StartDate { get; set; } | ||
public DateTime? EndDate { get; set; } | ||
public decimal? ChargeEnergyAdded { get; set; } | ||
public decimal? StartIdealRangeKm { get; set; } | ||
public decimal? EndIdealRangeKm { get; set; } | ||
public short? StartBatteryLevel { get; set; } | ||
public short? EndBatteryLevel { get; set; } | ||
public short? DurationMin { get; set; } | ||
public decimal? OutsideTempAvg { get; set; } | ||
public short CarId { get; set; } | ||
public int PositionId { get; set; } | ||
public int? AddressId { get; set; } | ||
public decimal? StartRatedRangeKm { get; set; } | ||
public decimal? EndRatedRangeKm { get; set; } | ||
public int? GeofenceId { get; set; } | ||
public decimal? ChargeEnergyUsed { get; set; } | ||
public decimal? Cost { get; set; } | ||
|
||
public Address? Address { get; set; } | ||
public Car Car { get; set; } = null!; | ||
public Geofence? Geofence { get; set; } | ||
public Position Position { get; set; } = null!; | ||
public ICollection<Charge> Charges { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
namespace SmartTeslaAmpSetter.Model.Entities | ||
{ | ||
public class Drive | ||
{ | ||
public Drive() | ||
{ | ||
Positions = new HashSet<Position>(); | ||
} | ||
|
||
public int Id { get; set; } | ||
public DateTime StartDate { get; set; } | ||
public DateTime? EndDate { get; set; } | ||
public decimal? OutsideTempAvg { get; set; } | ||
public short? SpeedMax { get; set; } | ||
public short? PowerMax { get; set; } | ||
public short? PowerMin { get; set; } | ||
public decimal? StartIdealRangeKm { get; set; } | ||
public decimal? EndIdealRangeKm { get; set; } | ||
public double? StartKm { get; set; } | ||
public double? EndKm { get; set; } | ||
public double? Distance { get; set; } | ||
public short? DurationMin { get; set; } | ||
public short CarId { get; set; } | ||
public decimal? InsideTempAvg { get; set; } | ||
public int? StartAddressId { get; set; } | ||
public int? EndAddressId { get; set; } | ||
public decimal? StartRatedRangeKm { get; set; } | ||
public decimal? EndRatedRangeKm { get; set; } | ||
public int? StartPositionId { get; set; } | ||
public int? EndPositionId { get; set; } | ||
public int? StartGeofenceId { get; set; } | ||
public int? EndGeofenceId { get; set; } | ||
|
||
public Car Car { get; set; } = null!; | ||
public Address? EndAddress { get; set; } | ||
public Geofence? EndGeofence { get; set; } | ||
public Position? EndPosition { get; set; } | ||
public Address? StartAddress { get; set; } | ||
public Geofence? StartGeofence { get; set; } | ||
public Position? StartPosition { get; set; } | ||
public ICollection<Position> Positions { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
namespace SmartTeslaAmpSetter.Model.Entities | ||
{ | ||
public class Geofence | ||
{ | ||
public Geofence() | ||
{ | ||
ChargingProcesses = new HashSet<ChargingProcess>(); | ||
DriveEndGeofences = new HashSet<Drive>(); | ||
DriveStartGeofences = new HashSet<Drive>(); | ||
} | ||
|
||
public int Id { get; set; } | ||
public string Name { get; set; } = null!; | ||
public decimal Latitude { get; set; } | ||
public decimal Longitude { get; set; } | ||
public short Radius { get; set; } | ||
public DateTime InsertedAt { get; set; } | ||
public DateTime UpdatedAt { get; set; } | ||
public decimal? CostPerUnit { get; set; } | ||
public decimal? SessionFee { get; set; } | ||
|
||
public ICollection<ChargingProcess> ChargingProcesses { get; set; } | ||
public ICollection<Drive> DriveEndGeofences { get; set; } | ||
public ICollection<Drive> DriveStartGeofences { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
namespace SmartTeslaAmpSetter.Model.Entities | ||
{ | ||
public class Position | ||
{ | ||
public Position() | ||
{ | ||
ChargingProcesses = new HashSet<ChargingProcess>(); | ||
DriveEndPositions = new HashSet<Drive>(); | ||
DriveStartPositions = new HashSet<Drive>(); | ||
} | ||
|
||
public int Id { get; set; } | ||
public DateTime Date { get; set; } | ||
public decimal Latitude { get; set; } | ||
public decimal Longitude { get; set; } | ||
public short? Speed { get; set; } | ||
public short? Power { get; set; } | ||
public double? Odometer { get; set; } | ||
public decimal? IdealBatteryRangeKm { get; set; } | ||
public short? BatteryLevel { get; set; } | ||
public decimal? OutsideTemp { get; set; } | ||
public short? Elevation { get; set; } | ||
public int? FanStatus { get; set; } | ||
public decimal? DriverTempSetting { get; set; } | ||
public decimal? PassengerTempSetting { get; set; } | ||
public bool? IsClimateOn { get; set; } | ||
public bool? IsRearDefrosterOn { get; set; } | ||
public bool? IsFrontDefrosterOn { get; set; } | ||
public short CarId { get; set; } | ||
public int? DriveId { get; set; } | ||
public decimal? InsideTemp { get; set; } | ||
public bool? BatteryHeater { get; set; } | ||
public bool? BatteryHeaterOn { get; set; } | ||
public bool? BatteryHeaterNoPower { get; set; } | ||
public decimal? EstBatteryRangeKm { get; set; } | ||
public decimal? RatedBatteryRangeKm { get; set; } | ||
public short? UsableBatteryLevel { get; set; } | ||
|
||
public Car Car { get; set; } = null!; | ||
public Drive? Drive { get; set; } | ||
public ICollection<ChargingProcess> ChargingProcesses { get; set; } | ||
public ICollection<Drive> DriveEndPositions { get; set; } | ||
public ICollection<Drive> DriveStartPositions { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace SmartTeslaAmpSetter.Model.Entities | ||
{ | ||
public class SchemaMigration | ||
{ | ||
public long Version { get; set; } | ||
public DateTime? InsertedAt { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
namespace SmartTeslaAmpSetter.Model.Entities | ||
{ | ||
public class Setting | ||
{ | ||
public long Id { get; set; } | ||
public DateTime InsertedAt { get; set; } | ||
public DateTime UpdatedAt { get; set; } | ||
public string? BaseUrl { get; set; } | ||
public string? GrafanaUrl { get; set; } | ||
public string Language { get; set; } = null!; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
namespace SmartTeslaAmpSetter.Model.Entities | ||
{ | ||
public class State | ||
{ | ||
public int Id { get; set; } | ||
public DateTime StartDate { get; set; } | ||
public DateTime? EndDate { get; set; } | ||
public short CarId { get; set; } | ||
|
||
public virtual Car Car { get; set; } = null!; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
namespace SmartTeslaAmpSetter.Model.Entities | ||
{ | ||
public class Token | ||
{ | ||
public int Id { get; set; } | ||
public string Access { get; set; } = null!; | ||
public string Refresh { get; set; } = null!; | ||
public DateTime InsertedAt { get; set; } | ||
public DateTime UpdatedAt { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace SmartTeslaAmpSetter.Model.Entities | ||
{ | ||
public class Update | ||
{ | ||
public int Id { get; set; } | ||
public DateTime StartDate { get; set; } | ||
public DateTime? EndDate { get; set; } | ||
public string? Version { get; set; } | ||
public short CarId { get; set; } | ||
|
||
public virtual Car Car { get; set; } = null!; | ||
} | ||
} |
Oops, something went wrong.