Skip to content

Commit

Permalink
Merge pull request #44 from davewalker5/my-flight
Browse files Browse the repository at this point in the history
Add “My Flight” tag to sightings
  • Loading branch information
davewalker5 authored Dec 1, 2024
2 parents e7d458d + 167e3bc commit 904c677
Show file tree
Hide file tree
Showing 33 changed files with 30,769 additions and 30,929 deletions.
2 changes: 1 addition & 1 deletion docker/api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/core/aspnet:latest
COPY flightrecorder.api-1.13.0.0 /opt/flightrecorder.api
COPY flightrecorder.api-1.14.0.0 /opt/flightrecorder.api
WORKDIR /opt/flightrecorder.api/bin
ENTRYPOINT [ "./FlightRecorder.Api" ]
2 changes: 1 addition & 1 deletion docker/ui/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/aspnet:latest AS runtime
COPY flightrecorder.mvc-1.13.0.0 /opt/flightrecorder.mvc
COPY flightrecorder.mvc-1.14.0.0 /opt/flightrecorder.mvc
WORKDIR /opt/flightrecorder.mvc/bin
ENTRYPOINT [ "./FlightRecorder.Mvc" ]
4 changes: 3 additions & 1 deletion src/FlightRecorder.Api/Controllers/SightingsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ public async Task<ActionResult<Sighting>> UpdateSightingAsync([FromBody] Sightin
sighting.Altitude = template.Altitude;
sighting.FlightId = template.FlightId;
sighting.LocationId = template.LocationId;
sighting.IsMyFlight = template.IsMyFlight;
await _factory.Context.SaveChangesAsync();
await _factory.Context.Entry(sighting).Reference(s => s.Aircraft).LoadAsync();
await _factory.Context.Entry(sighting.Aircraft).Reference(m => m.Model).LoadAsync();
Expand All @@ -197,7 +198,8 @@ public async Task<ActionResult<Sighting>> CreateSightingAsync([FromBody] Sightin
template.Date,
template.LocationId,
template.FlightId,
template.AircraftId);
template.AircraftId,
template.IsMyFlight);
return location;
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/FlightRecorder.Api/FlightRecorder.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ReleaseVersion>1.13.0.0</ReleaseVersion>
<FileVersion>1.13.0.0</FileVersion>
<ProductVersion>1.13.0</ProductVersion>
<ReleaseVersion>1.14.0.0</ReleaseVersion>
<FileVersion>1.14.0.0</FileVersion>
<ProductVersion>1.14.0</ProductVersion>
<ImplicitUsings>enable</ImplicitUsings>
<IsPackable>false</IsPackable>
</PropertyGroup>
Expand Down
10 changes: 5 additions & 5 deletions src/FlightRecorder.Api/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"ApplicationSettings": {
"Secret": "e2b6e7fe16ef469d9862d43eb76d00e2802ab769b85848048cc9387743ca2cc38c0f4fd8a0de46798f347bedf676bc31",
"TokenLifespanMinutes": 1440,
"SightingsExportPath": "C:\\MyApps\\FlightRecorder\\Export",
"AirportsExportPath": "C:\\MyApps\\FlightRecorder\\Export\\Airports",
"ReportsExportPath": "C:\\MyApps\\FlightRecorder\\Export\\Reports",
"LogFile": "C:\\MyApps\\FlightRecorder\\FlightRecorder.Manager.log",
"SightingsExportPath": "/Users/dave/MyApps/FlightRecorder/Export",
"AirportsExportPath": "/Users/dave/MyApps/FlightRecorder/Export/Airports",
"ReportsExportPath": "/Users/dave/MyApps/FlightRecorder/Export/Reports",
"LogFile": "/Users/dave/MyApps/FlightRecorder/Export/FlightRecorder.Manager.log",
"MinimumLogLevel": "Info",
"ApiEndpoints": [
{
Expand All @@ -27,7 +27,7 @@
"ApiServiceKeys": [
{
"Service": "AeroDataBox",
"Key": "C:\\MyApps\\FlightRecorder\\rapidapi.key"
"Key": "/Users/dave/MyApps/FlightRecorder/rapidapi.key"
}
]
},
Expand Down
8 changes: 5 additions & 3 deletions src/FlightRecorder.BusinessLogic/Database/SightingManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,18 @@ public async Task<Sighting> GetMostRecent(Expression<Func<Sighting, bool>> predi
/// <param name="locationId"></param>
/// <param name="flightId"></param>
/// <param name="aircraftId"></param>
/// <param name="isMyFlight"></param>
/// <returns></returns>
public async Task<Sighting> AddAsync(long altitude, DateTime date, long locationId, long flightId, long aircraftId)
public async Task<Sighting> AddAsync(long altitude, DateTime date, long locationId, long flightId, long aircraftId, bool isMyFlight)
{
Sighting sighting = new Sighting
{
Altitude = altitude,
Date = date,
LocationId = locationId,
FlightId = flightId,
AircraftId = aircraftId
AircraftId = aircraftId,
IsMyFlight = isMyFlight
};

await _factory.Context.Sightings.AddAsync(sighting);
Expand Down Expand Up @@ -150,7 +152,7 @@ public async Task<Sighting> AddAsync(FlattenedSighting flattened)
long aircraftId = (await _factory.Aircraft.AddAsync(flattened.Registration, flattened.SerialNumber, yearOfManufacture, flattened.Model, flattened.Manufacturer)).Id;
long flightId = (await _factory.Flights.AddAsync(flattened.FlightNumber, flattened.Embarkation, flattened.Destination, flattened.Airline)).Id;
long locationId = (await _factory.Locations.AddAsync(flattened.Location)).Id;
return await AddAsync(flattened.Altitude, flattened.Date, locationId, flightId, aircraftId);
return await AddAsync(flattened.Altitude, flattened.Date, locationId, flightId, aircraftId, flattened.IsMyFlight);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<PackageId>FlightRecorder.BusinessLogic</PackageId>
<PackageVersion>1.9.0.0</PackageVersion>
<PackageVersion>1.10.0.0</PackageVersion>
<Authors>Dave Walker</Authors>
<Copyright>Copyright (c) Dave Walker 2020, 2021, 2022, 2023, 2024</Copyright>
<Owners>Dave Walker</Owners>
Expand All @@ -16,7 +16,7 @@
<PackageProjectUrl>https://github.com/davewalker5/FlightRecorderDb</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<ReleaseVersion>1.9.0.0</ReleaseVersion>
<ReleaseVersion>1.10.0.0</ReleaseVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/FlightRecorder.Data/FlightRecorder.Data.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<PackageId>FlightRecorder.Data</PackageId>
<PackageVersion>1.9.0.0</PackageVersion>
<PackageVersion>1.10.0.0</PackageVersion>
<Authors>Dave Walker</Authors>
<Copyright>Copyright (c) Dave Walker 2020, 2021, 2022, 2023, 2024</Copyright>
<Owners>Dave Walker</Owners>
Expand All @@ -16,7 +16,7 @@
<PackageProjectUrl>https://github.com/davewalker5/FlightRecorderDb</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<ReleaseVersion>1.9.0.0</ReleaseVersion>
<ReleaseVersion>1.10.0.0</ReleaseVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions src/FlightRecorder.Data/FlightRecorderDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
entity.Property(e => e.FlightId).HasColumnName("flight_id");

entity.Property(e => e.LocationId).HasColumnName("location_id");

entity.Property(e => e.IsMyFlight).HasColumnName("is_my_flight");
});

modelBuilder.Entity<JobStatus>(entity =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

namespace FlightRecorder.Data.Migrations
{
[ExcludeFromCodeCoverage]
/// <inheritdoc />
public partial class DefaultLocation : Migration
{
Expand Down
Loading

0 comments on commit 904c677

Please sign in to comment.