Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(chore): improve enable proxy experience #1042

Merged
merged 7 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ public interface ITeslaSolarChargerContext
DbSet<SpotPrice> SpotPrices { get; set; }
DbSet<TeslaToken> TeslaTokens { get; set; }
DbSet<TscConfiguration> TscConfigurations { get; set; }
DbSet<Car> Cars { get; set; }
void RejectChanges();
}
11 changes: 11 additions & 0 deletions TeslaSolarCharger.Model/Entities/TeslaSolarCharger/Car.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using TeslaSolarCharger.Model.Enums;
using TeslaSolarCharger.Shared.Enums;

namespace TeslaSolarCharger.Model.Entities.TeslaSolarCharger;

public class Car
{
public int Id { get; set; }
public int TeslaMateCarId { get; set; }
public TeslaCarFleetApiState TeslaFleetApiState { get; set; } = TeslaCarFleetApiState.NotConfigured;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class TeslaSolarChargerContext : DbContext, ITeslaSolarChargerContext
public DbSet<SpotPrice> SpotPrices { get; set; } = null!;
public DbSet<TeslaToken> TeslaTokens { get; set; } = null!;
public DbSet<TscConfiguration> TscConfigurations { get; set; } = null!;
public DbSet<Car> Cars { get; set; } = null!;

// ReSharper disable once UnassignedGetOnlyAutoProperty
public string DbPath { get; }
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 35 additions & 0 deletions TeslaSolarCharger.Model/Migrations/20240102001022_AddCarsTable.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace TeslaSolarCharger.Model.Migrations
{
/// <inheritdoc />
public partial class AddCarsTable : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Cars",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
TeslaMateCarId = table.Column<int>(type: "INTEGER", nullable: false),
TeslaFleetApiState = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Cars", x => x.Id);
});
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Cars");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ partial class TeslaSolarChargerContextModelSnapshot : ModelSnapshot
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.11");
modelBuilder.HasAnnotation("ProductVersion", "8.0.0");

modelBuilder.Entity("TeslaSolarCharger.Model.Entities.TeslaSolarCharger.CachedCarState", b =>
{
Expand All @@ -41,6 +41,23 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.ToTable("CachedCarStates");
});

modelBuilder.Entity("TeslaSolarCharger.Model.Entities.TeslaSolarCharger.Car", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");

b.Property<int>("TeslaFleetApiState")
.HasColumnType("INTEGER");

b.Property<int>("TeslaMateCarId")
.HasColumnType("INTEGER");

b.HasKey("Id");

b.ToTable("Cars");
});

modelBuilder.Entity("TeslaSolarCharger.Model.Entities.TeslaSolarCharger.ChargePrice", b =>
{
b.Property<int>("Id")
Expand Down
4 changes: 0 additions & 4 deletions TeslaSolarCharger.Model/TeslaSolarCharger.Model.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,4 @@
<ProjectReference Include="..\TeslaSolarCharger\Shared\TeslaSolarCharger.Shared.csproj" />
</ItemGroup>

<ItemGroup>
<Folder Include="Enums\" />
</ItemGroup>

</Project>
1 change: 0 additions & 1 deletion TeslaSolarCharger.SharedBackend/Contracts/IConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@ public interface IConstants
string FleetApiTokenRequested { get; }
string TokenRefreshUnauthorized { get; }
string TokenMissingScopes { get; }
string VehicleNotPaired { get; }
}
1 change: 0 additions & 1 deletion TeslaSolarCharger.SharedBackend/Values/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ public class Constants : IConstants
public string FleetApiTokenRequested => "FleetApiTokenRequested";
public string TokenRefreshUnauthorized => "TokenRefreshUnauthorized";
public string TokenMissingScopes => "TokenMissingScopes";
public string VehicleNotPaired => "VehicleNotPaired_{0}";
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
<div>@issue.IssueMessage</div>
@if (issue.PossibleSolutions.Length > 0)
{
<div>Possible solutions:</div>
<hr />
<div><strong>Possible solutions:</strong></div>
<ul>
@foreach (var solution in issue.PossibleSolutions)
{
Expand Down
Loading
Loading