add slot_position and sim_position

This commit is contained in:
2022-03-25 22:44:43 +01:00
parent a025c8c9fa
commit cd8d837aaf
4 changed files with 24 additions and 18 deletions
+12 -2
View File
@@ -7,25 +7,33 @@ class SimInfoPojo:
update_at: int
position: int
operator: str
slot_position: str
sim_position: str
def __init__(self, phone: str, ccid: str, position, operator: str, update_at: int = int(time.time())):
def __init__(self, phone: str, ccid: str, position, operator: str, slot_position, sim_position,
update_at: int = int(time.time())):
self.phone = phone
self.ccid = ccid
self.update_at = update_at
self.position = position
self.operator = operator
self.slot_position = slot_position
self.sim_position = sim_position
@staticmethod
def from_firestore_dict(source):
phone = source['phone']
ccid = source['ccid']
sim_position = source['sim_position']
slot_position = source['slot_position']
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="")
result = SimInfoPojo(phone=phone, ccid=ccid, update_at=update_at, sim_position=sim_position,
slot_position=slot_position, position=position, operator="")
if 'operator' in source:
operator = source['operator']
result.operator = operator
@@ -39,6 +47,8 @@ class SimInfoPojo:
u'update_at': self.update_at,
u'position': self.position,
u'operator': self.operator,
u'slot_position': self.slot_position,
u'sim_position': self.sim_position,
}
return dest