[IMP] pms-api-rest: add notif. rt capacity

This commit is contained in:
miguelpadin
2021-12-28 19:38:34 +01:00
committed by Darío Lodeiros
parent c3fc102f0e
commit d54344c373
4 changed files with 5 additions and 1 deletions

View File

@@ -13,3 +13,4 @@ class PmsCalendarInfo(Datamodel):
isFirstDay = fields.Boolean(required=False, allow_none=True)
isLastDay = fields.Boolean(required=False, allow_none=True)
totalPrice = fields.Float(required=False, allow_none=True)
numNotifications = fields.Integer(required=False, allow_none=True)

View File

@@ -8,3 +8,4 @@ class PmsRoomInfo(Datamodel):
id = fields.Integer(required=False, allow_none=True)
name = fields.String(required=False, allow_none=True)
roomTypeId = fields.Integer(required=False, allow_none=True)
capacity = fields.Integer(required=False, allow_none=True)

View File

@@ -46,12 +46,13 @@ class PmsCalendarService(Component):
id=line.id,
roomId=line.room_id.id,
date=datetime.combine(line.date, datetime.min.time()).isoformat(),
partnerId=line.reservation_id.partner_id.id,
partnerId=line.reservation_id.partner_id.id or None,
reservationId=line.reservation_id,
isFirstDay=line.reservation_id.checkin == line.date,
isLastDay=line.reservation_id.checkout
== (line.date + timedelta(days=1)),
totalPrice=line.reservation_id.price_total,
numNotifications=len(line.reservation_id.message_ids),
)
)
return result_lines

View File

@@ -43,6 +43,7 @@ class PmsRoomService(Component):
id=room.id,
name=room.name,
roomTypeId=room.room_type_id,
capacity=room.capacity,
)
)
return result_rooms