odapi/app/models.py

364 lines
12 KiB
Python
Raw Normal View History

from app import db
2020-04-28 20:49:13 +02:00
from sqlalchemy import text
class Users(db.Model):
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
social_id = db.Column(db.Text)
type = db.Column(db.Integer)
full_name = db.Column(db.String(255), index=True, unique=True)
email = db.Column(db.String(255), index=True, unique=True)
password = db.Column(db.String(255))
gender = db.Column(db.Integer)
mobile = db.Column(db.String(255))
user_image = db.Column(db.String(255))
city_id = db.Column(db.Integer)
user_type = db.Column(db.Integer)
otp = db.Column(db.String(255))
otp_valid_time = db.Column(db.Date)
access_key = db.Column(db.Text)
lang_type = db.Column(db.Integer)
badge = db.Column(db.Integer)
status = db.Column(db.Integer)
admin_status = db.Column(db.Integer)
device_id = db.Column(db.Text)
device_type = db.Column(db.Integer)
created = db.Column(db.TIMESTAMP, nullable=False, server_default=db.func.now())
def __init__(
self,
social_id,
type,
full_name,
email,
password,
gender,
mobile,
user_image,
city_id,
user_type,
otp,
otp_valid_time,
access_key,
lang_type,
badge,
status,
admin_status,
device_id,
device_type,
):
self.social_id = social_id
self.type = type
self.full_name = full_name
self.email = email
self.password = password
self.gender = gender
self.mobile = mobile
self.user_image = user_image
self.city_id = city_id
self.user_type = user_type
self.otp = otp
self.otp_valid_time = otp_valid_time
self.access_key = access_key
self.lang_type = lang_type
self.badge = badge
self.status = status
self.admin_status = admin_status
self.device_id = device_id
self.device_type = device_type
class Cities(db.Model):
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Column(db.String(255))
image = db.Column(db.String(255))
2020-04-28 20:49:13 +02:00
status = db.Column(db.Enum("1", "0"))
created = db.Column(db.DateTime, nullable=False, server_default=db.func.now())
2020-04-28 20:49:13 +02:00
modified = db.Column(db.DateTime, nullable=False, onupdate=db.func.now())
2020-04-28 20:49:13 +02:00
def __init__(self, name, image, status, created, modified):
self.name = name
self.image = image
self.status = status
self.created = created
2020-04-28 20:49:13 +02:00
self.modified = modified
class Games(db.Model):
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Column(db.String(255))
image = db.Column(db.String(255))
date_time = db.Column(db.DateTime)
price = db.Column(db.String(100))
description = db.Column(db.Text)
user_id = db.Column(db.Integer)
2020-04-28 20:49:13 +02:00
gender = db.Column(db.Enum("1", "2", "3"))
city_id = db.Column(db.Integer)
venue_id = db.Column(db.Integer)
sports_id = db.Column(db.Integer)
no_of_player = db.Column(db.Integer)
min_player = db.Column(db.Integer)
already_player = db.Column(db.Integer)
no_of_already_player = db.Column(db.Integer)
payment_mode = db.Column(db.Integer)
card_id = db.Column(db.Integer)
2020-04-28 20:49:13 +02:00
status = db.Column(db.Integer, server_default=text("1"))
game_status = db.Column(db.Integer, server_default=text("0"))
cancel_status = db.Column(db.Integer)
cancel_date = db.Column(db.DateTime)
2020-04-28 20:49:13 +02:00
noti_status = db.Column(db.Integer, server_default=text("0"))
conduct_status = db.Column(db.Integer, server_default=text("1"))
created = db.Column(db.DateTime, nullable=False, server_default=db.func.now())
2020-04-28 20:49:13 +02:00
modified = db.Column(db.DateTime, nullable=False, onupdate=db.func.now())
def __init__(
self,
name,
image,
date_time,
price,
description,
user_id,
gender,
city_id,
venue_id,
sports_id,
no_of_player,
min_player,
already_player,
no_of_already_player,
payment_mode,
card_id,
):
self.name = name
self.image = image
self.date_time = date_time
self.price = price
self.description = description
self.user_id = user_id
self.gender = gender
self.city_id = city_id
self.venue_id = venue_id
self.sports_id = sports_id
self.no_of_player = no_of_player
self.no_of_already_player = no_of_already_player
self.payment_mode = payment_mode
self.card_id = card_id
class Payments(db.Model):
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
user_id = db.Column(db.Integer)
game_id = db.Column(db.Integer)
amount = db.Column(db.Integer)
token = db.Column(db.String(100))
charge_id = db.Column(db.String(200))
transfer_id = db.Column(db.String(200))
transaction_id = db.Column(db.String(200))
account_no = db.Column(db.String(200))
description = db.Column(db.Text)
pay_mode = db.Column(db.Integer)
status = db.Column(db.Integer)
created = db.Column(db.DateTime, nullable=False, server_default=db.func.now())
modified = db.Column(db.DateTime, nullable=False, onupdate=db.func.now())
def __init__(
self,
user_id,
game_id,
amount,
token,
charge_id,
transfer_id,
transaction_id,
account_no,
description,
pay_mode,
status,
):
self.user_id = user_id
self.game_id = game_id
self.amount = amount
self.token = token
self.charge_id = charge_id
self.transfer_id = transfer_id
self.transaction_id = transaction_id
self.account_no = account_no
self.description = description
self.pay_mode = pay_mode
self.status = status
2020-04-28 20:49:13 +02:00
class PlayerAvailabilities(db.Model):
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
game_id = db.Column(db.Integer)
player_id = db.Column(db.Integer)
status = db.Column(db.Integer)
created = db.Column(db.DateTime, nullable=False, server_default=db.func.now())
modified = db.Column(db.DateTime, nullable=False, onupdate=db.func.now())
def __init__(
self, game_id, player_id, status,
):
self.game_id = game_id
self.player_id = player_id
self.status = status
2020-04-28 20:49:13 +02:00
class PlayerCancelGames(db.Model):
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
player_id = db.Column(db.Integer)
game_id = db.Column(db.Integer)
created = db.Column(db.DateTime, nullable=False, server_default=db.func.now())
modified = db.Column(db.DateTime, nullable=False, onupdate=db.func.now())
def __init__(
self, player_id, game_id,
):
self.player_id = player_id
self.game_id = game_id
2020-04-28 20:49:13 +02:00
class PurchaseGames(db.Model):
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
game_id = db.Column(db.Integer)
user_id = db.Column(db.Integer)
pay_mode = db.Column(db.Integer)
created = db.Column(db.DateTime, nullable=False, server_default=db.func.now())
modified = db.Column(db.DateTime, nullable=False, onupdate=db.func.now())
def __init__(
self, game_id, user_id, pay_mode,
):
self.game_id = game_id
self.user_id = user_id
self.pay_mode = pay_mode
2020-04-28 20:49:13 +02:00
class Sports(db.Model):
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Column(db.String(255))
spanish_name = db.Column(db.String(100))
status = db.Column(db.Integer)
created = db.Column(db.DateTime, nullable=False, server_default=db.func.now())
modified = db.Column(db.DateTime, nullable=False, onupdate=db.func.now())
def __init__(
self, name, spanish_name, status,
):
self.name = name
self.spanish_name = spanish_name
self.status = status
2020-04-28 20:49:13 +02:00
class Teams(db.Model):
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
user_id = db.Column(db.Integer)
2020-04-28 20:49:13 +02:00
team_id = db.Column(db.Enum("1", "2"))
game_id = db.Column(db.Integer)
status = db.Column(db.Integer)
created = db.Column(db.DateTime, nullable=False, server_default=db.func.now())
modified = db.Column(db.DateTime, nullable=False, onupdate=db.func.now())
def __init__(
self, game_id, user_id, team_id, status,
):
self.game_id = game_id
self.user_id = user_id
self.team_id = team_id
self.status = status
2020-04-28 20:49:13 +02:00
class UserRatings(db.Model):
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
game_id = db.Column(db.Integer)
user_id = db.Column(db.Integer)
2020-04-28 20:49:13 +02:00
player_id = db.Column(db.Enum("1", "2"))
rating = db.Column(db.String(100))
created = db.Column(db.DateTime, nullable=False, server_default=db.func.now())
modified = db.Column(db.DateTime, nullable=False, onupdate=db.func.now())
user_type = db.Column(db.Integer)
def __init__(self, game_id, user_id, player_id, rating, user_type):
self.game_id = game_id
self.user_id = user_id
self.player_id = player_id
self.rating = rating
self.user_type = user_type
2020-04-28 20:49:13 +02:00
class VenueImages(db.Model):
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
venue_id = db.Column(db.Integer)
user_id = db.Column(db.Integer)
image = db.Column(db.String(255))
created = db.Column(db.DateTime, nullable=False, server_default=db.func.now())
2020-04-28 20:49:13 +02:00
updated = db.Column(db.DateTime, nullable=False, onupdate=db.func.now())
def __init__(
self, venue_id, user_id, image,
):
self.venue_id = venue_id
self.user_id = user_id
self.image = image
2020-04-28 20:49:13 +02:00
class Venues(db.Model):
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
user_id = db.Column(db.Integer)
address = db.Column(db.Text)
latitude = db.Column(db.String(100))
longitude = db.Column(db.String(100))
name = db.Column(db.String(100))
sports_id = db.Column(db.Integer)
created = db.Column(db.DateTime, nullable=False, server_default=db.func.now())
modified = db.Column(db.DateTime, nullable=False, onupdate=db.func.now())
def __init__(
self, user_id, address, latitude, longitude, name, sports_id,
):
self.user_id = user_id
self.address = address
self.latitude = latitude
self.longitude = longitude
self.name = name
self.sports_id = sports_id
2020-04-28 20:49:13 +02:00
class ViewNews(db.Model):
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
news_id = db.Column(db.Integer)
user_id = db.Column(db.Integer)
created = db.Column(db.DateTime, nullable=False, server_default=db.func.now())
2020-04-28 20:49:13 +02:00
updated = db.Column(db.DateTime, nullable=False, onupdate=db.func.now())
def __init__(
self, news_id, user_id,
):
self.news_id = news_id
self.user_id = user_id
2020-04-28 20:49:13 +02:00
class WebBookings(db.Model):
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Column(db.String(255))
email = db.Column(db.String(255))
contact = db.Column(db.String(100))
message = db.Column(db.Text)
game = db.Column(db.String(255))
city = db.Column(db.String(100))
created = db.Column(db.DateTime, nullable=False, server_default=db.func.now())
updated = db.Column(db.DateTime, nullable=False, onupdate=db.func.now())
def __init__(
self, user_id, address, name, email, contact, message, game, city,
):
self.user_id = user_id
self.address = address
self.name = name
self.email = email
self.contact = contact
self.message = message
self.game = game
self.city = city