add ip_country to contact pojo

This commit is contained in:
2024-01-22 22:57:36 +01:00
parent dee9c0a8ce
commit b773bebac4
2 changed files with 14 additions and 17 deletions
+6 -12
View File
@@ -10,21 +10,16 @@ class ContactPojo:
last_name: str
first_name: str
mail: str
ccid: str
position: int
note: str
def __init__(self, phone_number: str, passport_number: str, last_name: str, first_name: str, mail: str,
ccid: str = "",
position: int = 0):
def __init__(self, phone_number: str, passport_number: str, last_name: str, first_name: str, mail: str):
self.phone = str(phone_number).replace(".0", "")
self.passport = passport_number
self.last_name = last_name
self.first_name = first_name
self.ccid = ccid
self.mail = mail
self.position = position
self.note = ""
self.ip_country = "FR"
def to_firestore_dict(self):
dest = {
@@ -33,17 +28,16 @@ class ContactPojo:
u'last_name': self.last_name,
u'first_name': self.first_name,
u'mail': self.mail,
u'ccid': self.ccid,
u'position': self.position
u'ip_country': self.ip_country
}
return dest
@staticmethod
def get_contact_from_error_contact(errorContact: ContactInErrorPojo):
return ContactPojo(phone_number=errorContact.phone, mail=errorContact.mail, ccid=errorContact.ccid,
return ContactPojo(phone_number=errorContact.phone, mail=errorContact.mail,
last_name=errorContact.last_name, first_name=errorContact.first_name,
position=errorContact.position, passport_number=errorContact.passport)
passport_number=errorContact.passport)
@staticmethod
def from_firestore_dict(source):
@@ -54,6 +48,6 @@ class ContactPojo:
email = source['mail']
last_name = source['last_name']
first_name = source['first_name']
result = ContactPojo(ccid=ccid, phone_number=phone, passport_number=passport, position=position, mail=email,
result = ContactPojo(phone_number=phone, passport_number=passport, mail=email,
last_name=last_name, first_name=first_name)
return result