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 BudgetsFor(db.Model): __table_args__ = {'extend_existing': True} budgetID = db.Column(db.Integer, db.ForeignKey("budget.budgetID"), primary_key=True) expenseID = db.Column(db.Integer, db.ForeignKey("expense.expenseID"), primary_key=True)
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 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 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 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 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 compatibility_restriction(db.Model): __table_args__ = {'extend_existing': True} productAID = db.Column(db.Integer, primary_key=True) productBID = db.Column(db.Integer, primary_key=True) def get_id(self): return (self.productAID, self.productBID) def __repr__(self): return f"User('{self.productAID, self.productBID}')"
class orderstofufill(db.Model): __table_args__ = {'extend_existing': True} PK = db.Column(db.Integer, primary_key=True) OID = db.Column(db.Integer) def get_id(self): return (self.PK) def __repr__(self): return f"ordersToFufill('{self.OID}', '{self.PK}')"
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 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 orderdetails(db.Model): __tablename__= orderdetails OrderNumber = db.Column(db.Integer, unique=true, nullable=false) Price = db.Column(db.Integer, unique=false, nullable=false) Quantity = db.Column(db.Integer, unique=false, nullable=false) TotalPrice = db.Column(db.Integer, unique=false, nullable=false) ProductID = db.Column(db.Integer, db.ForeignKey('products.ProductID'), nullable=false) def__init__(self): return f"user('{self.OrderNumber}', '{self.Price}')"
class sales(db.Model): __table_args__ = {'extend_existing': True} SID = db.Column(db.Integer, primary_key=True) PID = db.Column(db.Integer) TS = db.Column(db.DECIMAL) def get_id(self): return (self.PK) def __repr__(self): return f"sales('{self.PID}', '{self.TS}')"
class employees(db.Model): __table_args__ = {'extend_existing': True} EID = db.Column(db.Integer, primary_key=True) DID = db.Column(db.Integer) payrate = db.Column(db.DECIMAL) def get_id(self): return (self.EID) def __repr__(self): return f"Employee('{self.EID}', '{self.DID}', '{self.payrate}')"
class orders(db.Model): __table_args__ = {'extend_existing': True} custID = db.Column(db.Integer) orderid = db.Column(db.Integer, primary_key=True) totalPrice = db.Column(db.Integer) def get_id(self): return (self.orderid) def __repr__(self): return f"User('{self.orderid}')"
class OrderDetail(db.Model, UserMixin): __tablename__ = 'orders_detail' __table_args__ = {'extend_existing': True} orderID = db.Column(db.Integer, db.ForeignKey('orders.orderID'), primary_key=True, nullable=False) productID = db.Column(db.Integer, db.ForeignKey('product.productID'), primary_key=True, nullable=False) quantity = db.Column(db.Integer, nullable=False)
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 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 Order(db.Model, UserMixin): __tablename__ = 'orders' __table_args__ = {'extend_existing': True} orderID = db.Column(db.Integer, primary_key=True, nullable=False) userID = db.Column(db.Integer, db.ForeignKey('users.userID'), nullable=False) statusID = db.Column(db.Integer, db.ForeignKey('status.statusID'), nullable=False) totalPrice = db.Column(db.Integer, nullable=False) date_updated = db.Column(db.DateTime, nullable=False)
class order_line(db.Model): __table_args__ = {'extend_existing': True} order_line = db.Column(db.Integer, primary_key=True) custID = db.Column(db.Integer) orderID = db.Column(db.Integer) quantity = db.Column(db.Integer) productID = db.Column(db.Integer) def get_id(self): return (self.order_line) def __repr__(self): return f"order_line('{self.order_line}', '{self.orderID}', '{self.custID}', '{self.productID}' )"
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 payroll(db.Model): __table_args__ = {'extend_existing': True} PRID = db.Column(db.Integer, primary_key=True) EID = db.Column(db.Integer) hours = db.Column(db.DECIMAL) SD = db.Column(db.DateTime) ED = db.Column(db.DateTime) def get_id(self): return (self.PRID) def __repr__(self): return f"payroll( '{self.EID}', '{self.hours}', '{self.SD}', '{self.ED}')"
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 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 Admin(db.Model): __table_args__ = {'extend_existing': True} adminID = db.Column(db.Integer, primary_key=True) def get_id(self): return (self.adminID) def __repr__(self): return f"User('{self.adminID}')"
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 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): __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 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)