change folder name
This commit is contained in:
73
backend/mih_database/mihDbObjects.py
Normal file
73
backend/mih_database/mihDbObjects.py
Normal file
@@ -0,0 +1,73 @@
|
||||
from sqlalchemy import DateTime, Column, Integer, String
|
||||
from sqlalchemy.orm import declarative_base
|
||||
Base = declarative_base()
|
||||
|
||||
class User(Base):
|
||||
__tablename__ = 'users'
|
||||
__table_args__ = {'schema': 'app_data'}
|
||||
idusers = Column(Integer, primary_key=True)
|
||||
email = Column(String(128), nullable=False, unique=True)
|
||||
fname = Column(String(128), nullable=False)
|
||||
lname = Column(String(128), nullable=False)
|
||||
type = Column(String(128), nullable=False)
|
||||
app_id = Column(String(128), nullable=False)
|
||||
username = Column(String(128), nullable=False)
|
||||
pro_pic_path = Column(String(128), nullable=False)
|
||||
purpose = Column(String(256), nullable=False, server_default="")
|
||||
|
||||
def __repr__(self):
|
||||
return (
|
||||
f"<User(idusers={self.idusers}, email='{self.email}', "
|
||||
f"fname='{self.fname}', lname='{self.lname}', type='{self.type}', "
|
||||
f"app_id='{self.app_id}', username='{self.username}', "
|
||||
f"pro_pic_path='{self.pro_pic_path}', purpose='{self.purpose}')>"
|
||||
)
|
||||
|
||||
class Business(Base):
|
||||
__tablename__ = 'business'
|
||||
__table_args__ = {'schema': 'app_data'}
|
||||
idbusiness = Column(Integer, primary_key=True)
|
||||
business_id = Column(String(128), nullable=False, unique=True)
|
||||
Name = Column(String(128))
|
||||
type = Column(String(128))
|
||||
registration_no = Column(String(128))
|
||||
logo_name = Column(String(128))
|
||||
logo_path = Column(String(128))
|
||||
contact_no = Column(String(45))
|
||||
bus_email = Column(String(128))
|
||||
gps_location = Column(String(128))
|
||||
practice_no = Column(String(45))
|
||||
vat_no = Column(String(45))
|
||||
website = Column(String(128))
|
||||
rating = Column(String(45), server_default="''") # Changed to match image default
|
||||
mission_vision = Column(String(256))
|
||||
|
||||
def __repr__(self):
|
||||
return (
|
||||
f"<Business(idbusiness={self.idbusiness}, business_id='{self.business_id}', "
|
||||
f"Name='{self.Name}', type='{self.type}', "
|
||||
f"registration_no='{self.registration_no}', logo_name='{self.logo_name}', "
|
||||
f"logo_path='{self.logo_path}', contact_no='{self.contact_no}', "
|
||||
f"bus_email='{self.bus_email}', gps_location='{self.gps_location}', "
|
||||
f"practice_no='{self.practice_no}', vat_no='{self.vat_no}', "
|
||||
f"website='{self.website}', rating='{self.rating}', "
|
||||
f"mission_vision='{self.mission_vision}')>"
|
||||
)
|
||||
|
||||
class BusinessRating(Base):
|
||||
__tablename__ = 'business_ratings'
|
||||
__table_args__ = {'schema': 'mzansi_directory'}
|
||||
idbusiness_ratings = Column(Integer, primary_key=True)
|
||||
app_id = Column(String(128), nullable=False, server_default="")
|
||||
business_id = Column(String(128), nullable=False, server_default="")
|
||||
rating_title = Column(String(128), nullable=False, server_default="")
|
||||
rating_description = Column(String(256), nullable=False, server_default="")
|
||||
rating_score = Column(String(45), nullable=False, server_default="")
|
||||
date_time = Column(DateTime, nullable=True)
|
||||
|
||||
def __repr__(self):
|
||||
return (
|
||||
f"<BusinessRating(idbusiness_ratings={self.idbusiness_ratings}, app_id='{self.app_id}', "
|
||||
f"business_id='{self.business_id}', rating_title='{self.rating_title}', rating_description='{self.rating_description}', "
|
||||
f"rating_score='{self.rating_score}', date_time='{self.date_time}')>"
|
||||
)
|
||||
Reference in New Issue
Block a user