class Lesson(db.Model): __tablename__ = "lesson" id = db.Column(db.Integer(), primary_key=True) lesson_name = db.Column(db.String(80)) term = db.Column(db.Integer()) day_of_class = db.Column(db.String(80)) lesson_time = db.Column(db.String(80)) lesson_duration = db.Column(db.Integer()) lesson_start_date = db.Column(db.DateTime(), nullable=False, default=datetime.utcnow) lesson_cost = db.Column(db.Float()) lesson_description = db.Column(db.String(255)) def __init__(self, lesson_name, term, day_of_class, lesson_time, lesson_duration, lesson_start_date, lesson_cost, lesson_description): self.lesson_name = lesson_name self.term = term self.day_of_class = day_of_class self.lesson_time = lesson_time self.lesson_duration = lesson_duration self.lesson_cost = lesson_cost self.lesson_start_date = lesson_start_date self.lesson_cost = db.Column(db.Float()) self.lesson_description = lesson_description def __repr__(self): return f"Lesson: {self.lesson_name}"
def __init__(self, lesson_name, term, day_of_class, lesson_time, lesson_duration, lesson_start_date, lesson_cost, lesson_description): self.lesson_name = lesson_name self.term = term self.day_of_class = day_of_class self.lesson_time = lesson_time self.lesson_duration = lesson_duration self.lesson_cost = lesson_cost self.lesson_start_date = lesson_start_date self.lesson_cost = db.Column(db.Float()) self.lesson_description = lesson_description
class Class_Program(db.Model): __tablename__ = "class_program" lesson = db.relationship(Lesson) id = db.Column(db.Integer(), primary_key=True) lesson_id = db.Column(db.Integer(), db.ForeignKey('lesson.id'), nullable=False) program_name = db.Column(db.String(80)) program_cost = db.Column(db.Float()) program_discount = db.Column(db.Float()) program_description = db.Column(db.String(255)) def __init__(self, program_name, lesson_id, program_cost, program_discount, program_description): self.program_name = program_name self.lesson_id = lesson_id self.program_cost = program_cost self.program_discount = program_discount self.program_description = program_description def __repr__(self): return f"Program Name {self.program_name}"
class Payments(db.Model): __tablename__ = "payments" person = db.relationship(Person) lesson = db.relationship(Lesson) class_program = db.relationship(Class_Program) id = db.Column(db.Integer(), primary_key=True) payee_id = db.Column(db.Integer(), db.ForeignKey('person.id'), nullable=False) lesson_id = db.Column(db.Integer(), db.ForeignKey('lesson.id'), nullable=True) class_program_id = db.Column(db.Integer(), db.ForeignKey('class_program.id'), nullable=True) payment_value = db.Column(db.Float()) payment_name = db.Column(db.String(80)) payment_type = db.Column(db.String(80)) payment_date = db.Column(db.DateTime(), nullable=False, default=datetime.utcnow) includes_gst = db.Column(db.Boolean()) payment_description = db.Column(db.String(255)) def __init__(self, payee_id, lesson_id, class_program_id, payment_value, payment_name, payment_type, payment_date, includes_gst, payment_description): self.payee_id = payee_id self.lesson_id = lesson_id self.class_program_id = class_program_id self.payment_value = payment_value self.payment_name = payment_name self.payment_type = payment_type self.payment_date = payment_date self.includes_gst = includes_gst self.payment_description = payment_description def __repr__(self): return f"Payment Name: {self.payment_name} -- Payment Value: {self.payment_value} -- Payment Date: {self.payment_date}"
class Business_Costs(db.Model): __tablename__ = "business_costs" id = db.Column(db.Integer(), primary_key=True) cost_value = db.Column(db.Float()) cost_name = db.Column(db.String(80)) cost_incurred_date = db.Column(db.DateTime(), nullable=False, default=datetime.utcnow) includes_gst = db.Column(db.Boolean()) cost_description = db.Column(db.String(255)) def __init__(self, cost_value, cost_name, cost_incurred_date, includes_gst, cost_description): self.cost_value = cost_value self.cost_name = cost_value self.cost_incurred_date = cost_incurred_date self.includes_gst = includes_gst self.cost_description = cost_description def __repr__(self): return f"Type of cost: {self.cost_name} -- Cost Value: {self.cost_value}"