Skip to content
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

Practice App: Implementing the POST method for dropping lesson, lesson drop endpoint #174

Closed
8 tasks done
egemenatikk opened this issue May 13, 2022 · 5 comments · Fixed by #178
Closed
8 tasks done
Assignees
Labels
feature New feature practice-app:back-end Related to the back-end of the practice app practice-app Related to the practice app project priority-medium Medium level priority issue Status: Completed Issue is solved

Comments

@egemenatikk
Copy link
Contributor

egemenatikk commented May 13, 2022

Issue Description

We determined the endpoints to be included in the practice app project in our weekly meeting-9.

After the determination of the complete list, we divided the tasks within the team. I took the responsibility for the implementation of a POST method for dropping lesson. To be able to implement the signup endpoint, we need User and Lesson models.

Step Details

Steps that will be performed:

  • Check whether the incoming data is valid
  • Check whether the user and lesson exists
  • Check whether the user takes the lesson
  • Remove the lesson from user's enrollment list and return the user and lesson with a success message
  • Return an error message if an error occurs in any of the previous steps
  • Test the endpoint with Postman
  • Save requests as a collection in Postman
  • Document the endpoint

Final Actions

After I created the drop lesson endpoint, I will test it by using Postman. While testing, I will save my successful and failed requests and I will create a collection in Postman. I will also give the link to the collection under this as a comment to enable anyone to test the endpoint. Finally, I will document the endpoint and will share the documentation as a comment under this issue to add it to the corresponding wiki page in the future.

Deadline of the Issue

15.05.2022 - Sunday - 23:59

Reviewer

Mehmet Batuhan Çelik

Deadline for the Review

16.05.2022 - Monday - 23:59

@egemenatikk egemenatikk added priority-medium Medium level priority issue status-new New issue in initial state practice-app Related to the practice app project practice-app:back-end Related to the back-end of the practice app labels May 13, 2022
@egemenatikk egemenatikk self-assigned this May 13, 2022
@egemenatikk egemenatikk added status-inprogress Issue is currently worked and removed status-new New issue in initial state labels May 13, 2022
@egemenatikk egemenatikk changed the title Practice App: Implementing the POST method for dropping lesson Practice App: Implementing the POST method for dropping lesson, lesson drop endpoint May 15, 2022
@egemenatikk
Copy link
Contributor Author

I added an additional field to User model created in issue #151: enrolledLessons. It is an array consists of ObjectIds, these ObjectIds also references Lesson Collection.

@egemenatikk
Copy link
Contributor Author

egemenatikk commented May 15, 2022

Info

  • I checked the all required fields in the incoming data (user_id, lesson_id).
  • I checked whether given ids are valid or not.
  • I controlled whether a user with the given user_id and a lesson with the given lesson_id exists or not.
  • I controlled whether the user with the given user_id takes the lesson with the given lesson_id or not.
  • I tested the endpoint with Postman, saved the requests, and created a collection.
    Here's the link to the documentation.

@egemenatikk
Copy link
Contributor Author

Handwritten Documentation

  • Endpoint: /user/enrolled/drop
  • Definition: Users will drop lessons they want with their user ids and lesson ids.
  • Query Parameters: None
  • Body Data: user_id: ObjectId, lesson_id: ObjectId and all of them are required
  • Example request body: {
    "user_id": "6280e289fed5174e18c40848",
    "lesson_id": "62800034ba1d9c19fee948e3"
    }
  • Example response body: {
    "resultMessage": "Lesson is successfully dropped.",
    "user": {
    "email": "email1",
    "name": "name1",
    "enrolledLessons": [
    "627fc0d6ba1d9c19fee948c3",
    "627fc0f4ba1d9c19fee948c4"
    ],
    "updatedAt": "2022-05-15T11:26:10.274Z",
    "id": "6280e289fed5174e18c40848"
    },
    "lesson": {
    "name": "lesson4",
    "category_id": "62800034ba1d9c19fee948e3",
    "id": "62800034ba1d9c19fee948e3"
    }
    }

Postman Documentation

@egemenatikk
Copy link
Contributor Author

egemenatikk commented May 15, 2022

I completed all of the steps mentioned in the issue description. I opened a pull request and requested reviews of @mbatuhancelik and @bahricanyesil .

Now, this issue is linked to PR #178 and will be automatically closed after the pull request is merged.

@mbatuhancelik
Copy link
Contributor

Reviewed the implementation under #178

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature practice-app:back-end Related to the back-end of the practice app practice-app Related to the practice app project priority-medium Medium level priority issue Status: Completed Issue is solved
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants