Merge branch 'master' of bitbucket.org:panleicim/appointment_tool
This commit is contained in:
Regular → Executable
+10
-1
@@ -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_"
|
||||||
@@ -248,6 +249,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]
|
||||||
@@ -279,7 +288,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
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
class RegisteredUserPojo:
|
||||||
|
phone: str
|
||||||
|
city: str
|
||||||
|
last_name: str
|
||||||
|
first_name: str
|
||||||
|
mail: str
|
||||||
|
address: str
|
||||||
|
zip_code: str
|
||||||
|
password: str = None
|
||||||
|
|
||||||
|
def __init__(self, phone_number: str, last_name: str, first_name: str, mail: str,
|
||||||
|
address: str = "",
|
||||||
|
zip_code: str = None, city: str = None):
|
||||||
|
self.phone = "0" + str(int(phone_number))
|
||||||
|
self.city = city
|
||||||
|
self.last_name = last_name
|
||||||
|
self.first_name = first_name
|
||||||
|
self.address = address
|
||||||
|
self.mail = mail
|
||||||
|
self.zip_code = zip_code
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "last_name:{}, first_name:{}, email:{}, password:{}".format(self.last_name, self.first_name, self.mail,
|
||||||
|
self.password)
|
||||||
|
|
||||||
|
def to_firestore_dict(self):
|
||||||
|
dest = {
|
||||||
|
u'phone': self.phone,
|
||||||
|
u'city': self.city,
|
||||||
|
u'last_name': self.last_name,
|
||||||
|
u'first_name': self.first_name,
|
||||||
|
u'mail': self.mail,
|
||||||
|
u'address': self.address,
|
||||||
|
u'zip_code': self.zip_code,
|
||||||
|
u'password': self.password
|
||||||
|
}
|
||||||
|
|
||||||
|
return dest
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def from_firestore_dict(source):
|
||||||
|
address = source['address']
|
||||||
|
phone = source['phone']
|
||||||
|
zip_code = source['zip_code']
|
||||||
|
city = source['city']
|
||||||
|
email = source['mail']
|
||||||
|
last_name = source['last_name']
|
||||||
|
first_name = source['first_name']
|
||||||
|
result = RegisteredUserPojo(address=address, phone_number=phone, city=city, zip_code=zip_code,
|
||||||
|
mail=email,
|
||||||
|
last_name=last_name, first_name=first_name)
|
||||||
|
if 'password' in source:
|
||||||
|
result.password = source['password']
|
||||||
|
return result
|
||||||
Reference in New Issue
Block a user