| 4 | | === ЕР Модел - концепт на проектот |
| 5 | | [[Image(Nutritioneer_ER_201165.png, 75%)]] |
| 6 | | === Ентитети |
| | 3 | [[Image(Nutritioneer_ER_201165_v.1.png, 80%)]] |
| | 4 | === Ентитети и табели |
| | 5 | |
| | 6 | User – сите корисници на целиот систем |
| | 7 | • email (PK, text, not nullable) |
| | 8 | • username (text, not nullable) |
| | 9 | • password (text, not nullable) |
| | 10 | • role (enum, not nullable) |
| | 11 | o User, Administrator, Trainer |
| | 12 | |
| | 13 | Recipe – сите рецепти и нивни информации |
| | 14 | • id (PK, bigint, not nullable) |
| | 15 | • name (text, not nullable) |
| | 16 | • guide (text, not nullable) |
| | 17 | • kcal_sum (numeric, not nullable) |
| | 18 | |
| | 19 | Ingredient – сите намирници и состојки |
| | 20 | • name (PK, text, not nullable) |
| | 21 | • description (text, not nullable) |
| | 22 | • energy (numeric, not nullable) |
| | 23 | • kcal (numeric, not nullable) |
| | 24 | • type (enum, not nullable) |
| | 25 | o Dairy, Meat, Fish, Herb, Carb, Vegetable, Fruit, Other, … |
| | 26 | |
| | 27 | Nutrient – различните хранливи материи кои се неопходни |
| | 28 | • id (PK, bigint, not nullable) |
| | 29 | • quantity (numeric, not nullable) |
| | 30 | • description (text, not nullable) |
| | 31 | • unit (enum, not nullable) |
| | 32 | o Milligram, gram, microgram |
| | 33 | • type (enum, not nullable) |
| | 34 | o Macro-nutrient, Micro-nutrient |
| | 35 | |
| | 36 | Restriction – хранлива рестрикција од различна сфера на секојдневието |
| | 37 | • id (PK, bigint, not nullable) |
| | 38 | • description (text, not nullable) |
| | 39 | • type (enum, not nullable) |
| | 40 | o Vegan, Vegetarian, Halal, Kosher, Pescatarian, Allergens, Keto, … |
| | 41 | |
| | 42 | Post – ентитет кој ке го содржи секој пост на апликацијата |
| | 43 | • id (PK, bigint, not nullable) |
| | 44 | • media (blob, nullable) |
| | 45 | • isPrivate (Boolean, not nullable) |
| | 46 | • isFavourite (Boolean, not nullable) |
| | 47 | • created_by (FK, bigint, not nullable) |
| | 48 | • status (enum, not nullable) |
| | 49 | o Published, Draft, Archived |
| | 50 | |
| | 51 | Comment – ентитет за коментарите присутни на постовите |
| | 52 | • id (PK, bigint, not nullable) |
| | 53 | • description (text, not nullable) |
| | 54 | • post_id (FK, bigint, not nullable) |
| | 55 | • created_by (FK, bigint, not nullable) |
| | 56 | |
| | 57 | Grocery_List – ентитет за пазарната листа со два начини на вметување записи |
| | 58 | • id (PK, bigint, not nullable) |
| | 59 | • date_time (timestamp, not nullable) |
| | 60 | • notes (text, nullable) |
| | 61 | • isBought (Boolean, not nullable) |
| | 62 | • kcal (numeric, not nullable) |
| | 63 | • user_id(FK, bigint, not nullable) |
| | 64 | |
| | 65 | Intake_Planner – записи за логирање исхрана и создавање meal-plan |
| | 66 | • id (PK, bigint, not nullable) |
| | 67 | • date_time (timestamp, not nullable) |
| | 68 | • notes (text, nullable) |
| | 69 | • kcal (numeric, not nullable) |
| | 70 | • isConsumed (Boolean, not nullable) |
| | 71 | • user_id (FK, bigint, not nullable) |
| | 72 | |
| | 73 | Biometrics – биометрички податоци сместени во ентитет за компаративна анализа |
| | 74 | • id (PK, bigint, not nullable) |
| | 75 | • date(date, not nullable) |
| | 76 | • weight (numeric, nullable) |
| | 77 | • height (numeric, nullable) |
| | 78 | • age (numeric, nullable) |
| | 79 | • muscle_fat_ratio (numeric, nullable) |
| | 80 | • user_id (FK, bigint, not nullable) |
| | 81 | |
| | 82 | ===Релациски табели |
| | 83 | |
| | 84 | Recipe_Contains_Ingeredient |
| | 85 | • recipe_id (FK, bigint, non nullable) |
| | 86 | • ingredient_name (FK, text, non nullable) |
| | 87 | • ingredient_quantity (numeric, non nullable) |
| | 88 | • PK (recipe_id, ingredient_name) |
| | 89 | |
| | 90 | Ingredient_Contains_Nutrient |
| | 91 | • ingredient_name (FK, text, non nullable) |
| | 92 | • nutrient_id (FK, bigint, non nullable) |
| | 93 | • quantitiy (numeric, non nullable) |
| | 94 | • PK (ingredient_name, nutrient_id) |
| | 95 | |
| | 96 | Recipe_Contains_Restriction |
| | 97 | • restriction_id (FK, bigint, non nullable) |
| | 98 | • recipe_id (FK, bigint, non nullable) |
| | 99 | • PK (recipe_id, restriction_id) |
| | 100 | |
| | 101 | Grocery_List_Bulk_Add_Ingredient |
| | 102 | • list_id (FK, bigint, non nullable) |
| | 103 | • recipe_id (FK, bigint, non nullable) |
| | 104 | • PK (list_id, recipe_id) |
| | 105 | |
| | 106 | Grocery_List_Single_Add_Ingredient |
| | 107 | • list_id (FK, bigint, non nullable) |
| | 108 | • ingredient_name (FK, text, non nullable) |
| | 109 | • buy_quantity (numeric, non nullable) |
| | 110 | • PK (list_id, ingredient_name) |
| | 111 | |
| | 112 | Intake_Planner_save_to_list_Post |
| | 113 | • planner_id (FK, bigint, not nullable) |
| | 114 | • post_id (FK, bigint, not nullable) |
| | 115 | • PK (planner_id, post_id) |
| | 116 | |
| | 117 | === Релации |
| | 118 | USER creates POST | 1:N |
| | 119 | POST has COMMENT | 1:N |
| | 120 | USER posts_on COMMENT | 1:N |
| | 121 | INTAKE_PLANER save_to_list POST | M:N |
| | 122 | USER create RECIPE 1:N |
| | 123 | USER record_intake INTAKE_PLANNER | 1:N |
| | 124 | USER record BIOMETRICS | 1:N |
| | 125 | RECIPE contains INGREDIENT | M:N |
| | 126 | GROCERY_LIST add_bulk_ingedients INGREDIENT (from RECIPE) | M:N |
| | 127 | GROCERY_LIST add_single_ingredient IGREDIENT | M:N |
| | 128 | INGREDIENT contains NUTRIENT | M:N |
| | 129 | USER modify GROCERY_LIST | 1:N |