IEEE-VIT / enigma7-backend

Code repository for the backend of Enigma 7.0
https://enigma-api.ieeevit.org
MIT License
3 stars 0 forks source link

Add UserStatus fields to the user response #25

Closed aryan9600 closed 4 years ago

aryan9600 commented 4 years ago

Is your feature request related to a problem? Please describe. The client needs to know the status of the user (for eg: whether the hint has been used or not), in order to render UI accordingly.

Describe the solution you'd like Add the UserStatus fields in the response, by creating a nested serializer.

hsrambo07 commented 4 years ago

I didn't get it, can u explain a bit more about it.

aryan9600 commented 4 years ago

The User and UserStatus are linked to each other via a foreign key. When the client hits /api/v1/users/me, along with returning the fields in the User table such as email, username, points, etc. we also need to return the fields in the UserStatus table for that user. For serializing data which involves relationships we generally use a nested serializer approach.