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}')"
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}')"
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}')"
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}')"
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}')"
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}')"
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}')"
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}')"
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}')"