Comments (6)
@SonicWolfMan no worries, it's out there to help.
So the reason the chores are per user is because they are private and other users cannot access chores that are not theirs. And it was implemented this way to show how one would implement private stores in Firebase per user using Angular 2.
But I am unsure what you are asking here.
If you want to still have users signing in but you want then to share chores, you would need to implement some kind of grouping and organize data in Firebase in such a manner that you can grab all chores that belong to the group the user is part of instead of the chores that belong to the user.
The above is slightly more complicated to implement. But if you want to have all chores public and you do not care what is user is authenticated, you can remove that user key. And if you do not want any auth, you can remove all the user and auth related logic as well.
from angular-lab.
You are correct. In the end there are 3 possible outcomes.
- Private (the way your code is setup now)
- Public (removing the user info)
- Shared
Originally in my question I was describing the Public option. However, in the end what I'm aiming for is the shared option. As you stated, this is going to be slightly more complicated to implement. In addition I'm planning on adding the concept of each user having multiple todo lists. Thanks again!
from angular-lab.
Another question. I'm trying to create the concept of multiple named todo lists. Essentially trying to create:
- ChoreGroups
- MyChores
I'm looking the services.ts file and am wondering how to change it. Setting up ChoreGroups is easy in that it is the same access pattern as Chores is now in your code. However, I'm wondering about retrieving the list of MyChores based upon a selected ChoreGroup. Is it even possible to pass a key as a parameter to services.ts? Does that even make sense? If it is possible, what would that look like?
Thanks
from angular-lab.
Well, you should look at flattening your data structure a bit, something that I did not do properly in the first place as I was in a rush.
But ideally you would have something like:
{
groups: {
test: {
members: {
one: true
}
}
},
users: {
one: {
groups: {
test: true
}
}
},
chores: {
<identifier>: {
user: 'one',
groups: {
test: true
}
}
}
}
And then you would filter your chores both by the user and the groups it belongs to. Sorting by the user is pretty easy:
let root = new Firebase('your firebase app link');
let query = root.child('/chores').orderByChild('user').equalTo(userRef.key()) // userRef is the ref to the authenticated user
After this you can listen on the ref and further filter by groups. Or you can directly filter by groups and have your security rules not allow reads on the chores that the user property value is not the same as the user that us currently authenticated.
As you can see, there are many ways of going at this, but I cannot tell you how exactly to change the code as I would have to take the time to do it myself and see what works best.
I hope this helps a bit though.
from angular-lab.
Thanks, that was very helpful!
from angular-lab.
I'll close this. You can use the gitter channel for further questions.
from angular-lab.
Related Issues (20)
- fix: unit tests are not working
- chore: use JSPM as package manager
- feat: use trackBy
- chore: simplify gulpfile
- feat: use HTTP interceptors HOT 1
- chore: use karma-jspm to run unit tests HOT 1
- fix: app is broken
- feat: use lazy loading routes HOT 1
- feat: use codelyzer
- feat: upgrade to Angular 2 RC5
- chore: dump JSPM in favour of npm
- chore: use @types in favour of @typings
- I might be missing something in the docs but I am having problems with gulp HOT 2
- feat: deploy to Firebase
- fix: e2e tests cannot run HOT 2
- chore: switch back to Yarn HOT 1
- fix: HTTP requests are not allowed on Firebase
- fix: e2e tests fail on most browsers
- feat: use GraphQL HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-lab.