Skip to content

Commit 66ae5ff

Browse files
authored
Merge pull request #8 from MattHalloran/dev
Website v1.0🥳👯‍♀️
2 parents 88d088d + 4f69724 commit 66ae5ff

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+3004
-55554
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,4 +163,7 @@ Backend/postgres/
163163

164164
#Assets
165165
backend/assets/
166-
backend/plant_info/yards/yards*.json
166+
backend/plant_info/yards/yards*.json
167+
168+
.eslintcache
169+
package-lock.json

backend/docs/CreatingRequirementsFile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,8 @@ add the python-dotenv environment variable. To add this to the requirements.txt
1010
Another missing file is psycopg2. Enter:
1111
4) pip3 freeze | grep psycopg2 >> requirements.txt
1212

13+
Also make sure to install gunicorn, for serving the backend. Enter:
14+
5) pip3 freeze | grep gunicorn >> requirements.txt
15+
1316
Also, make sure to check that the correct bcrypt was added to the requirements file.
1417
It should be bcrypt, not python-bcrypt!
File renamed without changes.

backend/docs/run.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
To run the backend, open a terminal in the backend directory and enter:
2+
gunicorn -b :5000 src.routes:application
3+
4+
To run the frontend, open a terminal in the frontend directory and enter:
5+
flask run
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
"""empty message
22
3-
Revision ID: 5af486fb9543
3+
Revision ID: 60f74b6929fb
44
Revises:
5-
Create Date: 2021-02-19 18:42:26.954992
5+
Create Date: 2021-02-25 19:44:57.194741
66
77
"""
88
from alembic import op
99
import sqlalchemy as sa
1010

1111

1212
# revision identifiers, used by Alembic.
13-
revision = '5af486fb9543'
13+
revision = '60f74b6929fb'
1414
down_revision = None
1515
branch_labels = None
1616
depends_on = None
1717

1818

1919
def upgrade():
2020
# ### commands auto generated by Alembic - please adjust! ###
21-
op.add_column('order', sa.Column('is_delivery', sa.Boolean(), server_default='true', nullable=False))
21+
op.add_column('customer', sa.Column('account_approved', sa.Boolean(), server_default='true', nullable=False))
2222
# ### end Alembic commands ###
2323

2424

2525
def downgrade():
2626
# ### commands auto generated by Alembic - please adjust! ###
27-
op.drop_column('order', 'is_delivery')
27+
op.drop_column('customer', 'account_approved')
2828
# ### end Alembic commands ###

backend/requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ Flask_SQLAlchemy==2.4.4
1414
Pillow==8.1.0
1515
bcrypt==3.2.0
1616
python-dotenv==0.14.0
17-
psycopg2-binary==2.8.6
17+
psycopg2-binary==2.8.6
18+
gunicorn==20.0.4

backend/src/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99

1010
def create_app(config_class=Config):
11-
app = Flask(__name__)
11+
app = Flask(__name__, static_folder="../build", static_url_path="/")
1212
app.config.from_object(Config)
1313
db.init_app(app)
1414
migrate.init_app(app, db)

backend/src/consts/codes.json

Lines changed: 66 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,68 @@
11
{
2-
"SUCCESS": 100,
3-
"ERROR_UNKNOWN": 200,
4-
"FAILURE_EMAIL_EXISTS": 400,
5-
"FAILURE_NO_USER": 900,
6-
"FAILURE_SOFT_LOCKOUT": 910,
7-
"FAILURE_HARD_LOCKOUT": 920,
8-
"FAILURE_NOT_VERIFIED": 1400,
9-
"ERROR_SOME_IMAGES_ALREADY_UPLOADED": 2500,
10-
"ERROR_NOT_AUTHORIZED": 3000
2+
"version": 1.0,
3+
"SUCCESS": {
4+
"code": 200,
5+
"ok": true,
6+
"msg": ""
7+
},
8+
"WARNING_NO_RESULTS": {
9+
"code": 201,
10+
"ok": true,
11+
"msg": "Warning: Called successfully, but got no results"
12+
},
13+
"ERROR_SOME_IMAGES_ALREADY_UPLOADED": {
14+
"code": 202,
15+
"ok": true,
16+
"msg": "Warning: Some images were already uploaded"
17+
},
18+
"ERROR_UNKNOWN": {
19+
"code": 6969,
20+
"ok": false,
21+
"msg": "Unknown error occurred"
22+
},
23+
"ERROR_INVALID_ARGS": {
24+
"code": 369,
25+
"ok": false,
26+
"msg": "Error: Invalid arguments supplied"
27+
},
28+
"FAILURE_EMAIL_EXISTS": {
29+
"code": 469,
30+
"ok": false,
31+
"msg": "Error: Account with that email already exists"
32+
},
33+
"FAILURE_NO_USER": {
34+
"code": 969,
35+
"ok": false,
36+
"msg": "Error: No user with that email"
37+
},
38+
"FAILURE_INCORRECT_CREDENTIALS": {
39+
"code": 975,
40+
"ok": false,
41+
"msg": "Error: Email or password incorrect"
42+
},
43+
"FAILURE_SOFT_LOCKOUT": {
44+
"code": 910,
45+
"ok": false,
46+
"msg": "Error: Too many login attempts. Try again in 15 minutes"
47+
},
48+
"FAILURE_HARD_LOCKOUT": {
49+
"code": 912,
50+
"ok": false,
51+
"msg": "Error: Account locked. Contact us for assistance"
52+
},
53+
"FAILURE_NOT_VERIFIED": {
54+
"code": 1400,
55+
"ok": false,
56+
"msg": "Error: Session token could not be verified. Please log back in"
57+
},
58+
"ERROR_NOT_AUTHORIZED": {
59+
"code": 300,
60+
"ok": false,
61+
"msg": "Error: Not authorized to perform this action"
62+
},
63+
"ERROR_CANNOT_DELETE_YOURSELF": {
64+
"code": 1500,
65+
"ok": false,
66+
"msg": "Error: What are you doing trying to delete your own account? I am disappointed :("
67+
}
1168
}

backend/src/consts/orderStatus.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"CANCELED_BY_ADMIN": -4,
3+
"CANCELED_BY_USER": -3,
4+
"PENDING_CANCEL": -2,
5+
"REJECTED": -1,
6+
"DRAFT": 0,
7+
"PENDING": 1,
8+
"APPROVED": 2,
9+
"SCHEDULED": 3,
10+
"IN_TRANSIT": 4,
11+
"DELIVERED": 5
12+
}

backend/src/consts/routes.json

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)