Skip to content

Commit ae9ca58

Browse files
committed
init project and add some api users & meals
0 parents  commit ae9ca58

26 files changed

+894
-0
lines changed

.gitignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
.idea
2+
.ipynb_checkpoints
3+
.mypy_cache
4+
__pycache__
5+
.pytest_cache
6+
htmlcov
7+
dist
8+
site
9+
.coverage
10+
coverage.xml
11+
.netlify
12+
test.db
13+
log.txt
14+
Pipfile.lock
15+
env3.*
16+
env
17+
docs_build
18+
site_build
19+
venv
20+
docs.zip
21+
archive.zip
22+
23+
# vim temporary files
24+
*~
25+
.*.sw?
26+
.cache
27+
28+
# macOS
29+
.DS_Store

.vscode/settings.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"[python]": {
3+
"editor.defaultFormatter": "ms-python.python",
4+
"editor.tabSize": 4,
5+
"editor.insertSpaces": true,
6+
"editor.formatOnSave": true
7+
},
8+
}

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Health API
2+
## _Based on Python and FastAPI
3+
4+
Library used:
5+
- fastapi
6+
- python-jose
7+
- passlib
8+
- autopep8
9+
- fastapi-pagination
10+
11+
## Features
12+
13+
- Login, get all users, get user, update user...
14+
- Meal types, meal history...
15+
16+
17+
## Envinroment
18+
19+
```sh
20+
cd /health-api
21+
python3 -m venv ./env
22+
```
23+
24+
25+
## Installation
26+
27+
```sh
28+
pip3 install -r requirements.txt
29+
```
30+
31+
```sh
32+
cd /app
33+
uvicorn main:app --reload
34+
```
35+
36+
```sh
37+
127.0.0.1:8000
38+
```
39+
40+
## License
41+
Author
42+
[minhpn76]: <https://github.com/minhpn76>

app/__init__.py

Whitespace-only changes.

app/config/__init__.py

Whitespace-only changes.

app/config/app.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SECRET_KEY = "ef0a04f3d013d98b8bd4db5ebafd4e4f244f0881d2e4e6b735fcd86c4b148a42"
2+
ALGORITHM = "HS256"
3+
ACCESS_TOKEN_EXPIRE_MINUTES = 30

app/db/__init__.py

Whitespace-only changes.

app/db/bodyRecords.py

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
fake_body_records_db = {
2+
"day": [],
3+
"week": [],
4+
"month": [],
5+
"year": [
6+
{
7+
"id": 1,
8+
"name": '6 m',
9+
"uv": 4000,
10+
"pv": 2400,
11+
},
12+
{
13+
"id": 2,
14+
"name": '7 m',
15+
"uv": 3000,
16+
"pv": 1398,
17+
},
18+
{
19+
"id": 3,
20+
"name": '8 m',
21+
"uv": 2000,
22+
"pv": 6722,
23+
},
24+
{
25+
"id": 4,
26+
"name": '9 m',
27+
"uv": 2780,
28+
"pv": 5244,
29+
},
30+
{
31+
"id": 5,
32+
"name": '10 m',
33+
"uv": 1890,
34+
"pv": 4800,
35+
},
36+
{
37+
"id": 6,
38+
"name": '11 m',
39+
"uv": 3902,
40+
"pv": 2334,
41+
},
42+
{
43+
"id": 7,
44+
"name": '12 m',
45+
"uv": 2390,
46+
"pv": 2189,
47+
},
48+
{
49+
"id": 8,
50+
"name": '1 m',
51+
"uv": 3490,
52+
"pv": 2122,
53+
},
54+
{
55+
"id": 9,
56+
"name": '2 m',
57+
"uv": 2832,
58+
"pv": 1754,
59+
},
60+
{
61+
"id": 10,
62+
"name": '3 m',
63+
"uv": 2780,
64+
"pv": 2672,
65+
},
66+
{
67+
"id": 11,
68+
"name": '4 m',
69+
"uv": 2672,
70+
"pv": 3002,
71+
},
72+
{
73+
"id": 12,
74+
"name": '5 m',
75+
"uv": 1989,
76+
"pv": 1922,
77+
},
78+
],
79+
};

app/db/meal.py

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
fake_meal_type_db = [
2+
{
3+
"id": 1,
4+
"name": "Morning",
5+
},
6+
{
7+
"id": 2,
8+
"name": "Lunch"
9+
},
10+
{
11+
"id": 3,
12+
"name": "Dinner"
13+
},
14+
{
15+
"id": 4,
16+
"name": "Snack"
17+
}
18+
]
19+
20+
fake_meals_db = [
21+
{
22+
"id": 1,
23+
"image": '/images/m01.jpg',
24+
"type": 'Morning',
25+
"datedOn": '2022-05-21T00:00:00.000Z',
26+
},
27+
{
28+
"id": 2,
29+
"image": '/images/l03.jpg',
30+
"type": 'Lunch',
31+
"datedOn": '2022-05-21T00:00:00.000Z',
32+
},
33+
{
34+
"id": 3,
35+
"image": '/images/d02.jpg',
36+
"type": 'Dinner',
37+
"datedOn": '2022-05-21T00:00:00.000Z',
38+
},
39+
{
40+
"id": 4,
41+
"image": '/images/l01.jpg',
42+
"type": 'Snack',
43+
"datedOn": '2022-05-21T00:00:00.000Z',
44+
},
45+
{
46+
"id": 5,
47+
"image": '/images/m01.jpg',
48+
"type": 'Morning',
49+
"datedOn": '2022-05-20T00:00:00.000Z',
50+
},
51+
{
52+
"id": 6,
53+
"image": '/images/l03.jpg',
54+
"type": 'Lunch',
55+
"datedOn": '2022-05-20T00:00:00.000Z',
56+
},
57+
{
58+
"id": 7,
59+
"image": '/images/d02.jpg',
60+
"type": 'Dinner',
61+
"datedOn": '2022-05-20T00:00:00.000Z',
62+
},
63+
{
64+
"id": 8,
65+
"image": '/images/l01.jpg',
66+
"type": 'Snack',
67+
"datedOn": '2022-05-20T00:00:00.000Z',
68+
},
69+
{
70+
"id": 9,
71+
"image": '/images/m01.jpg',
72+
"type": 'Morning',
73+
"datedOn": '2022-05-19T00:00:00.000Z',
74+
},
75+
{
76+
"id": 10,
77+
"image": '/images/l03.jpg',
78+
"type": 'Lunch',
79+
"datedOn": '2022-05-19T00:00:00.000Z',
80+
},
81+
{
82+
"id": 11,
83+
"image": '/images/d02.jpg',
84+
"type": 'Dinner',
85+
"datedOn": '2022-05-19T00:00:00.000Z',
86+
},
87+
{
88+
"id": 12,
89+
"image": '/images/l01.jpg',
90+
"type": 'Snack',
91+
"datedOn": '2022-05-19T00:00:00.000Z',
92+
},
93+
]

app/db/myAnalysis.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
fake_my_analysis_db = [
2+
{
3+
"id": 1,
4+
"createdOn": '2022-05-21T00:00:00.000Z',
5+
"value": 75,
6+
},
7+
{
8+
"id": 2,
9+
"createdOn": '2022-05-20T00:00:00.000Z',
10+
"value": 25,
11+
},
12+
{
13+
"id": 3,
14+
"createdOn": '2022-05-19T00:00:00.000Z',
15+
"value": 100,
16+
},
17+
];

0 commit comments

Comments
 (0)