use email address as id

This commit is contained in:
2023-12-27 17:27:51 +01:00
parent f944566b32
commit 5244a06579
Regular → Executable
+10 -1
View File
@@ -10,6 +10,7 @@ from src.pojo.accepted_appointment_pojo import AcceptedAppointmentPojo
from src.pojo.black_contact import BlackContactPojo from src.pojo.black_contact import BlackContactPojo
from src.pojo.contact_pojo import ContactPojo from src.pojo.contact_pojo import ContactPojo
from src.pojo.mail.mail_pojo import MailAddress from src.pojo.mail.mail_pojo import MailAddress
from src.pojo.users.regisered_user_pojo import RegisteredUserPojo
MONGO_DB_URL = "mongo.lpaconsulting.fr" MONGO_DB_URL = "mongo.lpaconsulting.fr"
CAPTCHA_ERROR_COLLECTION_PREFIX = "CAPTCHA_ERROR_" CAPTCHA_ERROR_COLLECTION_PREFIX = "CAPTCHA_ERROR_"
@@ -246,6 +247,14 @@ class MongoDbManager:
except Exception as error: except Exception as error:
self.logger.info(error) self.logger.info(error)
def get_all_registered_users(self) -> list:
_collection_name = "Registered_users"
_cursor = self.db[_collection_name]
registered_user_list = []
for document in _cursor.find():
registered_user_list.append(RegisteredUserPojo.from_firestore_dict(document))
return registered_user_list
def remove_email_from_destination_email_list(self, mail: MailAddress): def remove_email_from_destination_email_list(self, mail: MailAddress):
# DESTINATION_EMAIL_LIST # DESTINATION_EMAIL_LIST
collection = self.db[DESTINATION_EMAIL_LIST] collection = self.db[DESTINATION_EMAIL_LIST]
@@ -277,7 +286,7 @@ class MongoDbManager:
collection_to_use = self.db[LINKS_TO_VALIDATE] collection_to_use = self.db[LINKS_TO_VALIDATE]
updated_at = time.strftime("%H:%M:%S", time.localtime()) updated_at = time.strftime("%H:%M:%S", time.localtime())
if len(mail_address) > 0: if len(mail_address) > 0:
collection_to_use.replace_one(filter={'_id': link, }, replacement={ collection_to_use.replace_one(filter={'_id': mail_address, }, replacement={
u'url': link, u'url': link,
u'email': mail_address, u'email': mail_address,
"updated_at": updated_at "updated_at": updated_at