def find_all(offset: int = 0, limit: int = 20) -> list[FlightToFlightPlan]:
        log.debug("Looking for all flight to flight plan, offset=%s, limit=%s", offset, limit)

        rows = db.all("SELECT * FROM flight_to_flight_plan ORDER BY start_date OFFSET %(offset)s LIMIT %(limit)s",
                      offset=offset,
                      limit=limit)

        return [FlightToFlightPlan.construct(**row._asdict()) for row in rows]
    def find_all(offset: int = 0, limit: int = 20) -> list[Color]:
        log.debug("Looking for all color, limit=%s", limit)

        rows = db.all("SELECT * FROM color ORDER BY id  OFFSET  %(offset)s LIMIT %(limit)s",
                      offset=offset,
                      limit=limit)

        return [Color.construct(**row._asdict()) for row in rows]
Esempio n. 3
0
    def find_all(offset: int = 0, limit: int = 20) -> list[ArrDep]:
        log.debug("Looking for all arr_dep, limit=%s", limit)

        rows = db.all("SELECT * FROM arr_dep ORDER BY code  OFFSET  %(offset)s LIMIT %(limit)s",
                      offset=offset,
                      limit=limit)

        return [ArrDep.construct(**row._asdict()) for row in rows]
Esempio n. 4
0
    def find_all(offset: int = 0, limit: int = 20) -> list[IntDom]:
        log.debug("Looking for all int_dom, limit=%s", limit)

        rows = db.all(
            "SELECT * FROM int_dom ORDER BY code  OFFSET  %(offset)s LIMIT %(limit)s",
            offset=offset,
            limit=limit)

        return [IntDom.construct(**row._asdict()) for row in rows]
Esempio n. 5
0
    def find_all(offset: int = 0, limit: int = 20) -> list[ServiceType]:
        log.debug("Looking for all service_type, limit=%s", limit)

        rows = db.all(
            "SELECT * FROM service_type ORDER BY code  OFFSET  %(offset)s LIMIT %(limit)s",
            offset=offset,
            limit=limit)

        return [ServiceType.construct(**row._asdict()) for row in rows]
Esempio n. 6
0
    def find_all(offset: int = 0, limit: int = 20) -> list[FlightPlan]:
        log.debug("Looking for all schedules, limit=%s", limit)

        rows = db.all(
            "SELECT * FROM schedule ORDER BY id  OFFSET  %(offset)s LIMIT %(limit)s",
            offset=offset,
            limit=limit)

        return [Schedule.construct(**row._asdict()) for row in rows]
    def find_all_by_flight_date(flight_date_from: datetime,
                                flight_date_to: datetime,
                                limit: int = 20) -> list[Flight]:
        log.debug("Looking for all flights from=%s to=%s, limit=%s",
                  flight_date_from, flight_date_to, limit)

        where = "flight.flight_date >= %(flight_date_from)s"

        if flight_date_to:
            where = where + " AND flight.flight_date <= %(flight_date_to)s"

        rows = db.all("SELECT * FROM flight WHERE " + where +
                      " ORDER BY flight_date LIMIT %(limit)s",
                      flight_date_from=flight_date_from,
                      flight_date_to=flight_date_to,
                      limit=limit)

        return [Flight.construct(**row._asdict()) for row in rows]
 def find_all_by_ids(ids: list[str]) -> Optional[list[Flight]]:
     log.debug("Looking for flight with ids=%s", ids)
     clean_ids = ["'" + str(int(i)) + "'" for i in ids]
     rows = db.all(
         f"SELECT * FROM flight WHERE id IN ({','.join(clean_ids)})")
     return [Flight.construct(**row._asdict()) for row in rows]