Example of a master-detail application based on springboot that uses as a backend google firebase for managing a user with its roles. It was implemented a generic dao for the CRUD operations with the firebase database. It uses pagination as well. I'm using insomia as a rest services client.
- I'm creating the user without his roles yet. The primary key value is empty, because is given by firebase. You can see the attribute called cod_id_user with the value provided by the database in the response.
- You can see now, how the user was created on Firebase.
- You also can create the user with his roles.
- You can see now, how the user with his roles was created on Firebase.
- I'm updating the username and lastname. I'm just adding the word updated at the end of each value.
- For the calling, it's mandatory to specify the primary key value (cod_id_user).
- For the calling, it's mandatory to specify the primary key value (cod_id_user) in the variable called documentId.
- It returns all users.
- For this example, you will find out that the url is api/user/get/paged/1/2, where 1 means that you are requesting the first page and the number 2 means: only brings two users.
- For this example ../api/user/update/rol/db5344be-4fd1-46e1-929e-f207f1f28215/false, you will find out that db5344be-4fd1-46e1-929e-f207f1f28215 is the primary key and /false means if you want to delete a role. Thus, I'm reusing this calling to add and remove roles to an user.
- You can see the effects on firebase as follows:
- For this example ../api/user/update/rol/db5344be-4fd1-46e1-929e-f207f1f28215/true, you will find out that db5344be-4fd1-46e1-929e-f207f1f28215 is the primary key and /true means that you want to delete a role. Thus I'm reusing this calling to add and remove roles to an user.
- You can see the effects on firebase as follows: