2020-10-08 20:47:10 +02:00
|
|
|
from sqlalchemy import Column, ForeignKey, text
|
|
|
|
from sqlalchemy.types import *
|
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)
|
2020-09-10 23:59:06 +02:00
|
|
|
type = Column(Integer, nullable=True)
|
2020-09-17 17:35:11 +02:00
|
|
|
full_name = Column(String(255), index=True, nullable=False)
|
2020-09-10 23:59:06 +02:00
|
|
|
email = Column(String(255), index=True, unique=True, nullable=False)
|
2020-06-05 01:09:55 +02:00
|
|
|
password = Column(String(255))
|
|
|
|
gender = Column(Integer)
|
2020-09-17 17:35:11 +02:00
|
|
|
mobile = Column(String(255), unique=True, nullable=False)
|
2020-06-05 01:09:55 +02:00
|
|
|
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)
|
2020-09-25 09:57:51 +02:00
|
|
|
otp = Column(Integer)
|
2020-06-05 01:09:55 +02:00
|
|
|
otp_valid_time = Column(DateTime)
|
2020-09-22 13:59:29 +02:00
|
|
|
access_key = Column(Text, unique=True)
|
2020-06-05 01:09:55 +02:00
|
|
|
lang_type = Column(Integer)
|
2020-09-17 17:35:11 +02:00
|
|
|
badge = Column(Integer, server_default=text("0"))
|
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)
|
2020-10-08 20:47:10 +02:00
|
|
|
forgot_password = Column(Integer, server_default=text("0"))
|
2020-06-05 01:09:55 +02:00
|
|
|
created = Column(DateTime, nullable=False, server_default=func.now())
|
2020-09-17 17:35:11 +02:00
|
|
|
updated = Column(DateTime, nullable=True, onupdate=func.now())
|
2020-06-05 01:09:55 +02:00
|
|
|
|
|
|
|
|
|
|
|
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)
|
2020-09-10 23:59:06 +02:00
|
|
|
name = Column(String(255), nullable=False)
|
2020-06-05 01:09:55 +02:00
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
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)
|
2020-09-10 23:59:06 +02:00
|
|
|
name = Column(String(255), nullable=False)
|
2020-06-05 01:09:55 +02:00
|
|
|
image = Column(String(255))
|
|
|
|
date_time = Column(DateTime)
|
2020-09-10 23:59:06 +02:00
|
|
|
price = Column(String(100), nullable=False)
|
2020-06-05 01:09:55 +02:00
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
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)
|
2020-09-10 23:59:06 +02:00
|
|
|
name = Column(String(255), nullable=False)
|
|
|
|
spanish_name = Column(String(100), nullable=False)
|
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
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
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-09-10 23:59:06 +02:00
|
|
|
rating = Column(String(100), nullable=False)
|
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
|
|
|
user_type = Column(Integer)
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
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-09-10 23:59:06 +02:00
|
|
|
address = Column(Text, nullable=False)
|
2020-06-05 01:09:55 +02:00
|
|
|
latitude = Column(String(100))
|
|
|
|
longitude = Column(String(100))
|
2020-09-10 23:59:06 +02:00
|
|
|
name = Column(String(100), nullable=False)
|
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
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
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)
|
2020-09-10 23:59:06 +02:00
|
|
|
name = Column(String(255), nullable=False)
|
|
|
|
email = Column(String(255), nullable=False)
|
|
|
|
contact = Column(String(100), nullable=False)
|
|
|
|
message = Column(Text, nullable=False)
|
|
|
|
game = Column(String(255), nullable=False)
|
|
|
|
city = Column(String(100), nullable=False)
|
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())
|