Exemple #1
0
class Mainorder(GenericModel):
    id = db.Column('order_id', db.Integer(), primary_key=True)
    cid = db.Column('cust_id',
                    db.ForeignKey("customer.cust_id"),
                    nullable=False,
                    unique=False)
    hid = db.Column('hotel_id',
                    db.ForeignKey("hotel.hotel_id"),
                    nullable=False,
                    unique=False)
    billamount = db.Column('total_bill', db.Float())
Exemple #2
0
class ProcessedOrder(GenericModel):
    id = db.Column('pr_order_id', db.Integer(), primary_key=True)
    orderId = db.Column("order_id",
                        db.ForeignKey("mainorder.order_id"),
                        unique=False)
    menuid = db.Column("menus",
                       db.ForeignKey("menu.menu_id"),
                       unique=False,
                       nullable=True)
    roomid = db.Column("room",
                       db.ForeignKey("room.room_id"),
                       unique=False,
                       nullable=True)
    finalprice = db.Column('menu_price', db.Float())
    qty = db.Column('menu_qty', db.Integer())
Exemple #3
0
class Hotel(GenericModel):
    id = db.Column('hotel_id', db.Integer(), primary_key=True)
    name = db.Column('hotel_name', db.String(40), unique=True)
    address = db.Column('hotel_address', db.String(40))
    contact = db.Column('hotel_contact', db.String(40))
    website = db.Column('hotel_website', db.String(40))
    accno = db.Column("acc_id",
                      db.ForeignKey("account.acc_no"),
                      unique=True,
                      nullable=True)
    roomref = db.relationship("Room",
                              secondary=room_hotel,
                              backref=db.backref("rhotelref", uselist=True))
    orderref = db.relationship("Mainorder",
                               lazy=True,
                               backref="ohotelref",
                               uselist=True)

    @staticmethod
    def dummy_hotel():
        return Hotel(id=0, name='', address='', contact=0, website='')
Exemple #4
0
class Customer(GenericModel):
    id = db.Column('cust_id', db.Integer(), primary_key=True)
    name = db.Column('cust_name', db.String(40), unique=True)
    address = db.Column(
        'cust_address',
        db.String(40),
    )
    contact = db.Column('cust_contact', db.Integer())
    email = db.Column('cust_email', db.String(40))
    accno = db.Column("acc_id",
                      db.ForeignKey("account.acc_no"),
                      unique=True,
                      nullable=True)
    orderref = db.relationship("Mainorder",
                               lazy=True,
                               backref="custref",
                               uselist=True)

    @staticmethod
    def dummy_cust():
        return Customer(id=0, name='', address='', contact='', email='')
Exemple #5
0
from hotel_web_application.config import db, app


class GenericModel(db.Model):
    __abstract__ = True
    created = db.Column(db.DateTime, default=db.func.current_timestamp())
    updated = db.Column(db.DateTime,
                        default=db.func.current_timestamp(),
                        onupdate=db.func.current_timestamp())
    active = db.Column('active', db.String(10), default='Yes')


menu_hotel = db.Table(
    'menu_hotel',
    db.Column('menu_id', db.ForeignKey('menu.menu_id'), unique=False),
    db.Column('hotel_id', db.ForeignKey('hotel.hotel_id'), unique=False))


#Menu(id=991,name='XXXXX',price=394.45,hotelid=12)
class Menu(GenericModel):
    id = db.Column('menu_id', db.Integer(), primary_key=True)
    name = db.Column(
        'menu_name',
        db.String(40),
    )
    price = db.Column('menu_price', db.Float(), default=350.0)
    href = db.relationship('Hotel',
                           secondary=menu_hotel,
                           backref=db.backref("menuref", lazy=True))

    @staticmethod