@ -806,24 +806,12 @@ class AppDatabase {
Future<List<Commande>> getCommandes() async {
final db = await database;
final result = await db.query('''
SELECT
SELECT c.*, cl.nom as clientNom, cl.prenom as clientPrenom, cl.email as clientEmail
c.*,
FROM commandes c
cl.nom as clientNom,
LEFT JOIN clients cl ON c.clientId = cl.id
cl.prenom as clientPrenom,
ORDER BY c.dateCommande DESC
cl.email as clientEmail,
''');
u.nom as commandeurNom,
u.prenom as commandeurPrenom,
pdv.nom as pointDeVenteNom,
pdv.id as pointDeVenteId
LEFT JOIN users u ON c.commandeurId = u.id
LEFT JOIN points_de_vente pdv ON u.point_de_vente_id = pdv.id
return result.map((row) => Commande.fromMap(row.fields)).toList();
}
@ -11,7 +11,7 @@ class DatabaseConfig {
static const String localDatabase = 'guycom';
// Production (public) MySQL settings
static const String prodHost = '185.70.105.157';
static const String prodHost = '102.17.52.31';
static const String prodUsername = 'guycom';
static const String prodPassword = '3iV59wjRdbuXAPR';
static const String prodDatabase = 'guycom';