Skip to content

Website v1.0🥳👯‍♀️ #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Mar 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,7 @@ Backend/postgres/

#Assets
backend/assets/
backend/plant_info/yards/yards*.json
backend/plant_info/yards/yards*.json

.eslintcache
package-lock.json
3 changes: 3 additions & 0 deletions backend/docs/CreatingRequirementsFile
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@ add the python-dotenv environment variable. To add this to the requirements.txt
Another missing file is psycopg2. Enter:
4) pip3 freeze | grep psycopg2 >> requirements.txt

Also make sure to install gunicorn, for serving the backend. Enter:
5) pip3 freeze | grep gunicorn >> requirements.txt

Also, make sure to check that the correct bcrypt was added to the requirements file.
It should be bcrypt, not python-bcrypt!
File renamed without changes.
5 changes: 5 additions & 0 deletions backend/docs/run.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
To run the backend, open a terminal in the backend directory and enter:
gunicorn -b :5000 src.routes:application

To run the frontend, open a terminal in the frontend directory and enter:
flask run
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
"""empty message

Revision ID: 5af486fb9543
Revision ID: 60f74b6929fb
Revises:
Create Date: 2021-02-19 18:42:26.954992
Create Date: 2021-02-25 19:44:57.194741

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '5af486fb9543'
revision = '60f74b6929fb'
down_revision = None
branch_labels = None
depends_on = None


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


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('order', 'is_delivery')
op.drop_column('customer', 'account_approved')
# ### end Alembic commands ###
3 changes: 2 additions & 1 deletion backend/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ Flask_SQLAlchemy==2.4.4
Pillow==8.1.0
bcrypt==3.2.0
python-dotenv==0.14.0
psycopg2-binary==2.8.6
psycopg2-binary==2.8.6
gunicorn==20.0.4
2 changes: 1 addition & 1 deletion backend/src/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


def create_app(config_class=Config):
app = Flask(__name__)
app = Flask(__name__, static_folder="../build", static_url_path="/")
app.config.from_object(Config)
db.init_app(app)
migrate.init_app(app, db)
Expand Down
75 changes: 66 additions & 9 deletions backend/src/consts/codes.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,68 @@
{
"SUCCESS": 100,
"ERROR_UNKNOWN": 200,
"FAILURE_EMAIL_EXISTS": 400,
"FAILURE_NO_USER": 900,
"FAILURE_SOFT_LOCKOUT": 910,
"FAILURE_HARD_LOCKOUT": 920,
"FAILURE_NOT_VERIFIED": 1400,
"ERROR_SOME_IMAGES_ALREADY_UPLOADED": 2500,
"ERROR_NOT_AUTHORIZED": 3000
"version": 1.0,
"SUCCESS": {
"code": 200,
"ok": true,
"msg": ""
},
"WARNING_NO_RESULTS": {
"code": 201,
"ok": true,
"msg": "Warning: Called successfully, but got no results"
},
"ERROR_SOME_IMAGES_ALREADY_UPLOADED": {
"code": 202,
"ok": true,
"msg": "Warning: Some images were already uploaded"
},
"ERROR_UNKNOWN": {
"code": 6969,
"ok": false,
"msg": "Unknown error occurred"
},
"ERROR_INVALID_ARGS": {
"code": 369,
"ok": false,
"msg": "Error: Invalid arguments supplied"
},
"FAILURE_EMAIL_EXISTS": {
"code": 469,
"ok": false,
"msg": "Error: Account with that email already exists"
},
"FAILURE_NO_USER": {
"code": 969,
"ok": false,
"msg": "Error: No user with that email"
},
"FAILURE_INCORRECT_CREDENTIALS": {
"code": 975,
"ok": false,
"msg": "Error: Email or password incorrect"
},
"FAILURE_SOFT_LOCKOUT": {
"code": 910,
"ok": false,
"msg": "Error: Too many login attempts. Try again in 15 minutes"
},
"FAILURE_HARD_LOCKOUT": {
"code": 912,
"ok": false,
"msg": "Error: Account locked. Contact us for assistance"
},
"FAILURE_NOT_VERIFIED": {
"code": 1400,
"ok": false,
"msg": "Error: Session token could not be verified. Please log back in"
},
"ERROR_NOT_AUTHORIZED": {
"code": 300,
"ok": false,
"msg": "Error: Not authorized to perform this action"
},
"ERROR_CANNOT_DELETE_YOURSELF": {
"code": 1500,
"ok": false,
"msg": "Error: What are you doing trying to delete your own account? I am disappointed :("
}
}
12 changes: 12 additions & 0 deletions backend/src/consts/orderStatus.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"CANCELED_BY_ADMIN": -4,
"CANCELED_BY_USER": -3,
"PENDING_CANCEL": -2,
"REJECTED": -1,
"DRAFT": 0,
"PENDING": 1,
"APPROVED": 2,
"SCHEDULED": 3,
"IN_TRANSIT": 4,
"DELIVERED": 5
}
18 changes: 0 additions & 18 deletions backend/src/consts/routes.json

This file was deleted.

Loading