class Image(Base): __tablename__ = 'image' image_url = db.Column(db.String, nullable=True) package_id = db.Column(db.Integer, db.ForeignKey('package.id'), nullable=False) def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) def __repr__(self): return '<amenity %r>' % self.image_url
class Course(Base): __tablename__ = 'course' course = db.Column(db.String, nullable=True) college_id = db.Column(db.Integer, db.ForeignKey('college.id'), nullable=False) def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) def __repr__(self): return '<course %r>' % self.course
class Availability(Base): __tablename__ = 'availability' date = db.Column(db.DateTime, nullable=True) package_id = db.Column(db.Integer, db.ForeignKey('package.id'), nullable=False) def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) def __repr__(self): return '<date %r>' % self.date
class CollegeSelectedPackage(Base): __tablename__ = 'college_selected_package' college_id = db.Column(db.Integer, db.ForeignKey('college.id')) college = db.relationship('College', foreign_keys=college_id) package_id = db.Column(db.Integer, db.ForeignKey('package.id')) package = db.relationship('Package', foreign_keys=package_id) booking_date = db.Column(db.DateTime, nullable=True) def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) def __repr__(self): return '<college_id %r>' % self.college_id
class Base(db.Model): __abstract__ = True id = db.Column('id', db.Integer, primary_key=True, index=True) created_at = db.Column('created_at', db.DateTime(timezone=True), default=db.func.current_timestamp()) updated_at = db.Column('updated_at', db.DateTime(timezone=True), default=db.func.current_timestamp(), onupdate=db.func.current_timestamp()) def save(self): db.session.add(self) db.session.commit() db.session.flush() @staticmethod def join_query(class_name, join, filter, order): return db.session.query(class_name).join(join).order_by(order).filter( filter).all() @staticmethod def insert(obj): db.session.add(obj) db.session.commit() db.session.flush() @staticmethod def update_db(): db.session.commit() db.session.flush() @classmethod def merge(cls, obj): db.session.merge(obj) db.session.commit() @staticmethod def delete_db(obj): db.session.delete(obj) db.session.commit()
class Student(Base): __tablename__ = 'student' name = db.Column(db.String, nullable=True) email = db.Column(db.String, nullable=True) phone = db.Column(db.String, nullable=True) course = db.Column(db.String, nullable=True) date = db.Column(db.DateTime, nullable=True) college_id = db.Column(db.Integer, db.ForeignKey('college.id'), nullable=False) package_id = db.Column(db.Integer, db.ForeignKey('package.id'), nullable=False) def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) def __repr__(self): return '<no_of_day %r>' % self.no_of_day
class Day(Base): __tablename__ = 'day' no_of_day = db.Column(db.Integer, nullable=True) venue_name = db.Column(db.String, nullable=True) venue_image_url = db.Column(db.String, nullable=True) description = db.Column(db.Text, nullable=True) timing = db.Column(db.String, nullable=True) package_id = db.Column(db.Integer, db.ForeignKey('package.id'), nullable=False) def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) def __repr__(self): return '<no_of_day %r>' % self.no_of_day
class College(Base): __tablename__ = 'college' institution_name = db.Column(db.String, nullable=True) college_domain = db.Column(db.String, nullable=True) courses = db.relationship('Course', backref='college') no_of_student = db.Column(db.Integer, nullable=True) no_of_employees = db.Column(db.Integer, nullable=True) coordiantor_name = db.Column(db.String, nullable=True) coordiantor_phone = db.Column(db.String, nullable=True) city = db.Column(db.String, nullable=True) username = db.Column(db.String, nullable=True) password = db.Column(db.String, nullable=True) address = db.Column(db.String, nullable=True) email = db.Column(db.String, nullable=True) phone = db.Column(db.String, nullable=True) bank_name = db.Column(db.String, nullable=True) account_holder = db.Column(db.String, nullable=True) ifsc_code = db.Column(db.String, nullable=True) account_no = db.Column(db.String, nullable=True) packages = db.relationship('Package', secondary='college_selected_package') def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) def __repr__(self): return '<no_of_day %r>' % self.no_of_day
class Package(Base): __tablename__ = 'package' title = db.Column(db.String, nullable=False) venue = db.Column(db.String, nullable=True) meal_plan = db.Column(db.String, nullable=True) trip_duration = db.Column(db.String, nullable=True) about_trip = db.Column(db.String, nullable=True) about_venue = db.Column(db.String, nullable=True) tour_category = db.Column(db.String, nullable=True) tour_domain = db.Column(db.String, nullable=True) mg_min_pax = db.Column(db.Integer, nullable=True) max_pax = db.Column(db.Integer, nullable=True) price = db.Column(db.Integer, nullable=True) days = db.relationship('Day', backref='package') images = db.relationship('Image', backref='package') amenities = db.relationship('Amenity', backref='package') availabilities = db.relationship('Availability', backref='package') def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) def __repr__(self): return '<title %r>' % self.title
class Application(Base): __tablename__ = 'applications' first_name = db.Column(db.String, nullable=False) last_name = db.Column(db.String, nullable=False) email = db.Column(db.String, nullable=True) phone = db.Column(db.String, nullable=True) department = db.Column(db.String, nullable=True) post = db.Column(db.String, nullable=True) experience = db.Column(db.String, nullable=True) qualification = db.Column(db.String, nullable=True) address = db.Column(db.String, nullable=True) landmark = db.Column(db.String, nullable=True) gender = db.Column(db.String, nullable=True) date_of_birth = db.Column(db.DateTime, nullable=True) college_name = db.Column(db.String, nullable=True) referral = db.Column(db.String, nullable=True) resume = db.Column(db.String, nullable=True) def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) def __repr__(self): return '<name %r>' % self.name