I have to create a CRUD, which is generated automatically depending on the area we are using.
In the database found in Firebase, all the collections have a document, called 000description
, in which it has all the fields we need. In its description it has whether or not it can be empty, data type, yes Whether or not it is unique, if we need it to take the information from another collection and finally what this field contains.
Example:
City {Not empty, String, Not unique, NoForeignkey, Write the city of the client}
Now, for example, if I go to the company section, the code must go to firebase, see how many fields the document 000description
has, create a form with the fields and the data type, and put the description of the field in the hint.
If I go to employees, I should do exactly the same, and so on in each of the collections I have.
I have the idea of how to do it, but I haven’t tried anything and I need someone to guide me a little more.
2
Answers
if i am correct you want to read data from firebase and based on that you want to pass values to you form like hints for various fields ?
if so then tack a look at the following
One possible solution would be to have a generic class
FireCrudRepository
which need to be instantiated wherever you need to get access to a specific collection.I would recommend having specific implementations, one for each type collection, which could be implemented as Singleton’s.
Then use it this way: