Skip to content

Commit

Permalink
feat: handle articles cid (#106)
Browse files Browse the repository at this point in the history
* feat: handle articles cid
* refactor: replace useless clone
* refactor: rename getSectionsFromArticle() to getArticleWithParentSections()
* refactor: dry withArticleIdOrCid()
  • Loading branch information
ivangabriele authored Jun 17, 2020
1 parent f8f11d0 commit 4e20301
Show file tree
Hide file tree
Showing 16 changed files with 131,809 additions and 84 deletions.
32 changes: 24 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Extracted with [dila-api-client][link-dila-api-client] from [DILA API][link-aife
- [getAgreements()](#getagreements)
- [getArticles()](#getarticles)
- [getArticleWithParentSections()](#getarticlewithparentsections)
- [getIndexedArticle()](#getindexedarticle)
- [hasAgreement()](#hasagreement)
- [hasArticle()](#hasarticle)
- [Contributing](#contributing)
Expand Down Expand Up @@ -124,16 +125,30 @@ KaliData.IndexedArticle[]

Get an agreement article [unist][link-unist] node.

| Parameter | Type | Default | Description |
| ----------- | -------- | ------------ | ----------- |
| `articleId` | `string` | **required** | Article ID |
| Parameter | Type | Default | Description |
| ---------------- | -------- | ------------ | ----------------- |
| `articleIdOrCid` | `string` | **required** | Article ID or CID |

**Return Type**

```ts
KaliData.AgreementArticleWithParentSections
```

#### getIndexedArticle()

Get an indexed article.

| Parameter | Type | Default | Description |
| ---------------- | -------- | ------------ | ----------------- |
| `articleIdOrCid` | `string` | **required** | Article ID or CID |

**Return Type**

```ts
KaliData.IndexedArticle
```

#### hasAgreement()

Check if an agreement is available.
Expand All @@ -152,9 +167,9 @@ boolean

Check if an article is available.

| Parameter | Type | Default | Description |
| ----------- | -------- | ------------ | ----------- |
| `articleId` | `string` | **required** | Article ID |
| Parameter | Type | Default | Description |
| ---------------- | -------- | ------------ | ----------------- |
| `articleIdOrCid` | `string` | **required** | Article ID or CID |

**Return Type**

Expand Down Expand Up @@ -185,7 +200,8 @@ their articles.

- `yarn data:check` Check agreements consistency.
- `yarn data:fetch`: Update agreements articles from DILA API.
- `yarn data:match`: Update agreements articles index (matching articles ID with agreements ID).
- `yarn data:match`: Update agreements articles index (matching articles ID & CID with their
agreements ID).
- `yarn data:list` Update `REFERENCES.md` file.

### Tests
Expand All @@ -203,7 +219,7 @@ The agreement references list is available [here][link-agreement-references].
## See Also

- [Code du travail numérique](https://github.com/SocialGouv/code-du-travail-numerique)
- [dila-api-client : Client JavaScript pour l'API DILA AIFE](https://github.com/SocialGouv/dila-api-client)
- [dila-api-client : Client JavaScript pour l'API DILA AIFE][link-dila-api-client]
- [legi-data : base LEGI](https://github.com/SocialGouv/legi-data)
- [fiches-vdd : Fiches vos droits et démarches](https://github.com/SocialGouv/fiches-vdd)

Expand Down
Loading

0 comments on commit 4e20301

Please sign in to comment.