-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: create GET/mentorship_relations API #168
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@khushishikhu , it's best to create a new file for this task (you can call it mentorship_relations.py) instead of using the users.py
. Also, please check my comment below.
app/api/resources/users.py
Outdated
per_page = request.args.get("per_page", default=DEFAULT_USERS_PER_PAGE, type=int) | ||
|
||
|
||
return http_response_checker(get_request("/users/verified", token)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this retuning verified users and not mentorship rrelations the login user?
@mtreacy002 i think we need to add the file mentorship_relation.py in the folder |
|
@khushishikhu , you also need to add the new mentorship_relation to the namespace so you can use it as |
@khushishikhu , can you please give me an update on this issue? |
@mtreacy002 sorry for not updating you, i am still working on the issue , will update you in 2-3 days |
No worries, @khushishikhu. Let me know if you need any help 😉. |
|
Thanks, @khushishikhu . I'll review this PR today |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@khushishikhu. There are a couple of things need to be modified on this PR. Also, just want to make sure you understand the task involve in this PR.
- BIT is using existing mentorship_relation of MS System when creating a relation between program and mentor/mentee. Along with this, BIT also create an instance of mentorship_relations_extension which holds that specific information related to BIT that MS doen't have in its mentorship_relation table. When getting information on mentorship relation, the GET /mentorship_relations request will be sent to MS backend, and the response will be matched to the list of objects on mentorship_relations_extension so that an array of objects that contains info on both tables can be returned to user.
At the moment, the code you provided here are duplication of MS backend for mentorship relation. - the focus of this PR is on GET mentorship_relations endpoint, not creating the mentorship relation itself. Since the issue Feat: create POST /organizations /{organization_id} /programs/{program_id} /send_request #161 is still in progress (meaning you won't be able to show HTTPStatus.OK on the GET request) you can still work on error responses first like
Not Found
,Internal Server Error
orUnauthorized
responses.
Let me know if you need any help.
@mentorship_relation_ns.marshal_list_with(mentorship_request_response_body) | ||
def get(cls): | ||
""" | ||
Lists all mentorship relations of current user. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thankyou for letting me i was just confused for what needs to show
MAXIMUM_MENTORSHIP_DURATION = timedelta(weeks=24) # 6 months = approximately 6*4 | ||
MINIMUM_MENTORSHIP_DURATION = timedelta(weeks=4) | ||
|
||
def create_mentorship_relation(self, user_id: int, data: Dict[str, str]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need to duplicate the DAO functionality already existed in Mentorship System Backend for creating mentorship_relation instance. You only need to send GET request to the MS Backend for this. On the BIT side you need to create the dao functionality related to Mentorship Relation Extension table that belongs to bitschema (hence, the name of the file also will reflect the content, mentorship_relation_extension.py
- under the dao folder only). Although, the function you need to focus on this PR is only the get
functionality (not create
) since the create function will be dealt with in other issue (#161).
@mtreacy002 sorry i just got busy in some other work. i will give you an update on this at the EOD. |
@mtreacy002 i have made the error responses like |
Sorry for the late reply, @khushishikhu. Sure, I'll check it out. If need to, I will create a separate PR for status OK which will be made available when issue #161 is finalised and will just review this PR based on the specific error responses you've created here. Will let you know. |
Description
added GET/mentorship_relations API endpoints
Fixes #162
Type of Change:
Checklist: