Files
appointment_tool/pojo/SimInfoPojo.py
T
2022-03-25 09:16:27 +01:00

45 lines
1.2 KiB
Python

import time
class SimInfoPojo:
phone: str
ccid: str
update_at: int
position: int
operator: str
def __init__(self, phone: str, ccid: str, position, operator: str, update_at: int = int(time.time())):
self.phone = phone
self.ccid = ccid
self.update_at = update_at
self.position = position
self.operator = operator
@staticmethod
def from_firestore_dict(source):
phone = source['phone']
ccid = source['ccid']
update_at = None
if 'update_at' in source:
update_at = source['update_at']
position = None
if 'position' in source:
position = source['position']
result = SimInfoPojo(phone=phone, ccid=ccid, update_at=update_at, position=position, operator="")
if 'operator' in source:
operator = source['operator']
result.operator = operator
result.id = id
return result
def to_firestore_dict(self):
dest = {
u'phone': self.phone,
u'ccid': self.ccid,
u'update_at': self.update_at,
u'position': self.position,
u'operator': self.operator,
}
return dest