class pestcontrol(db.Model, UserMixin): __tablename__ = 'PestControl' __table_args__ = {'extend_existing': False} pcID = db.Column(db.Integer, primary_key = True,nullable = False) workID = db.Column(db.Integer,db.ForeignKey('Work.workID'),nullable = False) description = db.Column(db.String(200),nullable = False) picture = db.Column(db.String(200))
class Employee(db.Model): __tablename__='Employee' EmployeeID = db.Column(db.Integer, primary_key=True) EmployeeFirstName = db.Column(db.String(20), nullable=False) EmployeeLastName = db.Column(db.String(20), nullable=False) EmployeePhone = db.Column(db.String(10), nullable=False) EmployeeJobTitle = db.Column(db.String(25), nullable=False) EmployeePayGrade = db.Column(db.Integer, nullable=True)
class landscaping(db.Model, UserMixin): __tablename__ = 'Landscaping' __table_args__ = {'extend_existing': False} lanscID = db.Column(db.Integer, primary_key = True,nullable = False) workID = db.Column(db.Integer,db.ForeignKey('Work.workID'),nullable = False) landscapingType = db.Column(db.String(200),nullable = False) description = db.Column(db.String(200),nullable = False) picture = db.Column(db.String(200))
class User(db.Model, UserMixin): __table_args__ = {'extend_existing': True} id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(20), unique=True, nullable=False) email = db.Column(db.String(120), unique=True, nullable=False) password = db.Column(db.String(60), nullable=False) def __repr__(self): return f"User('{self.username}', '{self.email}')"
class maintenance(db.Model, UserMixin): __tablename__ = 'Maintenance' __table_args__ = {'extend_existing': False} mainID = db.Column(db.Integer, primary_key = True,nullable = False) workID = db.Column(db.Integer,db.ForeignKey('Work.workID'),nullable = False) maintenanceType = db.Column(db.String(200),nullable = False) yearOrworkOrder = db.Column(db.String(200),nullable = False) description = db.Column(db.String(200),nullable = False) picture = db.Column(db.String(200))
class apartmentrehab(db.Model, UserMixin): __tablename__ = 'ApartmentRehab' __table_args__ = {'extend_existing': False} rehID = db.Column(db.Integer, primary_key = True,nullable = False) workID = db.Column(db.Integer,db.ForeignKey('Work.workID'),nullable = False) rehabType = db.Column(db.String(200),nullable = False) others = db.Column(db.String(200),nullable = True) description = db.Column(db.String(200),nullable = False) picture = db.Column(db.String(200))
class User(db.Model, UserMixin): id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(20), unique=True, nullable=False) email = db.Column(db.String(120), unique=True, nullable=False) image_file = db.Column(db.String(20), nullable=False, default='default.jpg') password = db.Column(db.String(60), nullable=False) posts = db.relationship('Post', backref='author', lazy=True) def __repr__(self): return f"User('{self.username}', '{self.email}', '{self.image_file}')"
class products(db.Model): __tablename__= products ProductID = db.Column(db.Integer, primary_key=True) NameOfProduct = db.Column(db.String(20), unique=false, nullable=False) Manufacturer = db.Column(db.String(50), unique=false, nullable=False) Price = db.Column(db.Integer, nullable=False) RAM = db.Column(db.Varchar(20), nullable=False) ScreenSize = db.Column(db.Varchar(20), nullable=False) def __init__(self): return f"User('{self.ProductID}', '{self.NameOfProduct}', '{self.Manufacturer}', '{self.Price}', '{self.Price}', '{self.Price}')"
class Product(db.Model, UserMixin): __tablename__ = 'product' __table_args__ = {'extend_existing': True} productID = db.Column(db.Integer, primary_key=True, nullable=False) productName = db.Column(db.String(50), nullable=False) categoryID = db.Column(db.Integer, db.ForeignKey('category.categoryID'), nullable=False) description = db.Column(db.String(300), unique=True, nullable=False) image = db.Column(db.String(50), nullable=False) price = db.Column(db.Integer, nullable=False) quantity = db.Column(db.Integer, nullable=False)
class UserInfo(db.Model, UserMixin): __tablename__ = 'user_info' __table_args__ = {'extend_existing': True} infoID = db.Column(db.Integer, primary_key=True) nickname = db.Column(db.Integer, nullable=False) userID = db.Column(db.Integer, db.ForeignKey('users.userID')) fullname = db.Column(db.String(50), unique=True, nullable=False) phone = db.Column(db.Integer, nullable=False) address = db.Column(db.Text(30), nullable=False) city = db.Column(db.String(20), nullable=False) state = db.Column(db.String(2), nullable=False) zipcode = db.Column(db.Integer, nullable=False)
class Users(db.Model, UserMixin): __table_args__ = {'extend_existing': True} userID = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(20), nullable=True) address = db.Column(db.String(100)) password = db.Column(db.String(60), nullable=False) def get_id(self): return (self.userID) def __repr__(self): return f"User('{self.name}', '{self.address}')"
class User(db.Model, UserMixin): __table_args__ = {'extend_existing': True} id = db.Column(db.Integer, primary_key=True) fname = db.Column(db.String(20), unique=True, nullable=False) lname = db.Column(db.String(20), unique=True, nullable=False) email = db.Column(db.String(50), unique=True, nullable=False) image_file = db.Column(db.String(20), nullable=False, default='default.jpg') password = db.Column(db.String(60), nullable=False) posts = db.relationship('Post', backref='author', lazy=True) def __repr__(self): return f"User('{self.fname}', '{self.lname}', '{self.email}', '{self.image_file}')"
class Guest(db.Model): __tablename__='Guest' GuestNumber = db.Column(db.Integer, primary_key=True) ReservationNumber = db.Column(db.Integer, nullable=False) GuestFirstName = db.Column(db.String(15), nullable=False) GuestLastName = db.Column(db.String(20), nullable=False) GuestAddress = db.Column(db.String(20), nullable=False) GuestCity = db.Column(db.String(20), nullable=False) GuestState = db.Column(db.String(2), nullable=False) GuestCountry = db.Column(db.String(15), nullable=False) GuestZipCode = db.Column(db.String(10), nullable=False) GuestPhone = db.Column(db.String(10), nullable=False) GuestEmail = db.Column(db.String(30), nullable=False) CreditCardNumber = db.Column(db.String(19), nullable=False)
class User(db.Model, UserMixin): __tablename__ = 'users' __table_args__ = {'extend_existing': True} userID = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(25), unique=True, nullable=False) passwords = db.Column(db.String(70), nullable=False) roleID = db.Column(db.Integer, db.ForeignKey('role.roleID'), nullable=False) timeStamp = db.Column(db.DateTime, nullable=False) userinfo = db.relationship("UserInfo", backref='user', lazy=True) def get_id(self): return (self.userID)
class building(db.Model, UserMixin): __tablename__ = 'Building' __table_args__ = {'extend_existing': False} buildingID = db.Column(db.Integer, primary_key=True) buildingName = db.Column(db.String(200), nullable=False) buildingAddress = db.Column(db.String(200), nullable=False) postalCode = db.Column(db.Integer, nullable=False) numberOfrooms = db.Column(db.Integer, nullable=False) units=db.relationship('unit',backref='building') def get_id(self): return (self.buildingID) def __str__(self): return self.buildingName
class Room(db.Model): __tablename__='Room' #id = db.Column(db.Integer, primary_key=True) RoomNumber = db.Column(db.Integer, primary_key=True) RoomType = db.Column(db.String(20), db.ForeignKey('RoomCategory.RoomType'), nullable=False) GuestNumber = db.Column(db.Integer, nullable=False) ReservationNumber = db.Column(db.Integer, nullable=False) RoomPrice = db.Column(db.Numeric, nullable=False)
class unit(db.Model, UserMixin): __tablename__ = 'Unit' __table_args__ = {'extend_existing': False} buildingID = db.Column(db.Integer,db.ForeignKey('Building.buildingID'), nullable=False) unitID = db.Column(db.Integer,primary_key=True) unitName = db.Column(db.String(200), nullable=False) def get_id(self): return (self.unitID)
class Post(db.Model): id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(100), nullable=False) date_posted = db.Column(db.DateTime, nullable=False, default=datetime.utcnow) content = db.Column(db.Text, nullable=False) user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False) def __repr__(self): return f"Post('{self.title}', '{self.date_posted}')"
class category(db.Model): __table_args__ = {'extend_existing': True} categoryID = db.Column(db.Integer, primary_key=True) categoryName = db.Column(db.String(100)) def get_id(self): return (self.categoryID) def __repr__(self): return f"User('{self.categoryID}')"
class products(db.Model): __table_args__ = {'extend_existing': True} productID = db.Column(db.Integer, primary_key=True) productName = db.Column(db.String(100), nullable=False) productPrice = db.Column(db.DECIMAL(10, 2)) categoryID = db.Column(db.Integer) def get_id(self): return (self.productID) def __repr__(self): return f"products('{self.productID}','{self.productName}', '{self.productPrice}')"
class work(db.Model, UserMixin): __tablename__ = 'Work' __table_args__ = {'extend_existing': False} workID = db.Column(db.Integer, primary_key=True, nullable=False) employeeID = db.Column(db.Integer,db.ForeignKey('Employee.employeeID'), nullable=False) buildingID = db.Column(db.Integer,db.ForeignKey('Building.buildingID'),nullable = False) unitID = db.Column(db.Integer, db.ForeignKey('Unit.unitID'),nullable = False) workType = db.Column(db.String(100),nullable = False) workOrdernumber = db.Column(db.String,unique=True,nullable = False) startTimeAuto = db.Column(db.DateTime,nullable = False) endTimeAuto = db.Column(db.DateTime,nullable = True) startTimeManual = db.Column(db.DateTime,nullable = False) endTimeManual = db.Column(db.DateTime,nullable = True)
class Reservation(db.Model): __tablename__='Reservation' #id = db.Column(db.Integer, primary_key=True) ReservationNumber = db.Column(db.Integer, primary_key=True) GuestNumber = db.Column(db.Integer, db.ForeignKey('Guest.GuestNumber'), nullable=False) EmployeeID = db.Column(db.Integer, db.ForeignKey('Employee.EmployeeID'), nullable=False) RoomNumber = db.Column(db.Integer, db.ForeignKey('Room.RoomNumber'), nullable=False) ReservationDate = db.Column(db.Date, nullable=False) ArrivalDate = db.Column(db.Date, nullable=False) DepartureDate = db.Column(db.Date, nullable=False) TotalNightStay = db.Column(db.Integer, nullable=False) TotalGuests = db.Column(db.Integer, nullable=False) TotalCost = db.Column(db.Numeric, nullable=False) CreditCardNumber = db.Column(db.String(19), nullable=False)
class Payment(db.Model, UserMixin): __tablename__ = 'payment' __table_args__ = {'extend_existing': True} paymentID = db.Column(db.Integer, primary_key=True, nullable=False) orderID = db.Column(db.Integer, db.ForeignKey('orders.orderID'), primary_key=True, nullable=False) userID = db.Column(db.Integer, db.ForeignKey('users.userID'), primary_key=True, nullable=False) date = db.Column('datetime', db.DateTime, nullable=False) totalPrice = db.Column(db.Integer, nullable=False) shippingMethod = db.Column(db.String(50), unique=True, nullable=False)
class employee(db.Model, UserMixin): __tablename__ = 'Employee' __table_args__ = {'extend_existing': False} employeeID = db.Column(db.Integer, primary_key=True) firstName = db.Column(db.String(200), nullable=False) lastName = db.Column(db.String(200), nullable=False) username = db.Column(db.String(200),unique=True,nullable = False) password = db.Column(db.String(70), nullable=False) phoneNumber = db.Column(db.String(12), nullable=False) email = db.Column(db.String(100), nullable=False) roleID = db.Column(db.Integer, db.ForeignKey('Role.roleID'), nullable=False) def get_id(self): return (self.employeeID)
class employee(db.Model, UserMixin): __tablename__ = 'Employee' __table_args__ = {'extend_existing': False} employeeID = db.Column(db.Integer, primary_key=True) firstName = db.Column(db.String(200), nullable=False) lastName = db.Column(db.String(200), nullable=False) username = db.Column(db.String(200), unique=True, nullable=False) password = db.Column(db.String(70), nullable=False) phoneNumber = db.Column(db.String(12), nullable=False) email = db.Column(db.String(100), nullable=False) verified = db.Column(db.Boolean, nullable=False) roleName = db.Column(db.String, nullable=False) # role = db.relationship('role', backref="roles") def get_id(self): return (self.employeeID)
class Category(db.Model, UserMixin): __tablename__ = 'category' __table_args__ = {'extend_existing': True} categoryID = db.Column(db.Integer, primary_key=True, nullable=False) categoryName = db.Column(db.String(25), nullable=False)
class Status(db.Model, UserMixin): __tablename__ = 'status' __table_args__ = {'extend_existing': True} statusID = db.Column(db.Integer, primary_key=True, nullable=False) statusName = db.Column(db.String(25), nullable=False)
class Role(db.Model, UserMixin): __tablename__ = 'role' __table_args__ = {'extend_existing': True} roleID = db.Column(db.Integer, primary_key=True, nullable=False) roleName = db.Column(db.String(25), nullable=False) user = db.relationship("User", backref='role', lazy=True)
class RoomCategory(db.Model): __tablename__='RoomCategory' #id = db.Column(db.Integer, primary_key=True) RoomType = db.Column(db.String(20), primary_key=True) RoomDescription = db.Column(db.String(40), nullable=False) RoomCapacity = db.Column(db.Integer, nullable=False)
class role(db.Model, UserMixin): __tablename__ = 'Role' __table_args__ = {'extend_existing': False} roleID = db.Column(db.Integer, primary_key=True) roleName = db.Column(db.String(25), nullable=False)