def creer_compte(self, nom, prenom, email, sexe, age, interesse_par, pays, ville, pseudo, motdepasse, photo_profil, photo_profil1, photo_profil2, description): compte = Compte(nom, prenom, email, sexe, age, interesse_par, pays, ville, pseudo, motdepasse, photo_profil, photo_profil1, photo_profil2, description) return CompteService.compte_dao.create(compte)
def find_by_pseudo(self, pseudo): with AbstractDao.connection.cursor() as cur: cur.execute( "select id, pseudo, motdepasse from account where pseudo=%s", (pseudo, )) found = cur.fetchone() if found: return Compte(found[1], found[2], found[0]) return None
def find_by_id(self, id_user): with AbstractDao.connection.cursor() as cur: cur.execute( "select id_user, nom, prenom from utilisateur where id_user=%s", (id_user, )) found = cur.fetchone() if found: return Compte(found[1], found[2], found[0]) return None
def trouver_id_avec_pseudo(self, pseudo): with AbstractDao.connection.cursor() as cur: cur.execute( "select id_user, nom, prenom, email, sexe, age, interesse_par, pays, ville, pseudo,motdepasse,photo_profil, photo_profil1, photo_profil2, description from utilisateur where pseudo=%s", (pseudo, )) found = cur.fetchone() if found: user = Compte(found[1], found[2], found[3], found[4], found[5], found[6], found[7], found[8], found[9], found[10], found[11], found[12], found[13], found[14], found[0]) id_receveur = user.id_user return id_receveur
def info_verification(self, pseudo, motdepass): with AbstractDao.connection.cursor() as cur: cur.execute( "select id_user, nom, prenom, email, sexe, age, interesse_par, pays, ville, pseudo,motdepasse,photo_profil, photo_profil1, photo_profil2, description from utilisateur where pseudo=%s and motdepasse=%s", ( pseudo, motdepass, )) found = cur.fetchone() if found: compte = Compte(found[1], found[2], found[3], found[4], found[5], found[6], found[7], found[8], found[9], found[10], found[11], found[12], found[13], found[14], found[0]) return compte
def creer_compte(self, pseudo, motdepasse): compte = Compte(pseudo, motdepasse) return compte_dao.create(compte)