Skip to content

Commit

Permalink
Database fixing + Profile midway (#61)
Browse files Browse the repository at this point in the history
* questions table correctly truncated

* removed some bad functions from database

* most auth tests passing, database functions fixed

* puzzle skeleton, almost all tests passing except jwt token, added another stats function to prepare for leaderboard work

* skeleton for leaderboard complete

* added example tests for python

* commented out some strings
  • Loading branch information
ryanshi42 authored Aug 8, 2022
1 parent e4ba918 commit 5ee1ad1
Show file tree
Hide file tree
Showing 40 changed files with 38,905 additions and 38,702 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
config/*.env
.vscode
config/*.env
.vscode
node_modules
84 changes: 42 additions & 42 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
## COMMON COMMANDS

.PHONY: stop

stop:
docker-compose down

## DEVELOPMENT MODE

.PHONY: build-dev dev destroy-dev restart-dev

build-dev:
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up --build

dev:
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up

destroy-dev:
docker-compose -f docker-compose.yml -f docker-compose.dev.yml down -v

restart-dev: destroy-dev build-dev

## PRODUCTION MODE

.PHONY: build run restart

build:
docker-compose up --build -d

run:
docker-compose up -d

restart:
docker-compose down -v
docker-compose up --build -d

## TESTS

.PHONY: test-backend

test-backend:
docker-compose exec backend pytest . $(args)
## COMMON COMMANDS

.PHONY: stop

stop:
docker-compose down

## DEVELOPMENT MODE

.PHONY: build-dev dev destroy-dev restart-dev

build-dev:
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up --build

dev:
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up

destroy-dev:
docker-compose -f docker-compose.yml -f docker-compose.dev.yml down -v

restart-dev: destroy-dev build-dev

## PRODUCTION MODE

.PHONY: build run restart

build:
docker-compose up --build -d

run:
docker-compose up -d

restart:
docker-compose down -v
docker-compose up --build -d

## TESTS

.PHONY: test-backend

test-backend:
docker-compose exec backend pytest . $(args)
11 changes: 11 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"

[packages]

[dev-packages]

[requires]
python_version = "3.8"
56 changes: 28 additions & 28 deletions backend/Pipfile
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"

[packages]
Flask = "*"
Flask-SQLAlchemy = "*"
Flask-Login = "*"
psycopg2-binary = "*"
email-validator = "*"
argon2-cffi = "*"
flask-jwt-extended = "*"
redis = "*"
flask-cors = "*"
flask-mail = "*"
gunicorn = "*"
itsdangerous = "*"

[dev-packages]
pytest = "*"
requests = "*"
freezegun = "*"
fakeredis = "*"
pytest-mock = "*"

[requires]
python_version = "3.8"
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"

[packages]
Flask = "*"
Flask-SQLAlchemy = "*"
Flask-Login = "*"
psycopg2-binary = "*"
email-validator = "*"
argon2-cffi = "*"
flask-jwt-extended = "*"
redis = "*"
flask-cors = "*"
flask-mail = "*"
gunicorn = "*"
itsdangerous = "*"

[dev-packages]
pytest = "*"
requests = "*"
freezegun = "*"
fakeredis = "*"
pytest-mock = "*"

[requires]
python_version = "3.8"
2 changes: 1 addition & 1 deletion backend/auth/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def _username_exists(cursor, username):
@staticmethod
def _add_user(conn, cursor, email, username, password):
"""Given the details of a user, adds them to the database."""
cursor.execute("INSERT INTO Users (email, username, password, numStars, score) VALUES (%s, %s, %s, 0, 0)",
cursor.execute("INSERT INTO Users (email, username, password) VALUES (%s, %s, %s, 0, 0)",
(email, username, password))
conn.commit()

Expand Down
Loading

0 comments on commit 5ee1ad1

Please sign in to comment.