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

Add custom properties #194

Merged
merged 3 commits into from
May 8, 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Added

- When releasing a GitHub pre-release, the release notes are automatically updated with the corresponding entries from the `CHANGELOG.md` file.
- Show additional delivery properties in STAC browser.

## v1.0.87 - 2024-04-26

Expand Down
1 change: 1 addition & 0 deletions src/Geopilot.Api/Context.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public List<Delivery> DeliveriesWithIncludes
.Include(d => d.DeliveryMandate)
.Include(d => d.Assets)
.Include(d => d.DeclaringUser)
.Include(d => d.PrecursorDelivery)
.AsNoTracking()
.ToList();
}
Expand Down
8 changes: 8 additions & 0 deletions src/Geopilot.Api/StacServices/StacConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Stac.Api.Interfaces;
using Stac.Api.WebApi.Services;
using Stac.Collection;
using System.Globalization;

namespace Geopilot.Api.StacServices;

Expand Down Expand Up @@ -90,6 +91,13 @@ public StacItem ToStacItem(Delivery delivery)
DateTime = new TimeBlock(delivery.Date),
};

item.Properties.Add("Teilabgabe", delivery.Partial ? "Ja" : "Nein");
item.Properties.Add("Abgegeben durch", delivery.DeclaringUser.FullName);
if (delivery.PrecursorDelivery != null)
{
item.Properties.Add("Vorgängerversion", delivery.PrecursorDelivery.Date.ToString("d.M.yyyy, H:mm:ss 'UTC'", CultureInfo.InvariantCulture));
}

var stacApiContext = StacApiContextFactory.Create();
var assets = delivery.Assets.Select(file => ToStacAsset(file, item, stacApiContext.BaseUri)).ToDictionary(asset => asset.Title);
item.Assets.AddRange(assets);
Expand Down