-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from nico-iaco/feature/readme
Added readme.md
- Loading branch information
Showing
2 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# Food-track-be | ||
|
||
## Description | ||
This app is a simple food tracking app. It allows you to track your food intake and calories. | ||
|
||
To use this app, first you have to install [grocery-be](https://github.com/nico-iaco/grocery-be) which provide food availability | ||
and all the food data. | ||
|
||
## Features | ||
|
||
- [x] Add meals | ||
- [x] Add food consumed | ||
- [x] Calculate meal calories and price | ||
|
||
|
||
## Requirements | ||
|
||
- [PostgreSQL](https://www.postgresql.org/) | ||
- [grocery-be](https://github.com/nico-iaco/grocery-be) | ||
- [food-details-integrator-be](https://github.com/nico-iaco/food-detail-integrator-be) (optional) | ||
|
||
## Installation | ||
|
||
### Cluster installation | ||
|
||
To install this app in a cluster, first create grocery namespace, then modify the kustomization.yaml file in /k8s/overlays/qa | ||
changing the property to match your configuration and run the following command: | ||
|
||
```bash | ||
kubectl apply -k k8s/overlays/qa | ||
``` | ||
|
||
### Local installation | ||
|
||
You can run this app locally with docker. To do so, run the following command: | ||
|
||
```bash | ||
docker run -p 8080:8080 ghcr.io/nico-iaco/food-track-be:latest -e {ALL_ENV_VARIABLES} | ||
``` | ||
|
||
## Environment variables | ||
|
||
| Name | Description | Default value | | ||
|----------------------|----------------------------------------------|---------------| | ||
| PORT | Port on which the app will listen | 8080 | | ||
| GIN_MODE | Release type of app | | | ||
| DB_HOST | Database host | | | ||
| DB_PORT | Database port | | | ||
| DB_NAME | Database name | | | ||
| DB_USER | Database user | | | ||
| DB_PASSWORD | Database password | | | ||
| GROCERY_BASE_URL | Base url for grocery-be app | | | ||
| FOOD_DETAIL_BASE_URL | Base url for food-details-base-integrator-be | | | ||
|
||
## Database | ||
|
||
To create the database, run the following command with the database user: | ||
|
||
```sql | ||
CREATE DATABASE food_track; | ||
``` | ||
|
||
```sql | ||
create table meal ( | ||
id uuid primary key, | ||
name varchar(255) not null, | ||
description varchar(255), | ||
meal_type varchar(255) not null, | ||
date date not null | ||
); | ||
``` | ||
|
||
```sql | ||
create table food_consumption ( | ||
id uuid primary key, | ||
meal_id uuid not null, | ||
food_id uuid not null, | ||
transaction_id uuid not null, | ||
food_name varchar(255) not null, | ||
quantity_used float not null, | ||
quantity_used_std float not null, | ||
unit varchar(255) not null, | ||
kcal float not null, | ||
cost float not null, | ||
foreign key (meal_id) references meal(id) | ||
); | ||
``` |