support ip_country field

This commit is contained in:
2024-01-23 23:33:55 +01:00
parent 97c2b9ce8c
commit aa26e17e99
12 changed files with 147 additions and 60 deletions
+6 -2
View File
@@ -1,13 +1,17 @@
class LinkPojo():
def __init__(self, url, email, updated_at):
def __init__(self, url, email, updated_at, ip_country):
self.url = url
self.email = email
self.updated_at = updated_at
self.ip_country = ip_country
@staticmethod
def from_firestore_dict(source):
updated_at = source['updated_at']
email = source['email']
url = source['url']
result = LinkPojo(email=email, url=url, updated_at=updated_at)
ip_country = "FR"
if source.get('ip_country'):
ip_country = source['ip_country']
result = LinkPojo(email=email, url=url, updated_at=updated_at, ip_country=ip_country)
return result