Skip to content

Commit 859d280

Browse files
authored
Merge pull request #492 from stac-utils/jcw/use-type-when-ingesting
2 parents a833b98 + 0f625ed commit 859d280

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1010
### Changed
1111

1212
- Remove node streams-based ingest code to prepare for post-ingest notifications
13+
- Use the `type` field to determine if ingest is a Collection or Item
1314

1415
## [1.1.0] - 2023-05-02
1516

src/lib/ingest.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ const COLLECTIONS_INDEX = process.env['COLLECTIONS_INDEX'] || 'collections'
66

77
export async function convertIngestObjectToDbObject(
88
// eslint-disable-next-line max-len
9-
/** @type {{ hasOwnProperty: (arg0: string) => any; collection: string; links: any[]; id: any; }} */ data
9+
/** @type {{ hasOwnProperty: (arg0: string) => any; type: string, collection: string; links: any[]; id: any; }} */ data
1010
) {
1111
let index = ''
1212
logger.debug('data', data)
13-
if (data && data.hasOwnProperty('extent')) {
13+
if (data && data.type === 'Collection') {
1414
index = COLLECTIONS_INDEX
15-
} else if (data && data.hasOwnProperty('geometry')) {
15+
} else if (data && data.type === 'Feature') {
1616
index = data.collection
1717
} else {
1818
return null

0 commit comments

Comments
 (0)