Example #1
0
 def load_room(self, room_id):  # type: (int) -> RoomDTO
     _ = self
     room = Room.select(Room, Floor) \
                .join_from(Room, Floor, join_type=JOIN.LEFT_OUTER) \
                .where(Room.number == room_id) \
                .get()  # type: Room  # TODO: Load dict
     room_dto = RoomMapper.orm_to_dto(room)
     if room.floor is not None:
         room_dto.floor = FloorMapper.orm_to_dto(room.floor)
     return room_dto
Example #2
0
 def load_rooms(self):  # type: () -> List[RoomDTO]
     _ = self
     room_dtos = []
     for room in list(Room.select(Room, Floor)
                          .join_from(Room, Floor, join_type=JOIN.LEFT_OUTER)):  # TODO: Load dicts
         room_dto = RoomMapper.orm_to_dto(room)
         if room.floor is not None:
             room_dto.floor = FloorMapper.orm_to_dto(room.floor)
         room_dtos.append(room_dto)
     return room_dtos