unc0ded / ShopEasy

1 stars 0 forks source link

Making POJO model of Vendor #17

Closed shriram-joshi closed 4 years ago

shriram-joshi commented 4 years ago

Today I changed the model of Customer to match the db in my latest commit to mvvm-migration branch. This change includes creating 4 model pojo classes Customer.java, Address.java, Name.java and Credentials.java. These classes were made from http://www.jsonschema2pojo.org/ using the JsonObject string of a Customer from Firestore Database. Ideally we should also convert the Vendor class to fit the database model. This is more efficient as we dont need to create hashmaps to post data of users while registration/updating their details and makes the code for sign up more easy.

shriram-joshi commented 4 years ago

I have completed this will close this issue with the next commit

unc0ded commented 4 years ago

I was thinking maybe the Name and Credentials POJOs aren't needed. I have structured the database like this, I don't think the nesting is necessary.. Screenshot (371) What do you think?

shriram-joshi commented 4 years ago

Yes sure. I'll re-structure it. Not a big deal. Just send me the structure for the vendor and customer and I'll change it accordingly to match the api.

unc0ded commented 4 years ago

Screenshot (373) Screenshot (372)

I hope this is fine. Ignore the id field, mongodb automatically adds it.

shriram-joshi commented 4 years ago

Seems fine just make it in camel case. Like shopname should be shopName so that it matches the java object naming protocol. Because when you convert a Java object to a JsonObject it sets the keys according to the object name in the Pojo

shriram-joshi commented 4 years ago

Also the locality attribute for a Customer is not needed. Check the current Firestore key naming for reference.

unc0ded commented 4 years ago

Seems fine just make it in camel case. Like shopname should be shopName so that it matches the java object naming protocol. Because when you convert a Java object to a JsonObject it sets the keys according to the object name in the Pojo

Done.