Fix database models
This commit is contained in:
parent
068cea8019
commit
9763972575
|
@ -1,2 +1,2 @@
|
||||||
src/constants.py
|
constants.py
|
||||||
assets/db_schema.sql
|
assets/db_schema.sql
|
||||||
|
|
10
Pipfile
10
Pipfile
|
@ -6,6 +6,16 @@ verify_ssl = true
|
||||||
[dev-packages]
|
[dev-packages]
|
||||||
|
|
||||||
[packages]
|
[packages]
|
||||||
|
twilio = "*"
|
||||||
|
flask = "*"
|
||||||
|
pymysql = "*"
|
||||||
|
flask-praetorian = "*"
|
||||||
|
flask-sqlalchemy = "*"
|
||||||
|
flask-migrate = "*"
|
||||||
|
flask-marshmallow = "*"
|
||||||
|
marshmallow = "*"
|
||||||
|
pytest = "*"
|
||||||
|
marshmallow-sqlalchemy = "*"
|
||||||
|
|
||||||
[requires]
|
[requires]
|
||||||
python_version = "3.8"
|
python_version = "3.8"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"_meta": {
|
"_meta": {
|
||||||
"hash": {
|
"hash": {
|
||||||
"sha256": "f45ecdf6d0ebe7b78d400e7fc1df90d2dbabf6e9f1c146e4768f215652c06008"
|
"sha256": "80fd792f6fec6ea79a6795b929139827dcf748408d6b337e8f1b5dc2cff36302"
|
||||||
},
|
},
|
||||||
"pipfile-spec": 6,
|
"pipfile-spec": 6,
|
||||||
"requires": {
|
"requires": {
|
||||||
|
@ -22,6 +22,13 @@
|
||||||
],
|
],
|
||||||
"version": "==1.4.2"
|
"version": "==1.4.2"
|
||||||
},
|
},
|
||||||
|
"attrs": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:08a96c641c3a74e44eb59afb61a24f2cb9f4d7188748e76ba4bb5edfa3cb7d1c",
|
||||||
|
"sha256:f7b7ce16570fe9965acd6d30101a28f62fb4a7f9e926b3bbc9b61f8b04247e72"
|
||||||
|
],
|
||||||
|
"version": "==19.3.0"
|
||||||
|
},
|
||||||
"blinker": {
|
"blinker": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:471aee25f3992bd325afa3772f1063dbdbbca947a041b8b89466dc00d606f8b6"
|
"sha256:471aee25f3992bd325afa3772f1063dbdbbca947a041b8b89466dc00d606f8b6"
|
||||||
|
@ -49,6 +56,13 @@
|
||||||
],
|
],
|
||||||
"version": "==7.1.1"
|
"version": "==7.1.1"
|
||||||
},
|
},
|
||||||
|
"deprecated": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:0cf37d293a96805c6afd8b5fc525cb40f23a2cac9b2d066ac3bd4b04e72ceccc",
|
||||||
|
"sha256:55b41a15bda04c6a2c0d27dd4c2b7b81ffa6348c9cad8f077ac1978c59927ab9"
|
||||||
|
],
|
||||||
|
"version": "==1.2.9"
|
||||||
|
},
|
||||||
"flask": {
|
"flask": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:4efa1ae2d7c9865af48986de8aeb8504bf32c7f3d6fdc9353d34b21f4b127060",
|
"sha256:4efa1ae2d7c9865af48986de8aeb8504bf32c7f3d6fdc9353d34b21f4b127060",
|
||||||
|
@ -59,10 +73,10 @@
|
||||||
},
|
},
|
||||||
"flask-buzz": {
|
"flask-buzz": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:b3347ae16b0716c4beab40fa4722771080c31e3c25925afc1c974d0df8382e48",
|
"sha256:5d1158170c62c62a55e294f531091b261e5f9b272f9e4054e497e0fb68a6cf45",
|
||||||
"sha256:eb2d4dbb42bfa9a46f174a026caa0b49b9cc582fb79377b52425551e586d4e1c"
|
"sha256:bd15f6c28807cad1fa7bdfa997f6722ac234271f72a0f7976d6100d64af864b9"
|
||||||
],
|
],
|
||||||
"version": "==0.1.14"
|
"version": "==0.1.15"
|
||||||
},
|
},
|
||||||
"flask-mail": {
|
"flask-mail": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
|
@ -109,6 +123,12 @@
|
||||||
],
|
],
|
||||||
"version": "==2.9"
|
"version": "==2.9"
|
||||||
},
|
},
|
||||||
|
"inflection": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:18ea7fb7a7d152853386523def08736aa8c32636b047ade55f7578c4edeb16ca"
|
||||||
|
],
|
||||||
|
"version": "==0.3.1"
|
||||||
|
},
|
||||||
"itsdangerous": {
|
"itsdangerous": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:321b033d07f2a4136d3ec762eac9f16a10ccd60f53c0c91af90217ace7ba1f19",
|
"sha256:321b033d07f2a4136d3ec762eac9f16a10ccd60f53c0c91af90217ace7ba1f19",
|
||||||
|
@ -118,10 +138,10 @@
|
||||||
},
|
},
|
||||||
"jinja2": {
|
"jinja2": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:93187ffbc7808079673ef52771baa950426fd664d3aad1d0fa3e95644360e250",
|
"sha256:89aab215427ef59c34ad58735269eb58b1a5808103067f7bb9d5836c651b3bb0",
|
||||||
"sha256:b0eaf100007721b5c16c1fc1eecb87409464edc10469ddc9a22a27a99123be49"
|
"sha256:f0a4641d3cf955324a89c04f3d94663aa4d638abe8f733ecd3582848e1c37035"
|
||||||
],
|
],
|
||||||
"version": "==2.11.1"
|
"version": "==2.11.2"
|
||||||
},
|
},
|
||||||
"mako": {
|
"mako": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
|
@ -176,6 +196,28 @@
|
||||||
"index": "pypi",
|
"index": "pypi",
|
||||||
"version": "==3.5.1"
|
"version": "==3.5.1"
|
||||||
},
|
},
|
||||||
|
"marshmallow-sqlalchemy": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:9301c6fd197bd97337820ea1417aa1233d0ee3e22748ebd5821799bc841a57e8",
|
||||||
|
"sha256:dde9e20bcb710e9e59f765a38e3d6d17f1b2d6b4320cbdc2cea0f6b57f70d08c"
|
||||||
|
],
|
||||||
|
"index": "pypi",
|
||||||
|
"version": "==0.22.3"
|
||||||
|
},
|
||||||
|
"more-itertools": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:5dd8bcf33e5f9513ffa06d5ad33d78f31e1931ac9a18f33d37e77a180d393a7c",
|
||||||
|
"sha256:b1ddb932186d8a6ac451e1d95844b382f55e12686d51ca0c68b6f61f2ab7a507"
|
||||||
|
],
|
||||||
|
"version": "==8.2.0"
|
||||||
|
},
|
||||||
|
"packaging": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:3c292b474fda1671ec57d46d739d072bfd495a4f51ad01a055121d81e952b7a3",
|
||||||
|
"sha256:82f77b9bee21c1bafbf35a84905d604d5d1223801d639cf3ed140bd651c08752"
|
||||||
|
],
|
||||||
|
"version": "==20.3"
|
||||||
|
},
|
||||||
"passlib": {
|
"passlib": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:68c35c98a7968850e17f1b6892720764cc7eed0ef2b7cb3116a89a28e43fe177",
|
"sha256:68c35c98a7968850e17f1b6892720764cc7eed0ef2b7cb3116a89a28e43fe177",
|
||||||
|
@ -207,12 +249,26 @@
|
||||||
],
|
],
|
||||||
"version": "==2.1.0"
|
"version": "==2.1.0"
|
||||||
},
|
},
|
||||||
|
"pluggy": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0",
|
||||||
|
"sha256:966c145cd83c96502c3c3868f50408687b38434af77734af1e9ca461a4081d2d"
|
||||||
|
],
|
||||||
|
"version": "==0.13.1"
|
||||||
|
},
|
||||||
|
"py": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:5e27081401262157467ad6e7f851b7aa402c5852dbcb3dae06768434de5752aa",
|
||||||
|
"sha256:c20fdd83a5dbc0af9efd622bee9a5564e278f6380fffcacc43ba6f43db2813b0"
|
||||||
|
],
|
||||||
|
"version": "==1.8.1"
|
||||||
|
},
|
||||||
"py-buzz": {
|
"py-buzz": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:4b7a89bebad927c69e069ca43399a1b965c15f3b08998cf0d68101cc059efad8",
|
"sha256:07ff75c14182cb07d88372b6dc5e74e3588174189c8fd43b262317d38b8e49bd",
|
||||||
"sha256:d5147db6aab9ff52060f2810648003a6b4bdc91b8b16b50c23668ece632e15c2"
|
"sha256:21f72d3e160eb403dce76f9011c4614f3e0608bb7f91673e9fb7bfee7859a9a0"
|
||||||
],
|
],
|
||||||
"version": "==0.3.7"
|
"version": "==1.0.3"
|
||||||
},
|
},
|
||||||
"pyjwt": {
|
"pyjwt": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
|
@ -229,6 +285,21 @@
|
||||||
"index": "pypi",
|
"index": "pypi",
|
||||||
"version": "==0.9.3"
|
"version": "==0.9.3"
|
||||||
},
|
},
|
||||||
|
"pyparsing": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1",
|
||||||
|
"sha256:ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b"
|
||||||
|
],
|
||||||
|
"version": "==2.4.7"
|
||||||
|
},
|
||||||
|
"pytest": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:0e5b30f5cb04e887b91b1ee519fa3d89049595f428c1db76e73bd7f17b09b172",
|
||||||
|
"sha256:84dde37075b8805f3d1f392cc47e38a0e59518fb46a431cfdaf7cf1ce805f970"
|
||||||
|
],
|
||||||
|
"index": "pypi",
|
||||||
|
"version": "==5.4.1"
|
||||||
|
},
|
||||||
"python-dateutil": {
|
"python-dateutil": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:73ebfe9dbf22e832286dafa60473e4cd239f8592f699aa5adaf10050e6e1823c",
|
"sha256:73ebfe9dbf22e832286dafa60473e4cd239f8592f699aa5adaf10050e6e1823c",
|
||||||
|
@ -274,23 +345,48 @@
|
||||||
},
|
},
|
||||||
"sqlalchemy": {
|
"sqlalchemy": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:7224e126c00b8178dfd227bc337ba5e754b197a3867d33b9f30dc0208f773d70"
|
"sha256:083e383a1dca8384d0ea6378bd182d83c600ed4ff4ec8247d3b2442cf70db1ad",
|
||||||
|
"sha256:0a690a6486658d03cc6a73536d46e796b6570ac1f8a7ec133f9e28c448b69828",
|
||||||
|
"sha256:114b6ace30001f056e944cebd46daef38fdb41ebb98f5e5940241a03ed6cad43",
|
||||||
|
"sha256:128f6179325f7597a46403dde0bf148478f868df44841348dfc8d158e00db1f9",
|
||||||
|
"sha256:13d48cd8b925b6893a4e59b2dfb3e59a5204fd8c98289aad353af78bd214db49",
|
||||||
|
"sha256:211a1ce7e825f7142121144bac76f53ac28b12172716a710f4bf3eab477e730b",
|
||||||
|
"sha256:2dc57ee80b76813759cccd1a7affedf9c4dbe5b065a91fb6092c9d8151d66078",
|
||||||
|
"sha256:3e625e283eecc15aee5b1ef77203bfb542563fa4a9aa622c7643c7b55438ff49",
|
||||||
|
"sha256:43078c7ec0457387c79b8d52fff90a7ad352ca4c7aa841c366238c3e2cf52fdf",
|
||||||
|
"sha256:5b1bf3c2c2dca738235ce08079783ef04f1a7fc5b21cf24adaae77f2da4e73c3",
|
||||||
|
"sha256:6056b671aeda3fc451382e52ab8a753c0d5f66ef2a5ccc8fa5ba7abd20988b4d",
|
||||||
|
"sha256:68d78cf4a9dfade2e6cf57c4be19f7b82ed66e67dacf93b32bb390c9bed12749",
|
||||||
|
"sha256:7025c639ce7e170db845e94006cf5f404e243e6fc00d6c86fa19e8ad8d411880",
|
||||||
|
"sha256:7224e126c00b8178dfd227bc337ba5e754b197a3867d33b9f30dc0208f773d70",
|
||||||
|
"sha256:7d98e0785c4cd7ae30b4a451416db71f5724a1839025544b4edbd92e00b91f0f",
|
||||||
|
"sha256:8d8c21e9d4efef01351bf28513648ceb988031be4159745a7ad1b3e28c8ff68a",
|
||||||
|
"sha256:bbb545da054e6297242a1bb1ba88e7a8ffb679f518258d66798ec712b82e4e07",
|
||||||
|
"sha256:d00b393f05dbd4ecd65c989b7f5a81110eae4baea7a6a4cdd94c20a908d1456e",
|
||||||
|
"sha256:e18752cecaef61031252ca72031d4d6247b3212ebb84748fc5d1a0d2029c23ea"
|
||||||
],
|
],
|
||||||
"version": "==1.3.16"
|
"version": "==1.3.16"
|
||||||
},
|
},
|
||||||
"twilio": {
|
"twilio": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:39b949c671f1b29259c85569de58e6a4c8b04e13aba08d2d20ddba9d7c304573"
|
"sha256:620d7c9ef9e09c67a690ad02fdf76f502e5115227a56369e5f235d8a6b717c69"
|
||||||
],
|
],
|
||||||
"index": "pypi",
|
"index": "pypi",
|
||||||
"version": "==6.38.0"
|
"version": "==6.38.1"
|
||||||
},
|
},
|
||||||
"urllib3": {
|
"urllib3": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:2f3db8b19923a873b3e5256dc9c2dedfa883e33d87c690d9c7913e1f40673cdc",
|
"sha256:3018294ebefce6572a474f0604c2021e33b3fd8006ecd11d62107a5d2a963527",
|
||||||
"sha256:87716c2d2a7121198ebcb7ce7cccf6ce5e9ba539041cfbaeecfb641dc0bf6acc"
|
"sha256:88206b0eb87e6d677d424843ac5209e3fb9d0190d0ee169599165ec25e9d9115"
|
||||||
],
|
],
|
||||||
"version": "==1.25.8"
|
"version": "==1.25.9"
|
||||||
|
},
|
||||||
|
"wcwidth": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:cafe2186b3c009a04067022ce1dcd79cb38d8d65ee4f4791b8888d6599d1bbe1",
|
||||||
|
"sha256:ee73862862a156bf77ff92b09034fc4825dd3af9cf81bc5b360668d425f3c5f1"
|
||||||
|
],
|
||||||
|
"version": "==0.1.9"
|
||||||
},
|
},
|
||||||
"werkzeug": {
|
"werkzeug": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
|
@ -298,6 +394,12 @@
|
||||||
"sha256:6c80b1e5ad3665290ea39320b91e1be1e0d5f60652b964a3070216de83d2e47c"
|
"sha256:6c80b1e5ad3665290ea39320b91e1be1e0d5f60652b964a3070216de83d2e47c"
|
||||||
],
|
],
|
||||||
"version": "==1.0.1"
|
"version": "==1.0.1"
|
||||||
|
},
|
||||||
|
"wrapt": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:b62ffa81fb85f4332a4f609cab4ac40709470da05643a082ec1eb88e6d9b97d7"
|
||||||
|
],
|
||||||
|
"version": "==1.12.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"develop": {}
|
"develop": {}
|
|
@ -10,4 +10,4 @@ db = SQLAlchemy(app)
|
||||||
migrate = Migrate(app, db)
|
migrate = Migrate(app, db)
|
||||||
ma = Marshmallow(app)
|
ma = Marshmallow(app)
|
||||||
|
|
||||||
from app import routes, models
|
from app import routes, models, schema
|
|
@ -1,4 +1,5 @@
|
||||||
from app import db
|
from app import db
|
||||||
|
from sqlalchemy import text
|
||||||
|
|
||||||
|
|
||||||
class Users(db.Model):
|
class Users(db.Model):
|
||||||
|
@ -71,16 +72,16 @@ class Cities(db.Model):
|
||||||
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
||||||
name = db.Column(db.String(255))
|
name = db.Column(db.String(255))
|
||||||
image = db.Column(db.String(255))
|
image = db.Column(db.String(255))
|
||||||
status = db.Column(db.mysql.ENUM("1", "0"))
|
status = db.Column(db.Enum("1", "0"))
|
||||||
created = db.Column(db.DateTime, nullable=False, server_default=db.func.now())
|
created = db.Column(db.DateTime, nullable=False, server_default=db.func.now())
|
||||||
updated = db.Column(db.DateTime, nullable=False, onupdate=db.func.now())
|
modified = db.Column(db.DateTime, nullable=False, onupdate=db.func.now())
|
||||||
|
|
||||||
def __init__(self, name, image, status, created, updated):
|
def __init__(self, name, image, status, created, modified):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.image = image
|
self.image = image
|
||||||
self.status = status
|
self.status = status
|
||||||
self.created = created
|
self.created = created
|
||||||
self.updated = updated
|
self.modified = modified
|
||||||
|
|
||||||
|
|
||||||
class Games(db.Model):
|
class Games(db.Model):
|
||||||
|
@ -91,7 +92,7 @@ class Games(db.Model):
|
||||||
price = db.Column(db.String(100))
|
price = db.Column(db.String(100))
|
||||||
description = db.Column(db.Text)
|
description = db.Column(db.Text)
|
||||||
user_id = db.Column(db.Integer)
|
user_id = db.Column(db.Integer)
|
||||||
gender = db.Column(db.mysql.ENUM("1", "2", "3"))
|
gender = db.Column(db.Enum("1", "2", "3"))
|
||||||
city_id = db.Column(db.Integer)
|
city_id = db.Column(db.Integer)
|
||||||
venue_id = db.Column(db.Integer)
|
venue_id = db.Column(db.Integer)
|
||||||
sports_id = db.Column(db.Integer)
|
sports_id = db.Column(db.Integer)
|
||||||
|
@ -101,14 +102,14 @@ class Games(db.Model):
|
||||||
no_of_already_player = db.Column(db.Integer)
|
no_of_already_player = db.Column(db.Integer)
|
||||||
payment_mode = db.Column(db.Integer)
|
payment_mode = db.Column(db.Integer)
|
||||||
card_id = db.Column(db.Integer)
|
card_id = db.Column(db.Integer)
|
||||||
status = db.Column(db.Integer, server_default=1)
|
status = db.Column(db.Integer, server_default=text("1"))
|
||||||
game_status = db.Column(db.Integer, server_default=0)
|
game_status = db.Column(db.Integer, server_default=text("0"))
|
||||||
cancel_status = db.Column(db.Integer)
|
cancel_status = db.Column(db.Integer)
|
||||||
cancel_date = db.Column(db.DateTime)
|
cancel_date = db.Column(db.DateTime)
|
||||||
noti_status = db.Column(db.Integer, server_default=0)
|
noti_status = db.Column(db.Integer, server_default=text("0"))
|
||||||
conduct_status = db.Column(db.Integer, server_default=1)
|
conduct_status = db.Column(db.Integer, server_default=text("1"))
|
||||||
created = db.Column(db.DateTime, nullable=False, server_default=db.func.now())
|
created = db.Column(db.DateTime, nullable=False, server_default=db.func.now())
|
||||||
updated = db.Column(db.DateTime, nullable=False, onupdate=db.func.now())
|
modified = db.Column(db.DateTime, nullable=False, onupdate=db.func.now())
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
|
@ -188,7 +189,7 @@ class Payments(db.Model):
|
||||||
self.status = status
|
self.status = status
|
||||||
|
|
||||||
|
|
||||||
class PlayerAvailabilities:
|
class PlayerAvailabilities(db.Model):
|
||||||
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
||||||
game_id = db.Column(db.Integer)
|
game_id = db.Column(db.Integer)
|
||||||
player_id = db.Column(db.Integer)
|
player_id = db.Column(db.Integer)
|
||||||
|
@ -204,7 +205,7 @@ class PlayerAvailabilities:
|
||||||
self.status = status
|
self.status = status
|
||||||
|
|
||||||
|
|
||||||
class PlayerCancelGames:
|
class PlayerCancelGames(db.Model):
|
||||||
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
||||||
player_id = db.Column(db.Integer)
|
player_id = db.Column(db.Integer)
|
||||||
game_id = db.Column(db.Integer)
|
game_id = db.Column(db.Integer)
|
||||||
|
@ -218,7 +219,7 @@ class PlayerCancelGames:
|
||||||
self.game_id = game_id
|
self.game_id = game_id
|
||||||
|
|
||||||
|
|
||||||
class PurchaseGames:
|
class PurchaseGames(db.Model):
|
||||||
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
||||||
game_id = db.Column(db.Integer)
|
game_id = db.Column(db.Integer)
|
||||||
user_id = db.Column(db.Integer)
|
user_id = db.Column(db.Integer)
|
||||||
|
@ -234,7 +235,7 @@ class PurchaseGames:
|
||||||
self.pay_mode = pay_mode
|
self.pay_mode = pay_mode
|
||||||
|
|
||||||
|
|
||||||
class Sports:
|
class Sports(db.Model):
|
||||||
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
||||||
name = db.Column(db.String(255))
|
name = db.Column(db.String(255))
|
||||||
spanish_name = db.Column(db.String(100))
|
spanish_name = db.Column(db.String(100))
|
||||||
|
@ -250,10 +251,10 @@ class Sports:
|
||||||
self.status = status
|
self.status = status
|
||||||
|
|
||||||
|
|
||||||
class Teams:
|
class Teams(db.Model):
|
||||||
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
||||||
user_id = db.Column(db.Integer)
|
user_id = db.Column(db.Integer)
|
||||||
team_id = db.Column(db.mysql.ENUM("1", "2"))
|
team_id = db.Column(db.Enum("1", "2"))
|
||||||
game_id = db.Column(db.Integer)
|
game_id = db.Column(db.Integer)
|
||||||
status = db.Column(db.Integer)
|
status = db.Column(db.Integer)
|
||||||
created = db.Column(db.DateTime, nullable=False, server_default=db.func.now())
|
created = db.Column(db.DateTime, nullable=False, server_default=db.func.now())
|
||||||
|
@ -268,11 +269,11 @@ class Teams:
|
||||||
self.status = status
|
self.status = status
|
||||||
|
|
||||||
|
|
||||||
class UserRatings:
|
class UserRatings(db.Model):
|
||||||
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
||||||
game_id = db.Column(db.Integer)
|
game_id = db.Column(db.Integer)
|
||||||
user_id = db.Column(db.Integer)
|
user_id = db.Column(db.Integer)
|
||||||
player_id = db.Column(db.mysql.ENUM("1", "2"))
|
player_id = db.Column(db.Enum("1", "2"))
|
||||||
rating = db.Column(db.String(100))
|
rating = db.Column(db.String(100))
|
||||||
created = db.Column(db.DateTime, nullable=False, server_default=db.func.now())
|
created = db.Column(db.DateTime, nullable=False, server_default=db.func.now())
|
||||||
modified = db.Column(db.DateTime, nullable=False, onupdate=db.func.now())
|
modified = db.Column(db.DateTime, nullable=False, onupdate=db.func.now())
|
||||||
|
@ -286,13 +287,13 @@ class UserRatings:
|
||||||
self.user_type = user_type
|
self.user_type = user_type
|
||||||
|
|
||||||
|
|
||||||
class VenueImages:
|
class VenueImages(db.Model):
|
||||||
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
||||||
venue_id = db.Column(db.Integer)
|
venue_id = db.Column(db.Integer)
|
||||||
user_id = db.Column(db.Integer)
|
user_id = db.Column(db.Integer)
|
||||||
image = db.Column(db.String(255))
|
image = db.Column(db.String(255))
|
||||||
created = db.Column(db.DateTime, nullable=False, server_default=db.func.now())
|
created = db.Column(db.DateTime, nullable=False, server_default=db.func.now())
|
||||||
modified = db.Column(db.DateTime, nullable=False, onupdate=db.func.now())
|
updated = db.Column(db.DateTime, nullable=False, onupdate=db.func.now())
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, venue_id, user_id, image,
|
self, venue_id, user_id, image,
|
||||||
|
@ -302,7 +303,7 @@ class VenueImages:
|
||||||
self.image = image
|
self.image = image
|
||||||
|
|
||||||
|
|
||||||
class Venues:
|
class Venues(db.Model):
|
||||||
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
||||||
user_id = db.Column(db.Integer)
|
user_id = db.Column(db.Integer)
|
||||||
address = db.Column(db.Text)
|
address = db.Column(db.Text)
|
||||||
|
@ -324,12 +325,12 @@ class Venues:
|
||||||
self.sports_id = sports_id
|
self.sports_id = sports_id
|
||||||
|
|
||||||
|
|
||||||
class ViewNews:
|
class ViewNews(db.Model):
|
||||||
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
||||||
news_id = db.Column(db.Integer)
|
news_id = db.Column(db.Integer)
|
||||||
user_id = db.Column(db.Integer)
|
user_id = db.Column(db.Integer)
|
||||||
created = db.Column(db.DateTime, nullable=False, server_default=db.func.now())
|
created = db.Column(db.DateTime, nullable=False, server_default=db.func.now())
|
||||||
modified = db.Column(db.DateTime, nullable=False, onupdate=db.func.now())
|
updated = db.Column(db.DateTime, nullable=False, onupdate=db.func.now())
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, news_id, user_id,
|
self, news_id, user_id,
|
||||||
|
@ -338,7 +339,7 @@ class ViewNews:
|
||||||
self.user_id = user_id
|
self.user_id = user_id
|
||||||
|
|
||||||
|
|
||||||
class WebBookings:
|
class WebBookings(db.Model):
|
||||||
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
||||||
name = db.Column(db.String(255))
|
name = db.Column(db.String(255))
|
||||||
email = db.Column(db.String(255))
|
email = db.Column(db.String(255))
|
|
@ -1,6 +1,6 @@
|
||||||
from flask import request, jsonify, make_response
|
from flask import request, jsonify, make_response
|
||||||
from database.crud import insert_data, verify_otp
|
from database.crud import insert_data, verify_otp
|
||||||
from external.twilio import send_otp
|
from app.twilio import send_otp
|
||||||
from app import app
|
from app import app
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,101 @@
|
||||||
|
from app import ma
|
||||||
|
from app.models import *
|
||||||
|
from marshmallow import fields
|
||||||
|
from marshmallow.validate import Length, Range
|
||||||
|
|
||||||
|
|
||||||
|
class UsersSchema(ma.Schema):
|
||||||
|
full_name = fields.Str(required=True, validate=Length(max=255))
|
||||||
|
email = fields.Email(required=True, validate=Length(max=255))
|
||||||
|
password = fields.Str(validate=Length(max=255))
|
||||||
|
gender = fields.Integer(required=True, validate=Range(min=1, max=2))
|
||||||
|
mobile = fields.Str(required=True, validate=Length(max=13))
|
||||||
|
user_image = fields.Str(validate=Length(max=255))
|
||||||
|
user_type = fields.Integer(required=True, validate=Range(min=1, max=2))
|
||||||
|
lang_type = fields.Integer(required=True, validate=Range(min=1, max=2))
|
||||||
|
device_type = fields.Integer(required=True, validate=Range(min=1, max=2))
|
||||||
|
device_id = fields.Str(required=True)
|
||||||
|
|
||||||
|
|
||||||
|
class CitiesSchema(ma.SQLAlchemyAutoSchema):
|
||||||
|
class Meta:
|
||||||
|
model = Cities
|
||||||
|
load_instance = True
|
||||||
|
include_relationships = True
|
||||||
|
|
||||||
|
|
||||||
|
class GamesSchema(ma.SQLAlchemyAutoSchema):
|
||||||
|
class Meta:
|
||||||
|
model = Games
|
||||||
|
load_instance = True
|
||||||
|
include_relationships = True
|
||||||
|
|
||||||
|
|
||||||
|
class PlayerAvailabilitiesSchema(ma.SQLAlchemyAutoSchema):
|
||||||
|
class Meta:
|
||||||
|
model = PlayerAvailabilities
|
||||||
|
load_instance = True
|
||||||
|
include_relationships = True
|
||||||
|
|
||||||
|
|
||||||
|
class PlayerCancelGamesSchema(ma.SQLAlchemyAutoSchema):
|
||||||
|
class Meta:
|
||||||
|
model = PlayerCancelGames
|
||||||
|
load_instance = True
|
||||||
|
include_relationships = True
|
||||||
|
|
||||||
|
|
||||||
|
class PurchaseGamesSchema(ma.SQLAlchemyAutoSchema):
|
||||||
|
class Meta:
|
||||||
|
model = PurchaseGames
|
||||||
|
load_instance = True
|
||||||
|
include_relationships = True
|
||||||
|
|
||||||
|
|
||||||
|
class SportsSchema(ma.SQLAlchemyAutoSchema):
|
||||||
|
class Meta:
|
||||||
|
model = Sports
|
||||||
|
load_instance = True
|
||||||
|
include_relationships = True
|
||||||
|
|
||||||
|
|
||||||
|
class TeamsSchema(ma.SQLAlchemyAutoSchema):
|
||||||
|
class Meta:
|
||||||
|
model = Teams
|
||||||
|
load_instance = True
|
||||||
|
include_relationships = True
|
||||||
|
|
||||||
|
|
||||||
|
class UserRatingsSchema(ma.SQLAlchemyAutoSchema):
|
||||||
|
class Meta:
|
||||||
|
model = UserRatings
|
||||||
|
load_instance = True
|
||||||
|
include_relationships = True
|
||||||
|
|
||||||
|
|
||||||
|
class VenueImagesSchema(ma.SQLAlchemyAutoSchema):
|
||||||
|
class Meta:
|
||||||
|
model = VenueImages
|
||||||
|
load_instance = True
|
||||||
|
include_relationships = True
|
||||||
|
|
||||||
|
|
||||||
|
class VenuesSchema(ma.SQLAlchemyAutoSchema):
|
||||||
|
class Meta:
|
||||||
|
model = Venues
|
||||||
|
load_instance = True
|
||||||
|
include_relationships = True
|
||||||
|
|
||||||
|
|
||||||
|
class ViewNewsSchema(ma.SQLAlchemyAutoSchema):
|
||||||
|
class Meta:
|
||||||
|
model = ViewNews
|
||||||
|
load_instance = True
|
||||||
|
include_relationships = True
|
||||||
|
|
||||||
|
|
||||||
|
class WebBookingsSchema(ma.SQLAlchemyAutoSchema):
|
||||||
|
class Meta:
|
||||||
|
model = WebBookings
|
||||||
|
load_instance = True
|
||||||
|
include_relationships = True
|
|
@ -1,8 +1,8 @@
|
||||||
from app import db
|
|
||||||
from database.models import *
|
|
||||||
from database.schema import *
|
|
||||||
from marshmallow import ValidationError
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
from app import db
|
||||||
|
from app.models import *
|
||||||
|
from app.schema import *
|
||||||
|
from marshmallow import ValidationError
|
||||||
|
|
||||||
|
|
||||||
def insert_data(schema, data):
|
def insert_data(schema, data):
|
19
src/Pipfile
19
src/Pipfile
|
@ -1,19 +0,0 @@
|
||||||
[[source]]
|
|
||||||
name = "pypi"
|
|
||||||
url = "https://pypi.org/simple"
|
|
||||||
verify_ssl = true
|
|
||||||
|
|
||||||
[dev-packages]
|
|
||||||
|
|
||||||
[packages]
|
|
||||||
twilio = "*"
|
|
||||||
flask = "*"
|
|
||||||
pymysql = "*"
|
|
||||||
flask-praetorian = "*"
|
|
||||||
flask-sqlalchemy = "*"
|
|
||||||
flask-migrate = "*"
|
|
||||||
flask-marshmallow = "*"
|
|
||||||
marshmallow = "*"
|
|
||||||
|
|
||||||
[requires]
|
|
||||||
python_version = "3.8"
|
|
|
@ -1,92 +0,0 @@
|
||||||
from app import ma
|
|
||||||
from database.models import *
|
|
||||||
from marshmallow.validate import Length, Range
|
|
||||||
|
|
||||||
|
|
||||||
class UsersSchema(ma.Schema):
|
|
||||||
full_name = ma.fields.Str(required=True, validate=Length(max=255))
|
|
||||||
email = ma.fields.Email(required=True, validate=Length(max=255))
|
|
||||||
password = ma.fields.Str(validate=Length(max=255))
|
|
||||||
gender = ma.fields.Integer(required=True, validate=Range(min=1, max=2))
|
|
||||||
mobile = ma.fields.Str(required=True, validate=Length(max=13))
|
|
||||||
user_image = ma.fields.Str(validate=Length(max=255))
|
|
||||||
user_type = ma.fields.Integer(required=True, validate=Range(min=1, max=2))
|
|
||||||
lang_type = ma.fields.Integer(required=True, validate=Range(min=1, max=2))
|
|
||||||
device_type = ma.fields.Integer(required=True, validate=Range(min=1, max=2))
|
|
||||||
device_id = ma.fields.Str(required=True)
|
|
||||||
|
|
||||||
class Meta:
|
|
||||||
model = Users
|
|
||||||
include_fk = True
|
|
||||||
|
|
||||||
|
|
||||||
class CitiesSchema(ma.Schema):
|
|
||||||
class Meta:
|
|
||||||
model = Cities
|
|
||||||
include_fk = True
|
|
||||||
|
|
||||||
|
|
||||||
class GamesSchema(ma.Schema):
|
|
||||||
class Meta:
|
|
||||||
model = Games
|
|
||||||
include_fk = True
|
|
||||||
|
|
||||||
|
|
||||||
class PlayerAvailabilitiesSchema(ma.Schema):
|
|
||||||
class Meta:
|
|
||||||
model = PlayerAvailabilities
|
|
||||||
include_fk = True
|
|
||||||
|
|
||||||
|
|
||||||
class PlayerCancelGamesSchema(ma.Schema):
|
|
||||||
class Meta:
|
|
||||||
model = PlayerCancelGames
|
|
||||||
include_fk = True
|
|
||||||
|
|
||||||
|
|
||||||
class PurchaseGamesSchema(ma.Schema):
|
|
||||||
class Meta:
|
|
||||||
model = PurchaseGames
|
|
||||||
include_fk = True
|
|
||||||
|
|
||||||
|
|
||||||
class SportsSchema(ma.Schema):
|
|
||||||
class Meta:
|
|
||||||
model = Sports
|
|
||||||
include_fk = True
|
|
||||||
|
|
||||||
|
|
||||||
class TeamsSchema(ma.Schema):
|
|
||||||
class Meta:
|
|
||||||
model = Teams
|
|
||||||
include_fk = True
|
|
||||||
|
|
||||||
|
|
||||||
class UserRatingsSchema(ma.Schema):
|
|
||||||
class Meta:
|
|
||||||
model = UserRatings
|
|
||||||
include_fk = True
|
|
||||||
|
|
||||||
|
|
||||||
class VenueImagesSchema(ma.Schema):
|
|
||||||
class Meta:
|
|
||||||
model = VenueImages
|
|
||||||
include_fk = True
|
|
||||||
|
|
||||||
|
|
||||||
class VenuesSchema(ma.Schema):
|
|
||||||
class Meta:
|
|
||||||
model = Venues
|
|
||||||
include_fk = True
|
|
||||||
|
|
||||||
|
|
||||||
class ViewNewsSchema(ma.Schema):
|
|
||||||
class Meta:
|
|
||||||
model = ViewNews
|
|
||||||
include_fk = True
|
|
||||||
|
|
||||||
|
|
||||||
class WebBookingsSchema(ma.Schema):
|
|
||||||
class Meta:
|
|
||||||
model = WebBookings
|
|
||||||
include_fk = True
|
|
Loading…
Reference in New Issue