201 lines
7.4 KiB
Python
201 lines
7.4 KiB
Python
from sqlalchemy import Column, ForeignKey, text
|
|
from sqlalchemy.types import *
|
|
from sqlalchemy.sql import func
|
|
|
|
from database import Base
|
|
|
|
|
|
class Users(Base):
|
|
__tablename__ = "users"
|
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
|
social_id = Column(Text)
|
|
type = Column(Integer, nullable=True)
|
|
full_name = Column(String(255), index=True, nullable=False)
|
|
email = Column(String(255), index=True, unique=True, nullable=False)
|
|
password = Column(String(255))
|
|
gender = Column(Integer)
|
|
mobile = Column(String(255), unique=True, nullable=False)
|
|
user_image = Column(String(255))
|
|
city_id = Column(Integer, ForeignKey("cities.id"))
|
|
user_type = Column(Integer)
|
|
otp = Column(Integer)
|
|
otp_valid_time = Column(DateTime)
|
|
access_key = Column(Text, unique=True)
|
|
lang_type = Column(Integer)
|
|
badge = Column(Integer, server_default=text("0"))
|
|
status = Column(Integer, server_default=text("0"))
|
|
admin_status = Column(Integer, server_default=text("0"))
|
|
device_id = Column(Text)
|
|
device_type = Column(Integer)
|
|
forgot_password = Column(Integer, server_default=text("0"))
|
|
created = Column(DateTime, nullable=False, server_default=func.now())
|
|
updated = Column(DateTime, nullable=True, onupdate=func.now())
|
|
|
|
|
|
class Cities(Base):
|
|
__tablename__ = "cities"
|
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
|
name = Column(String(255), nullable=False)
|
|
image = Column(String(255))
|
|
status = Column(Enum("1", "0"))
|
|
created = Column(DateTime, nullable=False, server_default=func.now())
|
|
updated = Column(DateTime, nullable=True, onupdate=func.now())
|
|
|
|
|
|
class Games(Base):
|
|
__tablename__ = "games"
|
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
|
name = Column(String(255), nullable=False)
|
|
image = Column(String(255))
|
|
date_time = Column(DateTime)
|
|
price = Column(String(100), nullable=False)
|
|
description = Column(Text)
|
|
user_id = Column(Integer, ForeignKey("users.id"))
|
|
gender = Column(Enum("1", "2", "3"))
|
|
city_id = Column(Integer, ForeignKey("cities.id"))
|
|
venue_id = Column(Integer, ForeignKey("venues.id"))
|
|
sports_id = Column(Integer, ForeignKey("sports.id"))
|
|
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)
|
|
status = Column(Integer, server_default=text("1"))
|
|
game_status = Column(Integer, server_default=text("0"))
|
|
cancel_status = Column(Integer)
|
|
cancel_date = Column(DateTime)
|
|
noti_status = Column(Integer, server_default=text("0"))
|
|
conduct_status = Column(Integer, server_default=text("1"))
|
|
created = Column(DateTime, nullable=False, server_default=func.now())
|
|
updated = Column(DateTime, nullable=True, onupdate=func.now())
|
|
|
|
|
|
class Payments(Base):
|
|
__tablename__ = "payments"
|
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
|
user_id = Column(Integer, ForeignKey("users.id"))
|
|
game_id = Column(Integer, ForeignKey("games.id"))
|
|
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())
|
|
updated = Column(DateTime, nullable=True, onupdate=func.now())
|
|
|
|
|
|
class PlayerAvailabilities(Base):
|
|
__tablename__ = "player_availabilities"
|
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
|
game_id = Column(Integer, ForeignKey("games.id"))
|
|
player_id = Column(Integer, ForeignKey("users.id"))
|
|
status = Column(Integer)
|
|
created = Column(DateTime, nullable=False, server_default=func.now())
|
|
updated = Column(DateTime, nullable=True, onupdate=func.now())
|
|
|
|
|
|
class PlayerCancelGames(Base):
|
|
__tablename__ = "player_cancel_games"
|
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
|
player_id = Column(Integer, ForeignKey("users.id"))
|
|
game_id = Column(Integer, ForeignKey("games.id"))
|
|
created = Column(DateTime, nullable=False, server_default=func.now())
|
|
updated = Column(DateTime, nullable=True, onupdate=func.now())
|
|
|
|
|
|
class PurchaseGames(Base):
|
|
__tablename__ = "purchase_games"
|
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
|
game_id = Column(Integer, ForeignKey("games.id"))
|
|
user_id = Column(Integer, ForeignKey("users.id"))
|
|
pay_mode = Column(Integer)
|
|
created = Column(DateTime, nullable=False, server_default=func.now())
|
|
updated = Column(DateTime, nullable=True, onupdate=func.now())
|
|
|
|
|
|
class Sports(Base):
|
|
__tablename__ = "sports"
|
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
|
name = Column(String(255), nullable=False)
|
|
spanish_name = Column(String(100), nullable=False)
|
|
status = Column(Integer)
|
|
created = Column(DateTime, nullable=False, server_default=func.now())
|
|
updated = Column(DateTime, nullable=True, onupdate=func.now())
|
|
|
|
|
|
class Teams(Base):
|
|
__tablename__ = "teams"
|
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
|
user_id = Column(Integer, ForeignKey("users.id"))
|
|
team_id = Column(Enum("1", "2"))
|
|
game_id = Column(Integer, ForeignKey("games.id"))
|
|
status = Column(Integer)
|
|
created = Column(DateTime, nullable=False, server_default=func.now())
|
|
updated = Column(DateTime, nullable=True, onupdate=func.now())
|
|
|
|
|
|
class UserRatings(Base):
|
|
__tablename__ = "user_ratings"
|
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
|
game_id = Column(Integer, ForeignKey("games.id"))
|
|
user_id = Column(Integer, ForeignKey("users.id"))
|
|
player_id = Column(Integer, ForeignKey("users.id"))
|
|
rating = Column(String(100), nullable=False)
|
|
created = Column(DateTime, nullable=False, server_default=func.now())
|
|
updated = Column(DateTime, nullable=True, onupdate=func.now())
|
|
user_type = Column(Integer)
|
|
|
|
|
|
class VenueImages(Base):
|
|
__tablename__ = "venue_images"
|
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
|
venue_id = Column(Integer, ForeignKey("venues.id"))
|
|
user_id = Column(Integer, ForeignKey("users.id"))
|
|
image = Column(String(255))
|
|
created = Column(DateTime, nullable=False, server_default=func.now())
|
|
updated = Column(DateTime, nullable=True, onupdate=func.now())
|
|
|
|
|
|
class Venues(Base):
|
|
__tablename__ = "venues"
|
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
|
user_id = Column(Integer, ForeignKey("users.id"))
|
|
address = Column(Text, nullable=False)
|
|
latitude = Column(String(100))
|
|
longitude = Column(String(100))
|
|
name = Column(String(100), nullable=False)
|
|
sports_id = Column(Integer, ForeignKey("sports.id"))
|
|
created = Column(DateTime, nullable=False, server_default=func.now())
|
|
updated = Column(DateTime, nullable=True, onupdate=func.now())
|
|
|
|
|
|
class WebBookings(Base):
|
|
__tablename__ = "web_bookings"
|
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
|
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)
|
|
created = Column(DateTime, nullable=False, server_default=func.now())
|
|
updated = Column(DateTime, nullable=True, onupdate=func.now())
|