Skip to content

Commit

Permalink
triaging old pull requests 2
Browse files Browse the repository at this point in the history
  • Loading branch information
vj-codes authored Oct 1, 2022
2 parents 6c33f18 + 48fedf4 commit d878a01
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions app/api/resources/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
add_models_to_namespace(task_ns)


@task_ns.route("mentorship_relation/<int:request_id>/task")
@task_ns.route("mentorship_relation/<int:relation_id>/task")
class CreateTask(Resource):
@classmethod
@jwt_required
Expand All @@ -42,13 +42,13 @@ class CreateTask(Resource):
HTTPStatus.FORBIDDEN.value,
f"{messages.USER_NOT_INVOLVED_IN_THIS_MENTOR_RELATION}",
)
def post(cls, request_id):
def post(cls, relation_id):
"""
Create a task for a mentorship relation.
Input:
1. Header: valid access token
2. Path: ID of request for which task is being created (request_id)
2. Path: ID of request for which task is being created (relation_id)
3. Body: JSON object containing description of task.
Returns:
Expand Down Expand Up @@ -100,14 +100,14 @@ class DeleteTask(Resource):
f"{messages.MENTORSHIP_RELATION_DOES_NOT_EXIST}\n"
f"{messages.TASK_DOES_NOT_EXIST}",
)
def delete(cls, request_id, task_id):
def delete(cls, relation_id, task_id):
"""
Delete a task.
Input:
1. Header: valid access token
2. Path: ID of the task to be deleted (task_id) and it ID of the associated
mentorship relation (request_id).
mentorship relation (relation_id).
3. Body: JSON object containing description of task.
Returns:
Expand All @@ -119,13 +119,13 @@ def delete(cls, request_id, task_id):
user_id = get_jwt_identity()

response = TaskDAO.delete_task(
user_id=user_id, mentorship_relation_id=request_id, task_id=task_id
user_id=user_id, mentorship_relation_id=relation_id, task_id=task_id
)

return response


@task_ns.route("mentorship_relation/<int:request_id>/tasks")
@task_ns.route("mentorship_relation/<int:relation_id>/tasks")
class ListTasks(Resource):
@classmethod
@jwt_required
Expand All @@ -146,14 +146,14 @@ class ListTasks(Resource):
@task_ns.response(
HTTPStatus.NOT_FOUND.value, f"{messages.MENTORSHIP_RELATION_DOES_NOT_EXIST}"
)
def get(cls, request_id):
def get(cls, relation_id):
"""
List all tasks from a mentorship relation.
Input:
1. Header: valid access token
2. Path: ID of the mentorship relation for which tasks are to be
displayed(request_id). The user must be involved in this relation.
displayed(relation_id). The user must be involved in this relation.
Returns:
JSON array containing task details as objects is displayed on success.
Expand All @@ -164,7 +164,7 @@ def get(cls, request_id):
user_id = get_jwt_identity()

response = TaskDAO.list_tasks(
user_id=user_id, mentorship_relation_id=request_id
user_id=user_id, mentorship_relation_id=relation_id
)

if isinstance(response, tuple):
Expand All @@ -173,7 +173,7 @@ def get(cls, request_id):
return marshal(response, list_tasks_response_body), HTTPStatus.OK


@task_ns.route("mentorship_relation/<int:request_id>/task/<int:task_id>/complete")
@task_ns.route("mentorship_relation/<int:relation_id>/task/<int:task_id>/complete")
class UpdateTask(Resource):
@classmethod
@jwt_required
Expand All @@ -194,14 +194,14 @@ class UpdateTask(Resource):
HTTPStatus.NOT_FOUND.value,
f"{messages.MENTORSHIP_RELATION_DOES_NOT_EXIST}\n{messages.TASK_DOES_NOT_EXIST}",
)
def put(cls, request_id, task_id):
def put(cls, relation_id, task_id):
"""
Update a task to mark it as complate
Input:
1. Header: valid access token
2. Path: ID of task (task_id) and ID of the associated mentorship
relation (request_id). The user must be involved in this relation.
relation (relation_id). The user must be involved in this relation.
3. Body:
Returns:
Expand All @@ -213,7 +213,7 @@ def put(cls, request_id, task_id):
user_id = get_jwt_identity()

response = TaskDAO.complete_task(
user_id=user_id, mentorship_relation_id=request_id, task_id=task_id
user_id=user_id, mentorship_relation_id=relation_id, task_id=task_id
)

return response

0 comments on commit d878a01

Please sign in to comment.