| [2e0035f] | 1 | ### Nutritioneer - click the green arrows in IntelliJ, top to bottom.
|
|---|
| 2 | ### The token from step 2 is captured into a variable and reused.
|
|---|
| 3 |
|
|---|
| 4 | @host = http://localhost:8080
|
|---|
| 5 |
|
|---|
| 6 | ### 1. Register a fresh account (409 if you run it twice - that is correct)
|
|---|
| 7 | POST {{host}}/api/auth/register
|
|---|
| 8 | Content-Type: application/json
|
|---|
| 9 |
|
|---|
| 10 | { "email": "test.user@example.com", "username": "test_user", "password": "testPass@1" }
|
|---|
| 11 |
|
|---|
| 12 | ### 2. Log in as a seeded account
|
|---|
| 13 | # @name login
|
|---|
| 14 | POST {{host}}/api/auth/login
|
|---|
| 15 | Content-Type: application/json
|
|---|
| 16 |
|
|---|
| 17 | { "email": "marija.trajkovska@gmail.com", "password": "testPass@1" }
|
|---|
| 18 |
|
|---|
| 19 | > {% client.global.set("token", response.body.token); %}
|
|---|
| 20 |
|
|---|
| 21 | ### 3. The public feed
|
|---|
| 22 | GET {{host}}/api/posts/feed
|
|---|
| 23 | Authorization: Bearer {{token}}
|
|---|
| 24 |
|
|---|
| 25 | ### 4. UC1001 - create a recipe. No kcal is sent; the server derives it.
|
|---|
| 26 | # @name newRecipe
|
|---|
| 27 | POST {{host}}/api/recipes
|
|---|
| 28 | Authorization: Bearer {{token}}
|
|---|
| 29 | Content-Type: application/json
|
|---|
| 30 |
|
|---|
| 31 | {
|
|---|
| 32 | "name": "Test Bean Stew",
|
|---|
| 33 | "guide": "1. Boil the beans.\n2. Fry the onion.\n3. Combine and bake.",
|
|---|
| 34 | "servings": 4,
|
|---|
| 35 | "ingredients": [
|
|---|
| 36 | { "ingredientName": "Dry white beans", "quantity": 400 },
|
|---|
| 37 | { "ingredientName": "Onion", "quantity": 150 },
|
|---|
| 38 | { "ingredientName": "Olive oil", "quantity": 30 }
|
|---|
| 39 | ],
|
|---|
| 40 | "restrictionIds": []
|
|---|
| 41 | }
|
|---|
| 42 |
|
|---|
| 43 | > {% client.global.set("recipeId", response.body.id); %}
|
|---|
| 44 |
|
|---|
| 45 | ### 5. UC1004 - share it. Running this twice returns 409 (uq_post_recipe).
|
|---|
| 46 | POST {{host}}/api/posts
|
|---|
| 47 | Authorization: Bearer {{token}}
|
|---|
| 48 | Content-Type: application/json
|
|---|
| 49 |
|
|---|
| 50 | { "recipeId": {{recipeId}}, "isPrivate": false, "isFavourite": false, "status": "published" }
|
|---|
| 51 |
|
|---|
| 52 | ### 6. UC1002 - log a meal (attach post id 1 from the seed data)
|
|---|
| 53 | POST {{host}}/api/planner
|
|---|
| 54 | Authorization: Bearer {{token}}
|
|---|
| 55 | Content-Type: application/json
|
|---|
| 56 |
|
|---|
| 57 | { "notes": "Smoke test lunch", "postIds": [1], "consumed": true }
|
|---|
| 58 |
|
|---|
| 59 | ### 7. Daily totals
|
|---|
| 60 | GET {{host}}/api/planner/daily?from=2026-01-20&to=2026-02-05
|
|---|
| 61 | Authorization: Bearer {{token}}
|
|---|
| 62 |
|
|---|
| 63 | ### 8. UC1003 - grocery list from a recipe plus one item
|
|---|
| 64 | POST {{host}}/api/grocery-lists
|
|---|
| 65 | Authorization: Bearer {{token}}
|
|---|
| 66 | Content-Type: application/json
|
|---|
| 67 |
|
|---|
| 68 | {
|
|---|
| 69 | "notes": "Smoke test list",
|
|---|
| 70 | "bulkRecipeIds": [1],
|
|---|
| 71 | "singleItems": [{ "ingredientName": "Apple", "buyQuantity": 1000 }]
|
|---|
| 72 | }
|
|---|
| 73 |
|
|---|
| 74 | ### 9. Biometrics
|
|---|
| 75 | POST {{host}}/api/biometrics
|
|---|
| 76 | Authorization: Bearer {{token}}
|
|---|
| 77 | Content-Type: application/json
|
|---|
| 78 |
|
|---|
| 79 | { "date": "2026-02-02", "weight": 72.0, "height": 168, "age": 29, "muscleFatRatio": 1.97 }
|
|---|
| 80 |
|
|---|
| 81 | ### 10. Should be 403 - a regular user is not an administrator
|
|---|
| 82 | GET {{host}}/api/admin/accounts
|
|---|
| 83 | Authorization: Bearer {{token}}
|
|---|
| 84 |
|
|---|
| 85 | ### 11. Log in as the trainer
|
|---|
| 86 | # @name trainerLogin
|
|---|
| 87 | POST {{host}}/api/auth/login
|
|---|
| 88 | Content-Type: application/json
|
|---|
| 89 |
|
|---|
| 90 | { "email": "viktor.ilievski@nutritioneer.mk", "password": "testPass@1" }
|
|---|
| 91 |
|
|---|
| 92 | > {% client.global.set("trainerToken", response.body.token); %}
|
|---|
| 93 |
|
|---|
| 94 | ### 12. UC3001 - client weekly intake
|
|---|
| 95 | GET {{host}}/api/trainer/clients/marija.trajkovska@gmail.com/intake?from=2026-01-22&to=2026-01-29
|
|---|
| 96 | Authorization: Bearer {{trainerToken}}
|
|---|
| 97 |
|
|---|
| 98 | ### 13. UC3004 - protein density ranking
|
|---|
| 99 | GET {{host}}/api/trainer/analysis/nutrient-density?nutrient=Protein&limit=5
|
|---|
| 100 | Authorization: Bearer {{trainerToken}}
|
|---|
| 101 |
|
|---|
| 102 | ### 14. UC3003 - feed filtered by restriction
|
|---|
| 103 | GET {{host}}/api/posts/feed/by-restriction?type=gluten_free&avoid=Contains tree nuts
|
|---|
| 104 | Authorization: Bearer {{trainerToken}}
|
|---|