Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhongxuanWang committed Nov 19, 2023
1 parent 5eb980b commit b91da99
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,7 @@ cython_debug/
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

.idea/workspace.xml
.idea/usage.statistics.xml
.idea/shelf
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions src/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from flask import Flask, request
import json

from db import db

app = Flask(__name__)


db_filename = "database.db"

app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///%s" % db_filename
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
app.config["SQLALCHEMY_ECHO"] = True

db.init_app(app)
with app.app_context():
db.create_all()


@app.route('/api/', methods=['POST'])
def venmo_test():
pass



if __name__ == '__main__':
app.run(host='0.0.0.0', port=8888, debug=True)
20 changes: 20 additions & 0 deletions src/db.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from flask_sqlalchemy import SQLAlchemy

db = SQLAlchemy()

class User(db.Model):
__tablename__ = 'user'

id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String, nullable=False)
netid = db.Column(db.String, nullable=False, unique=True)
venmo_username = db.Column(db.String, nullable=False, unique=True)
clubs = db.Column(db.Integer, db.ForeignKey(''))


class Club(db.Model):
__tablename__ = 'club'

id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String, nullable=False)

9 changes: 9 additions & 0 deletions src/utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import json


def success_message(x, code=201):
return json.dumps(x), code


def failure_message(x, code=400):
return json.dumps(x), code

0 comments on commit b91da99

Please sign in to comment.