Merge branch 'feature/black_list' into feature/pyapp
# Conflicts: # src/db/mongo_manager.py # src/pojo/black_contact.py
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import time
|
||||
from typing import Union
|
||||
|
||||
from pojo.contact_pojo import ContactPojo
|
||||
|
||||
|
||||
class BlackContactPojo(ContactPojo):
|
||||
update_at_in_s: float
|
||||
|
||||
def __init__(self, phone_number: str, passport_number: str, last_name: str, first_name: str, mail: str,
|
||||
update_at_in_s: Union[float, None] = None,
|
||||
ccid: str = "",
|
||||
position: int = 0, ):
|
||||
super().__init__(phone_number, passport_number, last_name, first_name, mail, ccid, position)
|
||||
if update_at_in_s:
|
||||
self.update_at_in_s = update_at_in_s
|
||||
else:
|
||||
self.update_at_in_s = time.time()
|
||||
|
||||
def to_firestore_dict(self):
|
||||
dest = super().to_firestore_dict()
|
||||
dest.setdefault(u'update_at_in_s', self.update_at_in_s)
|
||||
return dest
|
||||
|
||||
@staticmethod
|
||||
def from_firestore_dict(source):
|
||||
ccid = source['ccid']
|
||||
phone = source['phone']
|
||||
position = source['position']
|
||||
passport = source['passport']
|
||||
email = source['mail']
|
||||
last_name = source['last_name']
|
||||
first_name = source['first_name']
|
||||
update_at_in_s = source['update_at_in_s']
|
||||
result = BlackContactPojo(ccid=ccid, phone_number=phone, passport_number=passport, position=position,
|
||||
mail=email, update_at_in_s=update_at_in_s,
|
||||
last_name=last_name, first_name=first_name)
|
||||
return result
|
||||
@@ -50,8 +50,8 @@ class ContactPojo:
|
||||
position = source['position']
|
||||
passport = source['passport']
|
||||
email = source['mail']
|
||||
lastName = source['last_name']
|
||||
firstName = source['last_name']
|
||||
last_name = source['last_name']
|
||||
first_name = source['first_name']
|
||||
result = ContactPojo(ccid=ccid, phone_number=phone, passport_number=passport, position=position, mail=email,
|
||||
last_name=lastName, first_name=firstName)
|
||||
last_name=last_name, first_name=first_name)
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user