From f20b93f55ddddcaf8b96454382c26c24d54ee09f Mon Sep 17 00:00:00 2001 From: Joshua Medley Date: Mon, 7 Nov 2022 08:59:07 +0000 Subject: [PATCH 1/2] add lowest_geography to instance --- features/instances.feature | 27 +++++++++++++++++++++++++-- models/instance.go | 1 + 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/features/instances.feature b/features/instances.feature index b54d3221..6c681ccf 100644 --- a/features/instances.feature +++ b/features/instances.feature @@ -48,6 +48,16 @@ "id": "other" } } + }, + { + "id": "test-item-6", + "state": "created", + "links": { + "dataset": { + "id": "other" + } + }, + "lowest_geography": "lowest_geo" } ] """ @@ -60,8 +70,21 @@ Then I should receive the following JSON response with status "200": """ { - "count": 5, + "count": 6, "items": [ + { + "id": "test-item-6", + "import_tasks": null, + "last_updated": "2021-01-01T00:00:05Z", + "links": { + "dataset": { + "id": "other" + }, + "job": null + }, + "state": "created", + "lowest_geography": "lowest_geo" + }, { "id": "test-item-5", "import_tasks": null, @@ -125,7 +148,7 @@ ], "limit": 20, "offset": 0, - "total_count": 5 + "total_count": 6 } """ diff --git a/models/instance.go b/models/instance.go index caa21f32..29ee197b 100644 --- a/models/instance.go +++ b/models/instance.go @@ -33,6 +33,7 @@ type Instance struct { Version int `bson:"version,omitempty" json:"version,omitempty"` Type string `bson:"type,omitempty" json:"type,omitempty"` IsBasedOn *IsBasedOn `bson:"is_based_on,omitempty" json:"is_based_on,omitempty"` + LowestGeography string `bson:"lowest_geography,omitempty" json:"lowest_geography,omitempty"` } // Hash generates a SHA-1 hash of the instance struct. SHA-1 is not cryptographically safe, From 5f9f4218b65aae4803809f4a876e9f72b9bf5305 Mon Sep 17 00:00:00 2001 From: Joshua Medley Date: Wed, 9 Nov 2022 15:45:51 +0000 Subject: [PATCH 2/2] add lowest_geography to version struct --- features/versions.feature | 9 ++++++--- models/dataset.go | 39 ++++++++++++++++++++------------------- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/features/versions.feature b/features/versions.feature index b6504ff3..71ad08ae 100644 --- a/features/versions.feature +++ b/features/versions.feature @@ -144,7 +144,8 @@ Feature: Dataset API "href": "someurl" } }, - "edition": "hello" + "edition": "hello", + "lowest_geography": "ltla" }, { "id": "test-cantabular-version-1", @@ -210,7 +211,8 @@ Feature: Dataset API "self": { "href": "someurl" } - } + }, + "lowest_geography": "ltla" }, { "dataset_id": "population-estimates", @@ -258,7 +260,8 @@ Feature: Dataset API "href": "someurl" } }, - "edition": "hello" + "edition": "hello", + "lowest_geography": "ltla" }, { "dataset_id": "population-estimates", diff --git a/models/dataset.go b/models/dataset.go index 5931afb6..438c5cf2 100644 --- a/models/dataset.go +++ b/models/dataset.go @@ -189,25 +189,26 @@ type Publisher struct { // Version represents information related to a single version for an edition of a dataset type Version struct { - Alerts *[]Alert `bson:"alerts,omitempty" json:"alerts,omitempty"` - CollectionID string `bson:"collection_id,omitempty" json:"collection_id,omitempty"` - DatasetID string `bson:"-" json:"dataset_id,omitempty"` - Dimensions []Dimension `bson:"dimensions,omitempty" json:"dimensions,omitempty"` - Downloads *DownloadList `bson:"downloads,omitempty" json:"downloads,omitempty"` - Edition string `bson:"edition,omitempty" json:"edition,omitempty"` - Headers []string `bson:"headers,omitempty" json:"-"` - ID string `bson:"id,omitempty" json:"id,omitempty"` - LastUpdated time.Time `bson:"last_updated,omitempty" json:"-"` - LatestChanges *[]LatestChange `bson:"latest_changes,omitempty" json:"latest_changes,omitempty"` - Links *VersionLinks `bson:"links,omitempty" json:"links,omitempty"` - ReleaseDate string `bson:"release_date,omitempty" json:"release_date,omitempty"` - State string `bson:"state,omitempty" json:"state,omitempty"` - Temporal *[]TemporalFrequency `bson:"temporal,omitempty" json:"temporal,omitempty"` - UsageNotes *[]UsageNote `bson:"usage_notes,omitempty" json:"usage_notes,omitempty"` - IsBasedOn *IsBasedOn `bson:"is_based_on,omitempty" json:"is_based_on,omitempty"` - Version int `bson:"version,omitempty" json:"version,omitempty"` - Type string `bson:"type,omitempty" json:"type,omitempty"` - ETag string `bson:"e_tag" json:"-"` + Alerts *[]Alert `bson:"alerts,omitempty" json:"alerts,omitempty"` + CollectionID string `bson:"collection_id,omitempty" json:"collection_id,omitempty"` + DatasetID string `bson:"-" json:"dataset_id,omitempty"` + Dimensions []Dimension `bson:"dimensions,omitempty" json:"dimensions,omitempty"` + Downloads *DownloadList `bson:"downloads,omitempty" json:"downloads,omitempty"` + Edition string `bson:"edition,omitempty" json:"edition,omitempty"` + Headers []string `bson:"headers,omitempty" json:"-"` + ID string `bson:"id,omitempty" json:"id,omitempty"` + LastUpdated time.Time `bson:"last_updated,omitempty" json:"-"` + LatestChanges *[]LatestChange `bson:"latest_changes,omitempty" json:"latest_changes,omitempty"` + Links *VersionLinks `bson:"links,omitempty" json:"links,omitempty"` + ReleaseDate string `bson:"release_date,omitempty" json:"release_date,omitempty"` + State string `bson:"state,omitempty" json:"state,omitempty"` + Temporal *[]TemporalFrequency `bson:"temporal,omitempty" json:"temporal,omitempty"` + UsageNotes *[]UsageNote `bson:"usage_notes,omitempty" json:"usage_notes,omitempty"` + IsBasedOn *IsBasedOn `bson:"is_based_on,omitempty" json:"is_based_on,omitempty"` + Version int `bson:"version,omitempty" json:"version,omitempty"` + Type string `bson:"type,omitempty" json:"type,omitempty"` + ETag string `bson:"e_tag" json:"-"` + LowestGeography string `bson:"lowest_geography,omitempty" json:"lowest_geography,omitempty"` } // Hash generates a SHA-1 hash of the version struct. SHA-1 is not cryptographically safe,