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

Why not use repository layer to access firestore ? #1

Open
rubensdemelo opened this issue Apr 6, 2020 · 3 comments
Open

Why not use repository layer to access firestore ? #1

rubensdemelo opened this issue Apr 6, 2020 · 3 comments

Comments

@rubensdemelo
Copy link

Why not use repository layer to access firestore ?

@KenAragorn
Copy link
Owner

Hi @rubensdemelo,

Thanks for the inquiry.

Actually we are using repository layer. Let me explain.

If you look at the class FirestoreService, it contains all generic CRUD operation.
For example:
Creating/Updating a document: Future setData(...)
Deletion: Future deleteData(...)
Getting a list of collection: Stream<List> collectionStream({..._
However, all the above is generic, and don't need to hard-corded any document path. So, in my view, the FirestoreService is a Repository.

For FirestoreDatabase, it is the actual Service layer representative that expose additional business logic, which uses Repository.

So, in future, lets say we added a new section and a new document for user to store images, I can create a separate collection and new methods in FirestoreDatabase without touching the FirestoreService.

Perhaps a better ways that we can improve the code, is to refactor the class name from FirestoreService to FirestoreRepository and make it as an Abstract class that contains basic CRUD method that any sub-class can access it.
And then, the class FirestoreDatabase will extends the renamed FirestoreRepository to access the method.

Still, I would like to hear more from you and see area that can further improve (future roadmap). :)

@rubensdemelo
Copy link
Author

Thank you for clarification. Appreciate.

@KenAragorn
Copy link
Owner

Most welcome. :)

Side note, I have updated the project - now it support multi-language control, which is also commonly used and needed for any app. Please refer to the updated README.md.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants