anitab-org / mentorship-backend

Mentorship System is an application that matches women in tech to mentor each other, on career development, through 1:1 relations during a certain period of time. This is the backend of this system.
https://mentorship-backend-temp.herokuapp.com/
GNU General Public License v3.0
196 stars 449 forks source link

Enhancement: Use Enum Representation in Mentorship Relation #1143

Open devkapilbansal opened 3 years ago

devkapilbansal commented 3 years ago

Description

I want to ensure that the database queries are fast and take less space for storage.

https://github.com/anitab-org/mentorship-backend/blob/8924616fa20d5d37026f48ef1481e00932622b2a/app/api/dao/mentorship_relation.py#L139

In the code above :point_up: , we are using string values for relation state which should be avoided.

Definition of Done

Estimation

5-6 hours

msaini28r commented 2 years ago

I would like to work on this issue. can you suggest me some hints?

devkapilbansal commented 2 years ago

Sure @msaini0r

Here, you will have to use numerical mapping of values with valid_states. Currently, we are storing string values that should be converted to 0,1,2... to save space

Check this file to have a clear idea of what is needed :point_down: https://github.com/anitab-org/mentorship-backend/blob/develop/app/utils/enum_utils.py

vj-codes commented 2 years ago

Unassigning @msaini0r due to inactivity

mariejp commented 2 years ago

Hello! Is this issue still available? If so, i would like to work on it!

ciheanyi commented 2 years ago

Hi! I also sent a message in the Zulip, but am I able to be assigned to work on this issue?

ciheanyi commented 2 years ago

Hi! Thanks so much for assigning, so I finished writing the code for the enum 🥳 and I was wondering how I can go about testing before I request to push. I was a bit confused if there was some sort of suite or ready made test cases, if anybody could direct me to the right place!

epicadk commented 2 years ago

Can you open a pr so we can help you out?

ciheanyi commented 2 years ago

Whoops, realized I put this in my request not here. @epicadk @isabelcosta

But just dropping this again for a review for the pull request. I also think there may be some software updates required that are causing the unit tests to fail, I believe markup may have recently moved to a new version that causes jinja2 to fail. When we downgraded the libraries locally, the unit tests ran successfully.