Skip to content

Commit

Permalink
chore(docs): update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
stfsy committed Apr 27, 2024
1 parent e22ca9b commit ff3a51b
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 16 deletions.
39 changes: 25 additions & 14 deletions README_ONE_TO_FEW_RESOURCE_STORAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ const oneToFewResourceStorage = new OneToFewResourceStorage({
})
```

## GetOptions

### Properties

* `withMetadata` **[boolean][2]** true if also meta data should be returned
* `projection` **[Object][3]** MongoDB projection object e.g. { id: 0, name: 0 }

## OneToFewResourceStorage

Allows to manage a list of documents in another document to e.g. store a list of
Expand Down Expand Up @@ -57,30 +64,30 @@ Returns a resource by ids.

### Parameters

* `resourceIds` **([String][1] | [Array][2]<[String][1]>)** resource ids that will added to the resource path i.e. /users/${id}/documents/${id}
* `options` **GetOptions**&#x20;
* `resourceIds` **([String][1] | [Array][4]<[String][1]>)** resource ids that will added to the resource path i.e. /users/${id}/documents/${id}
* `options` **[GetOptions][5]**&#x20;

Returns **[Promise][3]<[Object][4]>**&#x20;
Returns **[Promise][6]<[Object][3]>**&#x20;

## getAll

Returns all resources.

### Parameters

* `resourceIds` **([String][1] | [Array][2]<[String][1]>)** resource ids that will added to the resource path i.e. /users/${id}/documents/${id}
* `options` **GetOptions**&#x20;
* `resourceIds` **([String][1] | [Array][4]<[String][1]>)** resource ids that will added to the resource path i.e. /users/${id}/documents/${id}
* `options` **[GetOptions][5]**&#x20;

Returns **[Promise][3]<[Array][2]<[Object][4]>>**&#x20;
Returns **[Promise][6]<[Array][4]<[Object][3]>>**&#x20;

## create

Add a resource to a collection by ids.

### Parameters

* `resourceIds` **([String][1] | [Array][2]<[String][1]>)** resource ids that will added to the resource path i.e. /users/${id}/documents/${id}
* `resource` **[Object][4]** the resource to be stored
* `resourceIds` **([String][1] | [Array][4]<[String][1]>)** resource ids that will added to the resource path i.e. /users/${id}/documents/${id}
* `resource` **[Object][3]** the resource to be stored

Returns **ObjectId**&#x20;

Expand All @@ -90,8 +97,8 @@ Updates a resource by ids

### Parameters

* `resourceIds` **([String][1] | [Array][2]<[String][1]>)** resource ids that will added to the resource path i.e. /users/${id}/documents/${id}
* `update` **[Object][4]** values that should be updated
* `resourceIds` **([String][1] | [Array][4]<[String][1]>)** resource ids that will added to the resource path i.e. /users/${id}/documents/${id}
* `update` **[Object][3]** values that should be updated

Returns **void**&#x20;

Expand All @@ -101,14 +108,18 @@ Deletes a resource by ids

### Parameters

* `resourceIds` **([String][1] | [Array][2]<[String][1]>)** resource ids that will added to the resource path i.e. /users/${id}/documents/${id}
* `resourceIds` **([String][1] | [Array][4]<[String][1]>)** resource ids that will added to the resource path i.e. /users/${id}/documents/${id}

Returns **void**&#x20;

[1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String

[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean

[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object

[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array

[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
[5]: #getoptions

[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
14 changes: 12 additions & 2 deletions README_ONE_TO_MANY_RESOURCE_STORAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ const oneToManyResourceStorage = new OneToManyResourceStorage({
})
```

## GetOptions

### Properties

* `withMetadata` **[boolean][4]** true if also meta data should be returned
* `addDocumentPath` **[boolean][4]** true if $path propety should be added to documents e.g. `$path=/countries/1/cities/2/companies`
* `projection` **[Object][3]** MongoDB projection object e.g. { id: 0, name: 0 }

## OneToManyResourceStorage

Manages relationships between entities in a more decoupled way by keep storing
Expand Down Expand Up @@ -85,7 +93,7 @@ Returns a resource by ids.
### Parameters

* `resourceIds` **([String][1] | [Array][2]<[String][1]>)** resource ids that will added to the resource path i.e. /users/${id}/documents/${id}
* `options` **GetOptions**&#x20;
* `options` **[Object][3]**&#x20;

Returns **[Object][3]**&#x20;

Expand All @@ -107,7 +115,7 @@ Returns resources based on return value of [findReferences][5].
### Parameters

* `resourceIds` **([String][1] | [Array][2]<[String][1]>)** resource ids that will added to the resource path i.e. /users/${id}/documents/${id}
* `options` **GetOptions**&#x20;
* `options` **[GetOptions][6]**&#x20;

## create

Expand Down Expand Up @@ -144,3 +152,5 @@ Deletes a resource by ids
[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean

[5]: findReferences

[6]: #getoptions

0 comments on commit ff3a51b

Please sign in to comment.