class Arch_Note(db.Model): __tablename__ = "arch_note" id = db.Column(db.Integer, primary_key=True) note_id = db.Column(db.Integer) title = db.Column(db.String(32)) content = db.Column(db.String(32)) comment =db.Column(db.String(32)) createdtime = db.Column( db.DateTime, default=datetime.utcnow)
class Room(GenericModel): id = db.Column('room_id', db.Integer(), primary_key=True) type = db.Column('room_type', db.String(40),) charge = db.Column('room_charge',db.Float()) status = db.Column('room_status',db.String(30)) @staticmethod def get_dummy_room(): return Room(id=0,type='',charge=0.0,status='')
class Note(db.Model): __tablename__ = "note" note_id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(32)) content = db.Column(db.String(32)) createdtime = db.Column( db.DateTime, default=datetime.utcnow) modifiedtime = db.Column( db.DateTime, default=datetime.utcnow, onupdate=datetime.utcnow )
class Status(db.Model): id_status = db.Column(db.Integer, primary_key=True, unique=True) status_name = db.Column(db.String(10), unique=True) status_description = db.Column(db.String(100)) timestamp = db.Column(db.DateTime, default=datetime.utcnow, onupdate=datetime.utcnow) def __init__(self, status_name, status_description): self.status_name = status_name self.status_description = status_description
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.BigInteger()) email = db.Column('cust_email',db.String(40)) accno = db.Column("acc_id", db.ForeignKey("account.acc_no"), unique=False, nullable=True) orderref = db.relationship("Mainorder",lazy=True,backref="custref",uselist=True) @staticmethod def get_dummy_customer(): return Customer(id=0,name='',address='',contact='',email='')
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.Integer()) website = db.Column('hotel_website', db.String(40)) accno = db.Column("acc_id", db.ForeignKey("account.acc_no"), unique=False, nullable=True) #menuref = db.relationship("Menu",secondary='menu_hotel',backref=db.backref("hotelref1",uselist=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 get_dummy_hotel(): return Hotel(id=0, name='', address='', contact=0,website='')
class userZip(db.Model, UserMixin): __tablename__ = 'userZip' id = db.Column(db.Integer, primary_key=True) usermsg = db.Column(db.String(100)) img_name = db.Column(db.String(40)) img = db.Column(db.LargeBinary(length=2048)) userId = db.Column(db.Integer, db.ForeignKey('User.userId')) def __init__(self, id, usermsg, img_name, img, userId): self.id = id self.usermsg = usermsg self.img_name = img_name self.img = img self.userId = userId
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()) href = db.relationship('Hotel',secondary=menu_hotel, backref=db.backref("menuref", lazy=True)) @staticmethod def get_dummy_menu(): return Menu(id=0,name='',price=0.0)
class Account(GenericModel): id = db.Column('acc_no', db.Integer(), primary_key=True) type = db.Column('acc_type', db.String(40)) balance = db.Column('acc_bal', db.Float()) hotelref = db.relationship(Hotel,lazy=True,backref="haccref",uselist=True) custref = db.relationship("Customer",lazy=True,backref="caccref",uselist=True) @staticmethod def get_dummy_account(): return Account(id=0,type='',balance=0.0)
class User(db.Model, UserMixin): __tablename__ = 'User' userId = db.Column(db.Integer, primary_key=True) userInfo = db.Column(db.String(20)) userPwd = db.Column(db.Integer) userPhone = db.Column(db.Integer) userzip = db.relationship('userZip') def __init__(self, userId, userInfo, userPwd, userPhone): self.userId = userId self.userInfo = userInfo self.userPwd = userPwd self.userPhone = userPhone
class Customer(db.Model): id_cliente = db.Column(db.String(25), primary_key=True, unique=True) nombre = db.Column(db.String(50)) apellido = db.Column(db.String(50)) email = db.Column(db.String(150), primary_key=True, unique=True) direccion = db.Column(db.String(250)) telefono = db.Column(db.String(25)) mobil = db.Column(db.String(25)) no_documento = db.Column(db.String(50)) timestamp = db.Column(db.DateTime, default=datetime.utcnow, onupdate=datetime.utcnow) def __init__(self, id_cliente, nombre, apellido, email, direccion, telefono, mobil, no_documento): self.id_cliente = id_cliente self.nombre = nombre self.apellido = apellido self.email = email self.direccion = direccion self.telefono = telefono self.mobil = mobil self.no_documento = no_documento
class Note(db.Model): __tablename__ = 'notes' noteId = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(100), unique=True, nullable=False) text = db.Column(db.Text, unique=False, nullable=False) date = db.Column(db.DateTime, default=datetime.utcnow) def __init__(self, **kwargs): super(Note, self).__init__(**kwargs) def __repr__(self): return '<Note %r>' % self.title @property def serialize(self): return { 'noteId': self.noteId, 'title': self.title, 'text': self.text, 'date': self.date }
class Login(GenericModel): username=db.Column('username',db.String(50),primary_key=True) password=db.Column('password',db.String(50))
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')