Skip to content

Commit

Permalink
Bump 4.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
BrodaNoel committed May 26, 2022
1 parent 386d1e2 commit 4193021
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,23 @@
- `firebase-firestore-helper@^1.0.0` supports `firebase-admin@^8.0.0`
- `firebase-firestore-helper@^2.0.0` supports `firebase-admin@^9.0.0`
- `firebase-firestore-helper@^3.0.0` supports `firebase-admin@^10.0.0`
- `firebase-firestore-helper@^4.0.0` supports `firebase-admin@^10.0.0`

## How to use it

### Initializing the Helper

In your `./src/index.js` file (or whatever is called your root file), initialize the helper by doing:

```js
const { initHelper } = require('firebase-firestore-helper');
// import { initHelper } from 'firebase-firestore-helper';

initHelper();
```

### Using the Helper

When `.add` function is called, it **must** receive an `id` inside the object to save, which is the one is going to be used as document id.

We recommend to use an `string` as ID (usually `uuid/v4`)
Expand Down Expand Up @@ -59,8 +73,10 @@ Your folder tree should contain 3 important parts:
| |-> users
| |-> photos
| |-> ...
|-> index.js
```

- `index.js` will initialize the helper, by using `initHelper` function, just before you call `initializeApp` from `firebase-admin/app`
- `db/users` will **expose** the object created by this library, which will handle the `users` collections in Firestore. You'll be able to override here.
- `actions/users` will **use** the object exposed by `db/users`, and where you'll write all the business logic.
- `app/*` is just the regular file where you are listeining for the `httpRequests`, which will user `actions/*` in order to handle business logic.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "firebase-firestore-helper",
"version": "3.0.2",
"version": "4.0.0",
"description": "Firebase Firestore Helper",
"main": "build/index.js",
"scripts": {
Expand Down

0 comments on commit 4193021

Please sign in to comment.