-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: [GROOT-1552] implement taxonomy methods in CDA
- Loading branch information
1 parent
445344e
commit 347f6af
Showing
11 changed files
with
432 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { Link } from './link' | ||
import { LocaleCode } from './locale' | ||
|
||
type ISODateString = string | ||
|
||
export type ConceptSchemeSys = { | ||
id: string | ||
type: 'TaxonomyConceptScheme' | ||
createdAt: ISODateString | ||
updatedAt: ISODateString | ||
version: number | ||
} | ||
|
||
export interface ConceptScheme<Locales extends LocaleCode> { | ||
sys: ConceptSchemeSys | ||
uri?: string | ||
prefLabel: { | ||
[locale in Locales]: string | ||
} | ||
definition?: { | ||
[locale in Locales]: string | ||
} | ||
topConcepts: Link<'TaxonomyConcept'>[] | ||
concepts: Link<'TaxonomyConcept'>[] | ||
totalConcepts: number | ||
} | ||
|
||
export type ConceptSchemeCollection<Locale extends LocaleCode> = { | ||
items: ConceptScheme<Locale>[] | ||
limit: number | ||
prevPage: string | ||
nextPage: string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { Link } from './link' | ||
import { LocaleCode } from './locale' | ||
|
||
type ISODateString = string | ||
|
||
export type ConceptSys = { | ||
id: string | ||
type: 'TaxonomyConcept' | ||
createdAt: ISODateString | ||
updatedAt: ISODateString | ||
version: number | ||
} | ||
|
||
export interface Concept<Locales extends LocaleCode> { | ||
sys: ConceptSys | ||
uri?: string | ||
prefLabel: { | ||
[locale in Locales]: string | ||
} | ||
altLabels?: { | ||
[locale in Locales]: string[] | ||
} | ||
hiddenLabels?: { | ||
[locale in Locales]: string[] | ||
} | ||
note?: { | ||
[locale in Locales]: string | ||
} | ||
changeNote?: { | ||
[locale in Locales]: string | ||
} | ||
definition?: { | ||
[locale in Locales]: string | ||
} | ||
editorialNote?: { | ||
[locale in Locales]: string | ||
} | ||
example?: { | ||
[locale in Locales]: string | ||
} | ||
historyNote?: { | ||
[locale in Locales]: string | ||
} | ||
scopeNote?: { | ||
[locale in Locales]: string | ||
} | ||
notations?: string[] | ||
broader?: Link<'TaxonomyConcept'>[] | ||
related?: Link<'TaxonomyConcept'>[] | ||
} | ||
|
||
export type ConceptCollection<Locale extends LocaleCode> = { | ||
items: Concept<Locale>[] | ||
limit: number | ||
prevPage: string | ||
nextPage: string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import * as contentful from '../../lib/contentful' | ||
import { params } from './utils' | ||
|
||
if (process.env.API_INTEGRATION_TESTS) { | ||
params.host = '127.0.0.1:5000' | ||
params.insecure = true | ||
} | ||
|
||
const client = contentful.createClient(params) | ||
|
||
describe('getConcept', () => { | ||
it('returns a single concept', async () => { | ||
const response = await client.getConcept('3eXhEIEzcZqwHyYWHbzSoS') | ||
|
||
expect(response.sys.type).toBe('TaxonomyConcept') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import * as contentful from '../../lib/contentful' | ||
import { params } from './utils' | ||
|
||
if (process.env.API_INTEGRATION_TESTS) { | ||
params.host = '127.0.0.1:5000' | ||
params.insecure = true | ||
} | ||
|
||
const client = contentful.createClient(params) | ||
|
||
describe('getConceptScheme', () => { | ||
it('returns a single concept scheme', async () => { | ||
const response = await client.getConceptScheme('7lcOh0M5JAu5xvEwWzs00H') | ||
|
||
expect(response.sys.type).toBe('TaxonomyConceptScheme') | ||
}) | ||
}) |
Oops, something went wrong.