Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removing a known limitation by creating support for Firebase Storage upload #12

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
622a52f
use resourceName instead
Oct 23, 2019
5a10d56
resolved prettier errors
Dec 3, 2019
6fdbb9f
incuded releasedate field options for queries
Dec 3, 2019
336eff8
removing orderby method for queries made to sort by release date
Dec 3, 2019
22c0ab1
fixed hasownproperty errors
Dec 4, 2019
8b79089
added feature to sort data by release date
Dec 4, 2019
d6ff50a
set the items being returned from firebasequery by release date reque…
Dec 4, 2019
64ffbe9
handlind revert function
Dec 5, 2019
b88e7ef
checked if params.filter has its own property before sorting by reale…
Dec 5, 2019
6b96cc6
removed comsole statment for requests from params
Dec 5, 2019
7457032
fixed order of data being fetched && fixed sorting method
Dec 9, 2019
e560cf8
changed delete request on udux admin portal
Dec 11, 2019
5c7c7aa
re-edited the getList function that checks for released date to not n…
Dec 15, 2019
f7de81a
removing _d from has ownProperty method
Dec 15, 2019
bd3d425
refactored code to match passed paramaters from getistin dataProvider
Dec 15, 2019
1b83ca2
set up restprovider and methods.js to handle DateInput only
Dec 15, 2019
17abce8
created medium for file saving in admin-portal app.js
Dec 17, 2019
7f322a8
Merge pull request #2 from codefingas/master
osiloke Dec 17, 2019
5710728
testing ignoring yalc folder in admin-portal
Dec 17, 2019
4236305
fix: allow persistence of session accross tabs
Dec 17, 2019
0a64eab
Merge branch 'master' of https://github.com/osiloke/ra-data-firestore…
Dec 18, 2019
a9b2ab6
removed hasownproperty error
Jan 15, 2020
3e4e5e1
new updates to removing hasownproperty error
Jan 15, 2020
8a6ffbd
new changes
Feb 7, 2020
d318040
fix: handle infinite pagination
osiloke Feb 8, 2020
8b135f0
changes from harold's repo
Feb 10, 2020
bdabcc5
updates from harolds repo
Feb 10, 2020
feb633d
incoming changes from harold's repo
Feb 10, 2020
14c9248
pulls from branch osiloke
Feb 21, 2020
9f89767
new changes
Mar 22, 2020
99a028f
migrated changed code to this repo
Mar 22, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 37 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
# ra-data-firestore-client

<!-- [START badges] -->
[![NPM Version](https://img.shields.io/npm/v/ra-data-firestore-client.svg)](https://www.npmjs.com/package/ra-data-firestore-client)
[![License](https://img.shields.io/npm/l/ra-data-firestore-client.svg)](https://github.com/rafalzawadzki/ra-data-firestore-client/blob/master/LICENSE)
[![Downloads/week](https://img.shields.io/npm/dm/ra-data-firestore-client.svg)](https://www.npmjs.com/package/ra-data-firestore-client)
[![Github Issues](https://img.shields.io/github/issues/rafalzawadzki/ra-data-firestore-client.svg)](https://github.com/rafalzawadzki/ra-data-firestore-client)
<!-- [END badges] -->

A Firestore Client for the awesome [react-admin](https://github.com/marmelab/react-admin) framework.
This library is a modified version of [aymendhaya/ra-data-firebase-client](https://github.com/aymendhaya/ra-data-firebase-client)

## For a quick demo:
clone the repo & run
Pull requests are welcome! 🤝

## Features
- [x] Supports all DataProvider request types (`GET_LIST`, `GET_MANY_REFERENCE` etc)
- [x] Sorting, filtering, pagination
- [x] AuthProvider with email/password authentication
- [x] Login enabled to users with admin rights only ([how to set it up](#set-up-admin-account))
- [x] Attaching files (also images) in Base64 to Firestore documents (so react-admin ImageInput & FileInput work)

## Quick demo
Clone the repository & run

```bash
npm install
Expand All @@ -17,22 +33,37 @@ npm run init
```bash
npm run demo
```
## To install & test RestProvider & AuthProvider:
## Use in your project

```bash
npm install ra-data-firestore-client
```
Check [example implementation](https://github.com/rafalzawadzki/ra-data-firestore-client/blob/master/src/demo/App.js).

### Set up admin account
Only the Firebase users with admin flag are able to authenticate on the Login screen.

For AuthProvider, don't forget to add the user UID to your Firestore DB under /users matching the following structure:
To elevate users rights, add a boolean field `isAdmin = true` for a user in a Firestore collection `/users/`, like below:

```bash
"users": {
"UID": {
"<USER_ID>": {
"isAdmin": true
}
}
```

## ra-data-firestore-client also supports `base64` image uploading.
The default collection & field name can be changed by adding `authConfig` object to `AuthProvider` constructor:

```javascript
const authConfig = {
userProfilePath: '/users/',
userAdminProp: 'isAdmin'
};
```

## Known limitations
- [ ] Filtering list by a text query works for _exact_ values only
- [ ] Realtime updates are not implemented yet ([a draft PR is in progress](https://github.com/rafalzawadzki/ra-data-firestore-client/pull/5))
- [ ] No support for Firebase Storage upload
- [ ] Sorting, filtering and pagination are done in memory after fetching all documents from collection ([a draft PR is in progress](https://github.com/rafalzawadzki/ra-data-firestore-client/pull/5))
Loading