Esempio n. 1
0
 def dto_to_orm(room_dto):  # type: (RoomDTO) -> Room
     room = Room.get_or_none(number=room_dto.id)
     if room is None:
         room = Room(number=room_dto.id)
     if 'name' in room_dto.loaded_fields:
         room.name = room_dto.name
     return room
Esempio n. 2
0
 def dto_to_orm(room_dto, fields):  # type: (RoomDTO, List[str]) -> Room
     room = Room.get_or_none(number=room_dto.id)
     if room is None:
         room = Room(number=room_dto.id)
     if 'name' in fields:
         room.name = room_dto.name
     return room