2020-09-03 19:34:51 +02:00
|
|
|
from sqlalchemy import Column, DateTime, Enum, ForeignKey, Integer, String, Text, text
|
2020-06-05 01:09:55 +02:00
|
|
|
from sqlalchemy.sql import func
|
|
|
|
|
2020-09-03 19:34:51 +02:00
|
|
|
from database import Base
|
|
|
|
|
2020-06-05 01:09:55 +02:00
|
|
|
|
|
|
|
class Users(Base):
|
2020-07-03 02:03:02 +02:00
|
|
|
__tablename__ = "users"
|
|
|
|
|
2020-06-05 01:09:55 +02:00
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
|
|
|
social_id = Column(Text)
|
|
|
|
type = Column(Integer)
|
|
|
|
full_name = Column(String(255), index=True, unique=True)
|
|
|
|
email = Column(String(255), index=True, unique=True)
|
|
|
|
password = Column(String(255))
|
|
|
|
gender = Column(Integer)
|
|
|
|
mobile = Column(String(255))
|
|
|
|
user_image = Column(String(255))
|
2020-09-03 19:34:51 +02:00
|
|
|
city_id = Column(Integer, ForeignKey("cities.id"))
|
2020-06-05 01:09:55 +02:00
|
|
|
user_type = Column(Integer)
|
|
|
|
otp = Column(String(255))
|
|
|
|
otp_valid_time = Column(DateTime)
|
|
|
|
access_key = Column(Text)
|
|
|
|
lang_type = Column(Integer)
|
|
|
|
badge = Column(Integer)
|
2020-07-03 02:03:02 +02:00
|
|
|
status = Column(Integer, server_default=text("0"))
|
|
|
|
admin_status = Column(Integer, server_default=text("0"))
|
2020-06-05 01:09:55 +02:00
|
|
|
device_id = Column(Text)
|
|
|
|
device_type = Column(Integer)
|
|
|
|
created = Column(DateTime, nullable=False, server_default=func.now())
|
|
|
|
|
|
|
|
def __init__(
|
|
|
|
self,
|
|
|
|
full_name,
|
|
|
|
email,
|
|
|
|
password,
|
|
|
|
gender,
|
|
|
|
mobile,
|
|
|
|
city_id,
|
|
|
|
user_type,
|
|
|
|
lang_type,
|
|
|
|
badge,
|
|
|
|
device_id,
|
|
|
|
device_type,
|
|
|
|
social_id="",
|
|
|
|
access_key="",
|
|
|
|
user_image=None,
|
|
|
|
type=0,
|
|
|
|
):
|
|
|
|
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.access_key = access_key
|
|
|
|
self.lang_type = lang_type
|
|
|
|
self.badge = badge
|
|
|
|
self.device_id = device_id
|
|
|
|
self.device_type = device_type
|
|
|
|
|
|
|
|
|
|
|
|
class Cities(Base):
|
2020-07-03 02:03:02 +02:00
|
|
|
__tablename__ = "cities"
|
|
|
|
|
2020-06-05 01:09:55 +02:00
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
|
|
|
name = Column(String(255))
|
|
|
|
image = Column(String(255))
|
|
|
|
status = Column(Enum("1", "0"))
|
|
|
|
created = Column(DateTime, nullable=False, server_default=func.now())
|
2020-07-22 23:58:56 +02:00
|
|
|
updated = Column(DateTime, nullable=True, onupdate=func.now())
|
2020-06-05 01:09:55 +02:00
|
|
|
|
2020-07-04 20:15:55 +02:00
|
|
|
def __init__(self, name, image, status):
|
2020-06-05 01:09:55 +02:00
|
|
|
self.name = name
|
|
|
|
self.image = image
|
|
|
|
self.status = status
|
|
|
|
|
|
|
|
|
|
|
|
class Games(Base):
|
2020-07-03 02:03:02 +02:00
|
|
|
__tablename__ = "games"
|
|
|
|
|
2020-06-05 01:09:55 +02:00
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
|
|
|
name = Column(String(255))
|
|
|
|
image = Column(String(255))
|
|
|
|
date_time = Column(DateTime)
|
|
|
|
price = Column(String(100))
|
|
|
|
description = Column(Text)
|
2020-09-03 19:34:51 +02:00
|
|
|
user_id = Column(Integer, ForeignKey("users.id"))
|
2020-06-05 01:09:55 +02:00
|
|
|
gender = Column(Enum("1", "2", "3"))
|
2020-09-03 19:34:51 +02:00
|
|
|
city_id = Column(Integer, ForeignKey("cities.id"))
|
|
|
|
venue_id = Column(Integer, ForeignKey("venues.id"))
|
|
|
|
sports_id = Column(Integer, ForeignKey("sports.id"))
|
2020-06-05 01:09:55 +02:00
|
|
|
no_of_player = Column(Integer)
|
|
|
|
min_player = Column(Integer)
|
|
|
|
already_player = Column(Integer)
|
|
|
|
no_of_already_player = Column(Integer)
|
|
|
|
payment_mode = Column(Integer)
|
|
|
|
card_id = Column(Integer)
|
2020-07-03 02:03:02 +02:00
|
|
|
status = Column(Integer, server_default=text("1"))
|
|
|
|
game_status = Column(Integer, server_default=text("0"))
|
2020-06-05 01:09:55 +02:00
|
|
|
cancel_status = Column(Integer)
|
|
|
|
cancel_date = Column(DateTime)
|
2020-07-03 02:03:02 +02:00
|
|
|
noti_status = Column(Integer, server_default=text("0"))
|
|
|
|
conduct_status = Column(Integer, server_default=text("1"))
|
2020-06-05 01:09:55 +02:00
|
|
|
created = Column(DateTime, nullable=False, server_default=func.now())
|
2020-07-22 23:58:56 +02:00
|
|
|
updated = Column(DateTime, nullable=True, onupdate=func.now())
|
2020-06-05 01:09:55 +02:00
|
|
|
|
|
|
|
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(Base):
|
2020-07-03 02:03:02 +02:00
|
|
|
__tablename__ = "payments"
|
|
|
|
|
2020-06-05 01:09:55 +02:00
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
2020-09-03 19:34:51 +02:00
|
|
|
user_id = Column(Integer, ForeignKey("users.id"))
|
|
|
|
game_id = Column(Integer, ForeignKey("games.id"))
|
2020-06-05 01:09:55 +02:00
|
|
|
amount = Column(Integer)
|
|
|
|
token = Column(String(100))
|
|
|
|
charge_id = Column(String(200))
|
|
|
|
transfer_id = Column(String(200))
|
|
|
|
transaction_id = Column(String(200))
|
|
|
|
account_no = Column(String(200))
|
|
|
|
description = Column(Text)
|
|
|
|
pay_mode = Column(Integer)
|
|
|
|
status = Column(Integer)
|
|
|
|
created = Column(DateTime, nullable=False, server_default=func.now())
|
2020-07-22 23:58:56 +02:00
|
|
|
updated = Column(DateTime, nullable=True, onupdate=func.now())
|
2020-06-05 01:09:55 +02:00
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
class PlayerAvailabilities(Base):
|
2020-07-03 02:03:02 +02:00
|
|
|
__tablename__ = "player_availabilities"
|
|
|
|
|
2020-06-05 01:09:55 +02:00
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
2020-09-03 19:34:51 +02:00
|
|
|
game_id = Column(Integer, ForeignKey("games.id"))
|
|
|
|
player_id = Column(Integer, ForeignKey("users.id"))
|
2020-06-05 01:09:55 +02:00
|
|
|
status = Column(Integer)
|
|
|
|
created = Column(DateTime, nullable=False, server_default=func.now())
|
2020-07-22 23:58:56 +02:00
|
|
|
updated = Column(DateTime, nullable=True, onupdate=func.now())
|
2020-06-05 01:09:55 +02:00
|
|
|
|
|
|
|
def __init__(
|
|
|
|
self, game_id, player_id, status,
|
|
|
|
):
|
|
|
|
self.game_id = game_id
|
|
|
|
self.player_id = player_id
|
|
|
|
self.status = status
|
|
|
|
|
|
|
|
|
|
|
|
class PlayerCancelGames(Base):
|
2020-07-03 02:03:02 +02:00
|
|
|
__tablename__ = "player_cancel_games"
|
|
|
|
|
2020-06-05 01:09:55 +02:00
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
2020-09-03 19:34:51 +02:00
|
|
|
player_id = Column(Integer, ForeignKey("users.id"))
|
|
|
|
game_id = Column(Integer, ForeignKey("games.id"))
|
2020-06-05 01:09:55 +02:00
|
|
|
created = Column(DateTime, nullable=False, server_default=func.now())
|
2020-07-22 23:58:56 +02:00
|
|
|
updated = Column(DateTime, nullable=True, onupdate=func.now())
|
2020-06-05 01:09:55 +02:00
|
|
|
|
|
|
|
def __init__(
|
|
|
|
self, player_id, game_id,
|
|
|
|
):
|
|
|
|
self.player_id = player_id
|
|
|
|
self.game_id = game_id
|
|
|
|
|
|
|
|
|
|
|
|
class PurchaseGames(Base):
|
2020-07-03 02:03:02 +02:00
|
|
|
__tablename__ = "purchase_games"
|
|
|
|
|
2020-06-05 01:09:55 +02:00
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
2020-09-03 19:34:51 +02:00
|
|
|
game_id = Column(Integer, ForeignKey("games.id"))
|
|
|
|
user_id = Column(Integer, ForeignKey("users.id"))
|
2020-06-05 01:09:55 +02:00
|
|
|
pay_mode = Column(Integer)
|
|
|
|
created = Column(DateTime, nullable=False, server_default=func.now())
|
2020-07-22 23:58:56 +02:00
|
|
|
updated = Column(DateTime, nullable=True, onupdate=func.now())
|
2020-06-05 01:09:55 +02:00
|
|
|
|
|
|
|
def __init__(
|
|
|
|
self, game_id, user_id, pay_mode,
|
|
|
|
):
|
|
|
|
self.game_id = game_id
|
|
|
|
self.user_id = user_id
|
|
|
|
self.pay_mode = pay_mode
|
|
|
|
|
|
|
|
|
|
|
|
class Sports(Base):
|
2020-07-03 02:03:02 +02:00
|
|
|
__tablename__ = "sports"
|
|
|
|
|
2020-06-05 01:09:55 +02:00
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
|
|
|
name = Column(String(255))
|
|
|
|
spanish_name = Column(String(100))
|
|
|
|
status = Column(Integer)
|
|
|
|
created = Column(DateTime, nullable=False, server_default=func.now())
|
2020-07-22 23:58:56 +02:00
|
|
|
updated = Column(DateTime, nullable=True, onupdate=func.now())
|
2020-06-05 01:09:55 +02:00
|
|
|
|
|
|
|
def __init__(
|
|
|
|
self, name, spanish_name, status,
|
|
|
|
):
|
|
|
|
self.name = name
|
|
|
|
self.spanish_name = spanish_name
|
|
|
|
self.status = status
|
|
|
|
|
|
|
|
|
|
|
|
class Teams(Base):
|
2020-07-03 02:03:02 +02:00
|
|
|
__tablename__ = "teams"
|
|
|
|
|
2020-06-05 01:09:55 +02:00
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
2020-09-03 19:34:51 +02:00
|
|
|
user_id = Column(Integer, ForeignKey("users_id"))
|
2020-06-05 01:09:55 +02:00
|
|
|
team_id = Column(Enum("1", "2"))
|
2020-09-03 19:34:51 +02:00
|
|
|
game_id = Column(Integer, ForeignKey("games_id"))
|
2020-06-05 01:09:55 +02:00
|
|
|
status = Column(Integer)
|
|
|
|
created = Column(DateTime, nullable=False, server_default=func.now())
|
2020-07-22 23:58:56 +02:00
|
|
|
updated = Column(DateTime, nullable=True, onupdate=func.now())
|
2020-06-05 01:09:55 +02:00
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
class UserRatings(Base):
|
2020-07-03 02:03:02 +02:00
|
|
|
__tablename__ = "user_ratings"
|
|
|
|
|
2020-06-05 01:09:55 +02:00
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
2020-09-03 19:34:51 +02:00
|
|
|
game_id = Column(Integer, ForeignKey("games_id"))
|
|
|
|
user_id = Column(Integer, ForeignKey("users_id"))
|
|
|
|
player_id = Column(Integer, ForeignKey("users_id"))
|
2020-06-05 01:09:55 +02:00
|
|
|
rating = Column(String(100))
|
|
|
|
created = Column(DateTime, nullable=False, server_default=func.now())
|
2020-07-22 23:58:56 +02:00
|
|
|
updated = Column(DateTime, nullable=True, onupdate=func.now())
|
2020-06-05 01:09:55 +02:00
|
|
|
user_type = Column(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
|
|
|
|
|
|
|
|
|
|
|
|
class VenueImages(Base):
|
2020-07-03 02:03:02 +02:00
|
|
|
__tablename__ = "venue_images"
|
|
|
|
|
2020-06-05 01:09:55 +02:00
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
2020-09-03 19:34:51 +02:00
|
|
|
venue_id = Column(Integer, ForeignKey("venues_id"))
|
|
|
|
user_id = Column(Integer, ForeignKey("users_id"))
|
2020-06-05 01:09:55 +02:00
|
|
|
image = Column(String(255))
|
|
|
|
created = Column(DateTime, nullable=False, server_default=func.now())
|
2020-07-04 20:15:55 +02:00
|
|
|
updated = Column(DateTime, nullable=True, onupdate=func.now())
|
2020-06-05 01:09:55 +02:00
|
|
|
|
|
|
|
def __init__(
|
|
|
|
self, venue_id, user_id, image,
|
|
|
|
):
|
|
|
|
self.venue_id = venue_id
|
|
|
|
self.user_id = user_id
|
|
|
|
self.image = image
|
|
|
|
|
|
|
|
|
|
|
|
class Venues(Base):
|
2020-07-03 02:03:02 +02:00
|
|
|
__tablename__ = "venues"
|
|
|
|
|
2020-06-05 01:09:55 +02:00
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
2020-09-03 19:34:51 +02:00
|
|
|
user_id = Column(Integer, ForeignKey("users_id"))
|
2020-06-05 01:09:55 +02:00
|
|
|
address = Column(Text)
|
|
|
|
latitude = Column(String(100))
|
|
|
|
longitude = Column(String(100))
|
|
|
|
name = Column(String(100))
|
2020-09-03 19:34:51 +02:00
|
|
|
sports_id = Column(Integer, ForeignKey("sports_id"))
|
2020-06-05 01:09:55 +02:00
|
|
|
created = Column(DateTime, nullable=False, server_default=func.now())
|
2020-07-22 23:58:56 +02:00
|
|
|
updated = Column(DateTime, nullable=True, onupdate=func.now())
|
2020-06-05 01:09:55 +02:00
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
class ViewNews(Base):
|
2020-07-03 02:03:02 +02:00
|
|
|
__tablename__ = "view_news"
|
|
|
|
|
2020-06-05 01:09:55 +02:00
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
|
|
|
news_id = Column(Integer)
|
2020-09-03 19:34:51 +02:00
|
|
|
user_id = Column(Integer, ForeignKey("users_id"))
|
2020-06-05 01:09:55 +02:00
|
|
|
created = Column(DateTime, nullable=False, server_default=func.now())
|
2020-07-04 20:15:55 +02:00
|
|
|
updated = Column(DateTime, nullable=True, onupdate=func.now())
|
2020-06-05 01:09:55 +02:00
|
|
|
|
|
|
|
def __init__(
|
|
|
|
self, news_id, user_id,
|
|
|
|
):
|
|
|
|
self.news_id = news_id
|
|
|
|
self.user_id = user_id
|
|
|
|
|
|
|
|
|
|
|
|
class WebBookings(Base):
|
2020-07-03 02:03:02 +02:00
|
|
|
__tablename__ = "web_bookings"
|
|
|
|
|
2020-06-05 01:09:55 +02:00
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
|
|
|
name = Column(String(255))
|
|
|
|
email = Column(String(255))
|
|
|
|
contact = Column(String(100))
|
|
|
|
message = Column(Text)
|
|
|
|
game = Column(String(255))
|
|
|
|
city = Column(String(100))
|
|
|
|
created = Column(DateTime, nullable=False, server_default=func.now())
|
2020-07-04 20:15:55 +02:00
|
|
|
updated = Column(DateTime, nullable=True, onupdate=func.now())
|
2020-06-05 01:09:55 +02:00
|
|
|
|
|
|
|
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
|