示例#1
0
class Locais(db.Model):
    """docstring for User"""
    id_local = db.Column(db.Integer, primary_key = True)
    distritos = db.Column(db.String(50), unique=False)
    freguesia= db.Column(db.String(50), unique=False)
    addresses = db.relationship('Restaurante', backref='locais', lazy=True)

    def __repr__(self):
        return f"Locais('{self.distrito}', '{self.freguesia}')"
示例#2
0
class Cliente(db.Model):
    """docstring for Cliente"""
    id_cliente = db.Column(db.Integer, primary_key = True)
    nome = db.Column(db.String(25), unique=False)
    nif = db.Column(db.String(10), unique=True)
    consumo = db.relationship('Consumo', backref='cliente', lazy=True)

    def __repr__():
        return f"Cliente('{self.nome}', '{self.nif}')"
示例#3
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}')"
示例#4
0
class TipoEmenta(db.Model):
    """docstring for TipoEmenta"""
    id_tipoementa = db.Column(db.Integer, primary_key = True)
    tipo_ementa = db.Column(db.String(30), unique=False)

    id_item = db.relationship('Item', backref='tipo_ementa', lazy=True)
    #id_ementa = db.relationship('Ementa', backref='tipoementa', lazy=True)

    def __repr__():
        return f"TipoEmenta('{self.tipo_ementa}')"
示例#5
0
class TipoItem(db.Model):
    """docstring for TipoItem"""
    id_tipoitem = db.Column(db.Integer, primary_key = True)
    tipo_item = db.Column(db.String(50), unique=False)
    
    #id_item = db.relationship('Item', backref='tipoitem', lazy=True)


    def __repr__():
        return f"TipoItem('{self.id_tipoitem}', '{self.tipo_item}', '{self.id_item}')"
示例#6
0
class TipoRefeicao(db.Model):
    """docstring for TipoRefeicao"""
    id_tiporefeicao = db.Column(db.Integer, primary_key = True)
    tipo_refeicao = db.Column(db.String(80), unique=False)
    
    #ementa = db.relationship('Ementa', backref='tiporefeicao', lazy=True)


    def __repr__():
        return f"TipoRefeicao('{self.tipo_refeicao}')"
示例#7
0
class Alergia(db.Model):
    """docstring for Alergia"""
    id_alergia = db.Column(db.Integer, primary_key = True)
    detalhes = db.Column(db.String(100), unique=False) 
    
    alergia = db.relationship('ItenAlergia', backref='alergia', lazy=True)
 

    def __repr__():
        return f"Alergia('{self.detalhes}', '{self.alergia}')"
示例#8
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}')"
示例#9
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}')"
示例#10
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}')"