Skip to content
Snippets Groups Projects
Commit 4e6cf29c authored by RENAULT Juliette's avatar RENAULT Juliette
Browse files

Pas de nom ou de prénom de plus de 50 caractères ajouté à la base de données...

Pas de nom ou de prénom de plus de 50 caractères ajouté à la base de données et pas de description de plus de 5000 caractères.
parent 448750c7
No related branches found
No related tags found
No related merge requests found
......@@ -13,7 +13,7 @@ class Post extends StatelessWidget {
static String? link;
final Color color;
const Post({super.key, this.postData, this.postid, required this.color}) ;
const Post({Key? key, this.postData, this.postid, required this.color}) : super(key: key);
@override
Widget build(BuildContext context) {
......@@ -135,7 +135,7 @@ class Post extends StatelessWidget {
if (attributes.containsKey('indent')) {
int indentLevel = attributes['indent'];
contentWidgets.add(Padding(
padding: EdgeInsets.only(left: (indentLevel * 10).toDouble()),
padding: EdgeInsets.only(left: (indentLevel * 100).toDouble()),
child: Text(text, style: textStyle),
));
continue;
......
......@@ -389,6 +389,9 @@ Future<String> getClubDate(String clubId) async {
if (nom == null || nom.trim().isEmpty) throw Exception("Le nom du profil ne peut pas être vide.");
if (email.trim().isEmpty) throw Exception("L'email du profil ne peut pas être vide.");
if (prenom.trim().isEmpty) throw Exception("Le prénom du profil ne peut pas être vide.");
if (nom.trim().length>50) throw Exception("Le nom du profil ne peut pas dépasser 50 caractères");
if (prenom.trim().length > 50) throw Exception("Le nom du profil ne peut pas dépasser 50 caractères");
if (description!=null || description.trim().length > 5000) throw Exception("La description ne peut pas excéder 5000 caractères");
final profil = {
"email": email,
......@@ -413,6 +416,11 @@ Future<String> getClubDate(String clubId) async {
Future<void> updateProfile(String id, String? nom, String prenom, String description, Map<String, dynamic>? statut, String? urlimage, String email) async {
final profileDoc = await profileCollection.doc(id).get();
if (!profileDoc.exists) throw Exception("Le profil avec l'ID $id n'existe pas dans la base de données.");
if (nom == null || nom.trim().isEmpty) throw Exception("Le nom du profil ne peut pas être vide.");
if (prenom.trim().isEmpty) throw Exception("Le prénom du profil ne peut pas être vide.");
if (nom.trim().length > 50) throw Exception("Le nom du profil ne peut pas dépasser 50 caractères");
if (prenom.trim().length > 50) throw Exception("Le nom du profil ne peut pas dépasser 50 caractères");
if (description!=null || description.trim().length > 5000) throw Exception("La description ne peut pas excéder 5000 caractères");
try {
await profileCollection.doc(id).update({
......
......@@ -25,6 +25,11 @@ Future<void> tests() async {
grp.addUserToGroup("04ttf6IDWv5CAoUfqmrN", "$i");
}*/
//Ajout de 100 clubs à la base de données
/*for (int i=1; i<=100; i++){
data.addClub("BDD", "$i", "description");
}*/
//Suppression des 1000 comptes créés
/*for (int i=1; i<=500; i++){
data.deleteProfile("$i");
......@@ -36,11 +41,6 @@ Future<void> tests() async {
}*/
//Ajout de 100 clubs à la base de données
/*for (int i=1; i<=100; i++){
data.addclub("BDD", "$i", "description");
}*/
//Suppression des 100 clubs créés
/*for (int i=1; i<=100; i++){
String? clubId = await data.getClubIdFromName("$i");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment