Exemple #1
0
def insert_category():
    category = Category(
        name='comida',
        description='nada além disso, estamos todos com fome, então vamos comer'
    )
    session.add(category)
    session.commit()
Exemple #2
0
def insert_employee():
    employe = Employee(nome='Jaime Ossada',
                       cpf='4605552220',
                       cargo='Cozinheiro',
                       setor='Cozinha')
    session.add(employe)
    session.commit()
Exemple #3
0
def insert_resident():
    resident = Resident(name='Kauan',
                        rg='45646545',
                        cpf='123132',
                        phone='465465')
    session.add(resident)
    session.commit()
Exemple #4
0
def insert_order():
    order = Order(id_resident=1,
                  id_room=1,
                  date='2018-05-12',
                  status='a',
                  total_value='1000')
    session.add(order)
    session.commit()
def insert_resident_account():
    resident_account = ResidentAccount(id_resident=1,
                                       id_room=1,
                                       openned='2018-05-12',
                                       closed='2018-05-12',
                                       status='a',
                                       value=200)
    session.add(resident_account)
    session.commit()
Exemple #6
0
def insert_services():
    service = Service(id_category=1,
                      id_employee=1,
                      name='coca cola',
                      description='beba uma cocacola e seja feliz para sempre',
                      value=500)

    session.add(service)
    session.commit()
def create_new_account(*, resident, room, openned, closed, status, value):
    account = ResidentAccount(id_resident=resident.id_resident,
                              id_room=room.id_room,
                              openned=openned,
                              closed=closed,
                              status=status,
                              value=value)
    session.add(account)
    session.commit()
    return account
def insert_employee():
    employe = Employee(
        name='WhiteSummeRK',
        cpf='4605552220',
        rg='475294403',
        phone='19989648989',
        pwd='123',
    )
    session.add(employe)
    session.commit()
def insert_resident():
    resident = Resident(
        name='Kauan',
        rg='45646545',
        cpf='123132',
        phone='465465',
        username='******',
        pwd='123',
    )
    session.add(resident)
    session.commit()
def save_employee(*, name: str, pwd: str, rg: str, cpf: str, phone: str):
    try:
        employee = Employee(username=name,
                            name=name,
                            pwd=pwd,
                            rg=rg,
                            cpf=cpf,
                            phone=phone)
        session.add(employee)
        session.commit()
    except Exception as e:
        session.rollback()
def save_resident(*, name: str, rg: str, cpf: str, phone: str, pwd: str):
    try:
        resident = Resident(username=name,
                            name=name,
                            rg=rg,
                            cpf=cpf,
                            phone=phone,
                            pwd=pwd)
        session.add(resident)
        session.commit()
    except Exception as e:
        session.rollback()
Exemple #12
0
def insert_users():
    kauan = User(username='******',
                 pwd='123',
                 name='Kauan Alves',
                 is_adm=True,
                 activity=True)
    session.add(kauan)
    session.commit()

    hospede01 = User(username='******',
                     pwd='123',
                     name='Hospede 01',
                     is_adm=False,
                     activity=False)
    session.add(hospede01)
    session.commit()
def insert_rooms():
    room1 = Room(number=12,
                 floor=1,
                 description="Quarto do primeiro andar",
                 daily_value=120.90,
                 status='Livre')

    session.add(room1)
    session.commit()

    room2 = Room(number=13,
                 floor=1,
                 description="Quarto do segundo andar",
                 daily_value=110.90,
                 status='Livre')

    session.add(room2)
    session.commit()

    room3 = Room(number=14,
                 floor=1,
                 description="Quarto do primeiro andar",
                 daily_value=23.90,
                 status='Livre')

    session.add(room3)
    session.commit()
Exemple #14
0
def insert_rooms():
    room1 = Room(number=10,
                 floor=1,
                 description="Quarto do primeiro andar",
                 daily_value=89.90,
                 status='Livre')

    session.add(room1)
    session.commit()

    room2 = Room(number=20,
                 floor=1,
                 description="Quarto do primeiro andar",
                 daily_value=89.90,
                 status='Livre')

    session.add(room2)
    session.commit()

    room3 = Room(number=30,
                 floor=1,
                 description="Quarto do primeiro andar",
                 daily_value=89.90,
                 status='Livre')

    session.add(room3)
    session.commit()
def query_insert_order(json):
    for item in json['service']:
        order = Order(id_resident=int(json['id_resident']),
                      id_room=int(json['id_room']),
                      date=str(datetime.now().strftime('%d/%m/%Y %H:%M:%S')),
                      status='0',
                      total_value=float(item['unit_value']))
        session.add(order)
        session.commit()
        session.query_property()
        item_order = ItemOrder(
            id_order=order.id_order,
            id_service=int(item['id_service']),
            id_employee=1,
            amount=str(
                item['qtde']
            ),  #parabéns pra quem modelou isso como varchar no banco
            value=int(item['unit_value']) * float(item['qtde']),
            status=0)
        session.add(item_order)
        session.commit()
        session.query_property()
def insert_orders():
    pedido1 = Order(id_resident=1,
                    id_room=1,
                    date=datetime.now().strftime('%d/%m/%Y %H:%M:%S'),
                    status='0',
                    total_value=199.00)
    session.add(pedido1)
    session.commit()

    pedido2 = Order(id_resident=1,
                    id_room=1,
                    date=datetime.now().strftime('%d/%m/%Y %H:%M:%S'),
                    status='1',
                    total_value=199.00)
    session.add(pedido2)
    session.commit()

    pedido3 = Order(id_resident=1,
                    id_room=1,
                    date=datetime.now().strftime('%d/%m/%Y %H:%M:%S'),
                    status='2',
                    total_value=199.00)
    session.add(pedido3)
    session.commit()
Exemple #17
0
def save_resident(*, name: str, rg: str, cpf: str, phone: str):
    resident = Resident(name=name, rg=rg, cpf=cpf, phone=phone)
    session.add(resident)
    session.commit()