예제 #1
0
class EmentaItem(db.Model):
    """docstring for EmentaItem"""
    id_item = db.Column(db.Integer, db.ForeignKey('item.id_item'), primary_key = True)
    id_ementa = db.Column(db.Integer, db.ForeignKey('ementa.id_ementa'), primary_key = True)

    def __repr__():
        return f"EmentaItem('{self.id_item}', '{self.id_ementa}')"
예제 #2
0
class ItenAlergia(db.Model):
    """docstring for ItenAlergia"""
    id_item = db.Column(db.Integer, db.ForeignKey('item.id_item'), primary_key = True)
    id_alergia = db.Column(db.Integer, db.ForeignKey('alergia.id_alergia'), primary_key = True)

    def __repr__():
        return f"ItenAlergia('{self.id_item}', '{self.id_alergia}')"
예제 #3
0
class item_consumo(db.Model):
    id_item= db.Column(db.Integer, db.ForeignKey('item.id_item'), primary_key = True)
    id_consumo = db.Column(db.Integer, db.ForeignKey('consumo.id_consumo'), primary_key = True)
    qde = db.Column(db.Integer, nullable=False)
    total = db.Column(db.Float, nullable=False)

    def __repr__():
        return f"item_consumo('{self.id_item}', '{self.id_consumo}', '{self.qde}', '{self.total}')"
예제 #4
0
class Funcionario(db.Model):
    """docstring for Funcionarios"""
    id_funcionario = db.Column(db.Integer, primary_key = True)
    nome = db.Column(db.String(256), unique=False)
    id_restaurante = db.Column(db.Integer, db.ForeignKey('restaurante.id_restaurante'), nullable=False)
    id_localconsumo = db.Column(db.Integer, db.ForeignKey('localconsumo.id_localconsumo'), nullable=False)
    
    id_consumo = db.relationship('Consumo', backref='funcionario', lazy=True)

    def __repr__():
        return f"Funcionario('{self.nome}', '{self.id_restaurante}', '{self.id_localconsumo}', '{self.id_localconsumo}')"
예제 #5
0
class Consumo(db.Model):
    """docstring for Consumo"""
    id_consumo = db.Column(db.Integer, primary_key = True)
    data_consumo = db.Column(db.DateTime, nullable=False,default=datetime.utcnow)
    id_cliente = db.Column(db.Integer, db.ForeignKey('cliente.id_cliente'), nullable=False)
    id_localconsumo = db.Column(db.Integer, db.ForeignKey('localconsumo.id_localconsumo'), nullable=False)
    id_funcionario = db.Column(db.Integer, db.ForeignKey('funcionario.id_funcionario'), nullable=False)
   
    item_consumo =db.relationship('item_consumo', backref='consumo', lazy=True)

    def __repr__():
        return f"Consumo('{self.data_consumo}', '{self.id_cliente}', '{self.id_localconsumo}', '{self.id_funcionario}')"
예제 #6
0
class Ementa(db.Model):
    """docstring for Ementas"""
    id_ementa = db.Column(db.Integer, primary_key = True)
    id_tipoementa = db.Column(db.Integer, db.ForeignKey('TipoEmenta.id_tipoementa'), nullable=False)
    id_tiporefeicao = db.Column(db.Integer, db.ForeignKey('TipoRefeicao.id_tiporefeicao'), nullable=False)
    id_restaurante = db.Column(db.Integer, db.ForeignKey('restaurante.id_restaurante'), nullable=False)
    id_dataementa = db.Column(db.Integer, db.ForeignKey('DataEmenta.id_dataementa'), nullable=False)
    
    ementaitens = db.relationship('EmentaItem', backref='ementa', lazy=True)

    def __repr__():
        return f"Ementa('{self.id_tipoementa}','{self.id_tiporefeicao}', '{self.id_restaurante}', '{self.id_dataementa}', '{self.ementaitens}')"
예제 #7
0
class Restaurante(db.Model):
    """docstring for Restaurante"""
    id_restaurante = db.Column(db.Integer, primary_key = True)
    morada = db.Column(db.String(80), unique=False)
    nome_ident = db.Column(db.String(50), unique=False)
    id_local = db.Column(db.Integer, db.ForeignKey('locais.id_local'), nullable=False) 
        
    def __repr__(self):
        return f"Restaurante('{self.id_restaurante}' ,'{self.morada}','{self.nome_ident}')"
예제 #8
0
class Localconsumo(db.Model):
    """docstring for Localconsumo"""
    id_localconsumo = db.Column(db.Integer, primary_key = True)
    designacao = db.Column(db.String(200), unique=False)
    id_restaurante = db.Column(db.Integer, db.ForeignKey('restaurante.id_restaurante'), nullable=False)

    id_consumo = db.relationship('Consumo', backref='localconsumo', lazy=True)
    id_funcionario = db.relationship('Funcionario', backref='localconsumo', lazy=True)

    def __repr__():
        return f"Localconsumo('{self.designacao}', '{self.id_restaurante}','{self.id_consumo}','{self.funcionario}')"
예제 #9
0
class Item(db.Model):
    """docstring for Itens"""
    id_item = db.Column(db.Integer, primary_key = True)
    designacao = db.Column(db.String(50), unique=False)
    preco = db.Column(db.Float, nullable=False)
    id_tipoementa = db.Column(db.Integer, db.ForeignKey('tipo_ementa.id_tipoementa'), nullable=False)

    ementaitens = db.relationship('EmentaItem', backref='item', lazy=True)
    alergia = db.relationship('ItenAlergia', backref='item', lazy=True)
    item_consumo =db.relationship('item_consumo', backref='item', lazy=True)

    def __repr__():
        return f"Item('{self.designacao}','{self.preco}', '{self.id_tipoementa}', '{self.ementaitens}', '{self.alergia}')"