add operator to siminfo

This commit is contained in:
2022-03-25 09:16:27 +01:00
parent 3c4f6ec88b
commit 99dd077bb2
3 changed files with 13 additions and 7 deletions
+8 -3
View File
@@ -1,4 +1,3 @@
import datetime
import time
@@ -7,12 +6,14 @@ class SimInfoPojo:
ccid: str
update_at: int
position: int
operator: str
def __init__(self, phone: str, ccid: str, position, update_at: int = int(time.time())):
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):
@@ -24,7 +25,10 @@ class SimInfoPojo:
position = None
if 'position' in source:
position = source['position']
result = SimInfoPojo(phone=phone, ccid=ccid, update_at=update_at, position=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
@@ -34,6 +38,7 @@ class SimInfoPojo:
u'ccid': self.ccid,
u'update_at': self.update_at,
u'position': self.position,
u'operator': self.operator,
}
return dest