-
Notifications
You must be signed in to change notification settings - Fork 8
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 POST Category endpoint #165
Comments
Regarding checking if a category already exists: One problem we encounter is that user may describe categories in several different ways. For example both "Node js" and "node.js" perfectly describe Node.js but we do not want to allow duplicates. Yet another issue is that, user may input the category's name wrong, as illustration he/she can input "noode js" In meeting 9, we discussed about using wikipedia API for category description and decided to use it if it was not complex. I checked the API and it was really intuitive with examples, thus I decided to use it both for standardizing categories. For example, when all these 3 representations of Node.js are searched in wiki API, it returns "Node.js" for all of them, thus all three representations are mapped to one title. |
Further exploring the wikipedia API, once we standardized category titles using wikipedia search, it is fairly easy to get a description from wikipedia too! I will be adding this functionality. |
I now created a prototype and pushed the development up to this point to branch related to this issue. |
I made the last changes to the endpoint and tested it using postman, here is the postman collection used for testing: {
"info": {
"_postman_id": "28da51cf-ee65-4eaa-9488-5e2573d634ff",
"name": "api/category",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "create new category",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"title\" : \"computer vision\"\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "localhost:3000/api/category",
"host": [
"localhost"
],
"port": "3000",
"path": [
"api",
"category"
]
}
},
"response": []
},
{
"name": "Incorrect title",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"title\" : \"a\"\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "localhost:3000/api/category",
"host": [
"localhost"
],
"port": "3000",
"path": [
"api",
"category"
]
}
},
"response": []
},
{
"name": "creating already exiting cagegory",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"title\" : \"artificial intelligence\"\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "localhost:3000/api/category",
"host": [
"localhost"
],
"port": "3000",
"path": [
"api",
"category"
]
}
},
"response": []
}
]
}
and here are the results(since we have not a common postman project yet): |
Postman documentation can be found here |
A PR is created for implementation of this issue and it is ready for a review from @codingAku and @surmelienes1 |
Issue Description
As discussed in meeting 9 we are to add following endpoints regarding categories:
POST /category : creates a new category and returns it upon completion.
And this issue is about creating this endpoint.
As the development for category model continues under #163, I will begin implementing endpoints regarding categories using the prototype I proposed.
Step Details
Steps that will be performed:
Final Actions
After POST endpoint is created, it should be tested using postman and a collection shall be created using those tests, additionally unit tests should be created, and a GET endpoint for categories should be implemented.
Deadline of the Issue
07.05.2022 - Saturday - 23:59
Reviewer
Muhammed Enes Sürmeli
Ecenur Sezer
Deadline for the Review
08.05.2022 - Sunday - 23:59 PM
The text was updated successfully, but these errors were encountered: