insert ip_country info to links_to_validate table
This commit is contained in:
@@ -11,15 +11,17 @@ class ContactPojo:
|
||||
first_name: str
|
||||
mail: str
|
||||
note: str
|
||||
ip_country: str
|
||||
|
||||
def __init__(self, phone_number: str, passport_number: str, last_name: str, first_name: str, mail: str):
|
||||
def __init__(self, phone_number: str, passport_number: str, last_name: str, first_name: str, mail: str,
|
||||
ip_country="FR"):
|
||||
self.phone = str(phone_number).replace(".0", "")
|
||||
self.passport = passport_number
|
||||
self.last_name = last_name
|
||||
self.first_name = first_name
|
||||
self.mail = mail
|
||||
self.note = ""
|
||||
self.ip_country = "FR"
|
||||
self.ip_country = ip_country
|
||||
|
||||
def to_firestore_dict(self):
|
||||
dest = {
|
||||
@@ -30,7 +32,6 @@ class ContactPojo:
|
||||
u'mail': self.mail,
|
||||
u'ip_country': self.ip_country
|
||||
}
|
||||
|
||||
return dest
|
||||
|
||||
@staticmethod
|
||||
@@ -41,13 +42,15 @@ class ContactPojo:
|
||||
|
||||
@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']
|
||||
ip_country = "FR"
|
||||
if source.get('ip_country'):
|
||||
ip_country = source['ip_country']
|
||||
result = ContactPojo(phone_number=phone, passport_number=passport, mail=email,
|
||||
last_name=last_name, first_name=first_name)
|
||||
result.ip_country = ip_country
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user