Skip to content

Commit

Permalink
chore: Add option to skip collections with items in GeosquarePublicat…
Browse files Browse the repository at this point in the history
…ionModel
  • Loading branch information
emmanuelmathot committed Jun 17, 2024
1 parent 5a9bc3f commit 0f9035b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ internal void UpdateLink(SyndicationLink link, AtomItem item, IAssetsContainer a
public List<string> AssetsFilters { get; set; }

public bool PublishCollections { get; set; } = false;

public bool SkipCollectionsWithItems { get; set; } = false;
}

}
8 changes: 8 additions & 0 deletions src/Stars.Data/ThirdParty/Publication/GeosquareService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,14 @@ public async Task<object> PostCollectionToCatalog(ICollection collectionNode, IR
GeosquarePublicationState catalogPublicationState = state as GeosquarePublicationState;
AtomItemNode atomItemNode = null;

// Get Item from the collection
var items = collectionNode.GetLinks().Where(l => l.Relationship == "item");
if ( items.Any() && catalogPublicationState.GeosquarePublicationModel.SkipCollectionsWithItems == true)
{
logger.LogWarning("Skipping collection {0} because it has items", collectionNode);
return state;
}

// Filter assets
// Create the asset filters based on the asset filters string from the catalog publication model
AssetFilters assetFilters = AssetFilters.CreateAssetFilters(catalogPublicationState.GeosquarePublicationModel.AssetsFilters);
Expand Down

0 comments on commit 0f9035b

Please sign in to comment.