scenerios - bounswe/bounswe2025group5 GitHub Wiki
Sample Usage Scenarios
Scenario 1: Reporting Content
- Endpoint:
POST /api/reports
- Scenario Description: A user reports a post, suspecting that it is a spam
- The Request:
curl -X POST "https://waste-less.alibartukonca.org/api/reports" \
-H "Authorization: Bearer USER_JWT_TOKEN" \
-H "Content-Type: application/json"
-d '{
"reporterName": "cengizbilalsari2",
"description": "Such a bad post",
"type" : "Spam",
"contentType": "Post",
"objectId": 1
}'
{
"success": true
}
Scenario 2: Deleting Content Based on a Report
- Endpoint:
PUT /api/reports/{username}/{id}/delete-flag
- Scenario Description: A moderator marks the report as deletion, meaning that the content that is reported will be deleted
- The Request:
curl -X PUT "https://waste-less.alibartukonca.org/api/reports/CuriousBartu/64/delete-flag" \
-H "Authorization: Bearer ADMIN_JWT_TOKEN" \
-H "Content-Type: application/json"
{
"success": true,
"id": 64
}
Scenario 3: Elastic Search
- Endpoint:
PUT /api/forum/search/semantic?username={username}&query={query}
- Scenario Description: A user makes a search based on waste type.
- The Request:
curl -X PUT "https://waste-less.alibartukonca.org/api/forum/search/semantic?username=CuriousBartu&query=Plastic" \
-H "Authorization: Bearer USER_JWT_TOKEN" \
-H "Content-Type: application/json"
[
{
"postId": 4,
"content": "No more paper or plastic cups. From now on, refill and reuse.",
"createdAt": "2025-10-20T16:51:07.000+00:00",
"likes": 17,
"creatorUsername": "alcala.kelsy",
"photoUrl": "https://waste-less-photo-storage-2.sfo3.digitaloceanspaces.com/post/no_more_plastic.png",
"comments": 2,
"liked": true,
"saved": false,
"profile_picture": "https://waste-less-photo-storage-2.sfo3.digitaloceanspaces.com/profile/d3ddf72e-3afd-4ae3-99e3-addd077b9063.jpeg"
},
...
{
"postId": 73,
"content": "Riding green and recycling clean! ?♂️ Glass bottles ready to find a new life.",
"createdAt": "2025-11-25T10:29:41.000+00:00",
"likes": 25,
"creatorUsername": "daimar_morreno_",
"photoUrl": "https://waste-less-photo-storage-2.sfo3.digitaloceanspaces.com/post/01bb0ebc-f5e3-462b-a1bb-20fa09333f42.webp",
"comments": 1,
"liked": false,
"saved": false,
"profile_picture": "https://waste-less-photo-storage-2.sfo3.digitaloceanspaces.com/profile/7df0b0ed-fb98-4836-9793-94e0ba708d87.webp"
}
]