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
,accountData
andpermissions
?or is there any way to use
IResponse
to store common elements likestatus
,message
anddata
and then use only for relevant feature. -
Not sure whether it is allowed to share entities in between the features. Like
user
block below can be a feature inAuthorization
andEmployee
{ "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