예제 #1
0
async def get_all_customers_in_db(offset: int = 0,
                                  limit: int = 10) -> List[CustomerInResp]:
    query = select([Customer, ps.User]).select_from(Customer.join(
        ps.User)).offset(offset).limit(limit)
    customers = await database.fetch_all(query)
    return customers
예제 #2
0
async def find_customer_by_id(_id: UUID) -> CustomerInResp:
    query = select([Customer, ps.User]).select_from(Customer.join(
        ps.User)).where(Customer.columns.customer_id == _id)
    customer = await database.fetch_one(query)
    return customer