For my new project in flutter, I am trying to follow the Clean Architecture and diving each different feature in domain, data and presentation`.
Now, I have initiated with the Authentication feature where I have started creating the Entities however, I am pretty much confused and stuck on how to modularize the code based on the Clean Architecture practice.
For example,
The response of my login service is as follow,
-
so do I need to create entities and models for all JSON nested objects like for
response,data,user,accountDataandpermissions?or is there any way to use
IResponseto store common elements likestatus,messageanddataand then use only for relevant feature. -
Not sure whether it is allowed to share entities in between the features. Like
userblock below can be a feature inAuthorizationandEmployee
{ "status": "success", "message": "successfully login", "data": { "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NywiaXNMb2dnZWRJbiI6dHJ1ZSwidGVuYW50SWQiOjEyLCJpYXQiOjE2MjU5OTE5MTAsImV4cCI6MTYyNjA3ODMxMH0.I0z9OIDnQS-MI1ya6usqycoryZ1TBwj3K52BRfrpMuY", "user": { "user_id": 7, "email": "jd@gmail.com", "first_name": "John", "last_name": "Doe", "phone": "", "date_of_birth": "2015-08-06T00:00:00.000Z", }, "accountData": { "name": "Amazon", "account_id": 1 }, "permissions": [ "ViewAllEmployee", "AddNewEmployee" ] } }
Aucun commentaire:
Enregistrer un commentaire