feat: Implement Database Service and ViewModels for Messages and Support Requests
- Added DatabaseService to handle database operations for messages and support requests. - Created IDatabaseService interface to define the contract for database operations. - Developed ViewModels for Dashboard, Messages, and Support pages to manage data and commands. - Implemented XAML views for Dashboard, Messages, and Support, including data binding and UI elements. - Created SQL script for setting up the database schema and inserting test data.
This commit is contained in:
311
COMMANDS.md
Normal file
311
COMMANDS.md
Normal file
@@ -0,0 +1,311 @@
|
||||
# Commandes Utiles - TravelMate Admin
|
||||
|
||||
## 🔧 Développement
|
||||
|
||||
### Restaurer les packages
|
||||
```bash
|
||||
dotnet restore
|
||||
```
|
||||
|
||||
### Build le projet
|
||||
```bash
|
||||
# MacCatalyst
|
||||
dotnet build -f net10.0-maccatalyst
|
||||
|
||||
# Windows
|
||||
dotnet build -f net10.0-windows10.0.19041.0
|
||||
|
||||
# Android
|
||||
dotnet build -f net10.0-android
|
||||
|
||||
# iOS
|
||||
dotnet build -f net10.0-ios
|
||||
```
|
||||
|
||||
### Lancer l'application
|
||||
```bash
|
||||
# MacCatalyst
|
||||
dotnet build -t:Run -f net10.0-maccatalyst
|
||||
|
||||
# Windows
|
||||
dotnet build -t:Run -f net10.0-windows10.0.19041.0
|
||||
```
|
||||
|
||||
### Nettoyer le projet
|
||||
```bash
|
||||
dotnet clean
|
||||
rm -rf TravelMateAdmin/bin TravelMateAdmin/obj
|
||||
```
|
||||
|
||||
### Rebuild complet
|
||||
```bash
|
||||
dotnet clean
|
||||
dotnet restore
|
||||
dotnet build
|
||||
```
|
||||
|
||||
## 🗄️ Base de Données
|
||||
|
||||
### Créer la base de données
|
||||
```bash
|
||||
mysql -u root -p < database_setup.sql
|
||||
```
|
||||
|
||||
### Se connecter à MySQL
|
||||
```bash
|
||||
mysql -u root -p travelmateadmin
|
||||
```
|
||||
|
||||
### Afficher les tables
|
||||
```sql
|
||||
USE travelmateadmin;
|
||||
SHOW TABLES;
|
||||
```
|
||||
|
||||
### Voir les données
|
||||
```sql
|
||||
-- Tous les messages
|
||||
SELECT * FROM messages ORDER BY created_at DESC;
|
||||
|
||||
-- Messages en attente
|
||||
SELECT * FROM messages WHERE done = FALSE;
|
||||
|
||||
-- Statistiques
|
||||
SELECT
|
||||
COUNT(*) as total,
|
||||
SUM(done = FALSE) as pending,
|
||||
SUM(done = TRUE) as completed
|
||||
FROM messages;
|
||||
```
|
||||
|
||||
### Ajouter un message de test
|
||||
```sql
|
||||
INSERT INTO messages (nom, prenom, email, message, done, created_at)
|
||||
VALUES ('Test', 'User', 'test@example.com', 'Ceci est un test', FALSE, NOW());
|
||||
```
|
||||
|
||||
### Marquer tous les messages comme non traités
|
||||
```sql
|
||||
UPDATE messages SET done = FALSE;
|
||||
UPDATE support_requests SET done = FALSE;
|
||||
```
|
||||
|
||||
### Réinitialiser les données
|
||||
```bash
|
||||
mysql -u root -p travelmateadmin < database_setup.sql
|
||||
```
|
||||
|
||||
### Backup de la base
|
||||
```bash
|
||||
mysqldump -u root -p travelmateadmin > backup_$(date +%Y%m%d_%H%M%S).sql
|
||||
```
|
||||
|
||||
### Restore depuis un backup
|
||||
```bash
|
||||
mysql -u root -p travelmateadmin < backup_20260112_143000.sql
|
||||
```
|
||||
|
||||
## 📦 NuGet Packages
|
||||
|
||||
### Voir les packages installés
|
||||
```bash
|
||||
dotnet list TravelMateAdmin/TravelMateAdmin.csproj package
|
||||
```
|
||||
|
||||
### Mettre à jour un package
|
||||
```bash
|
||||
dotnet add TravelMateAdmin/TravelMateAdmin.csproj package CommunityToolkit.Mvvm
|
||||
dotnet add TravelMateAdmin/TravelMateAdmin.csproj package MySqlConnector
|
||||
```
|
||||
|
||||
### Mettre à jour tous les packages
|
||||
```bash
|
||||
dotnet list TravelMateAdmin/TravelMateAdmin.csproj package --outdated
|
||||
```
|
||||
|
||||
## 🐛 Debugging
|
||||
|
||||
### Voir les logs
|
||||
Dans le terminal où vous avez lancé l'app, les logs apparaissent via :
|
||||
```csharp
|
||||
System.Diagnostics.Debug.WriteLine("Mon log");
|
||||
```
|
||||
|
||||
### Tests de connexion MySQL
|
||||
```bash
|
||||
# Tester si MySQL est accessible
|
||||
nc -zv localhost 3306
|
||||
|
||||
# Voir les processus MySQL
|
||||
ps aux | grep mysql
|
||||
|
||||
# Démarrer MySQL (Mac avec Homebrew)
|
||||
brew services start mysql
|
||||
|
||||
# Démarrer MySQL (Linux)
|
||||
sudo service mysql start
|
||||
|
||||
# Démarrer MySQL (MAMP)
|
||||
# Utiliser l'interface MAMP
|
||||
```
|
||||
|
||||
## 📱 Plateforme Spécifique
|
||||
|
||||
### MacCatalyst - Voir les logs système
|
||||
```bash
|
||||
log stream --predicate 'processImagePath contains "TravelMateAdmin"' --level debug
|
||||
```
|
||||
|
||||
### Android - Voir les logs
|
||||
```bash
|
||||
adb logcat | grep TravelMateAdmin
|
||||
```
|
||||
|
||||
### iOS Simulator - Voir les logs
|
||||
```bash
|
||||
xcrun simctl spawn booted log stream --level debug | grep TravelMateAdmin
|
||||
```
|
||||
|
||||
## 🔍 Code Analysis
|
||||
|
||||
### Format le code
|
||||
```bash
|
||||
dotnet format TravelMateAdmin/TravelMateAdmin.csproj
|
||||
```
|
||||
|
||||
### Analyser le code
|
||||
```bash
|
||||
dotnet build /p:TreatWarningsAsErrors=true
|
||||
```
|
||||
|
||||
## 📊 Statistiques du Projet
|
||||
|
||||
### Compter les lignes de code
|
||||
```bash
|
||||
find TravelMateAdmin -name "*.cs" -not -path "*/obj/*" -not -path "*/bin/*" | xargs wc -l
|
||||
```
|
||||
|
||||
### Voir l'arborescence
|
||||
```bash
|
||||
tree -I 'bin|obj' TravelMateAdmin/
|
||||
```
|
||||
|
||||
### Taille du projet
|
||||
```bash
|
||||
du -sh TravelMateAdmin/
|
||||
```
|
||||
|
||||
## 🚀 Publication
|
||||
|
||||
### Publish MacCatalyst
|
||||
```bash
|
||||
dotnet publish -f net10.0-maccatalyst -c Release -p:CreatePackage=true
|
||||
```
|
||||
|
||||
### Publish Windows
|
||||
```bash
|
||||
dotnet publish -f net10.0-windows10.0.19041.0 -c Release
|
||||
```
|
||||
|
||||
### Créer un package pour Mac App Store
|
||||
```bash
|
||||
dotnet publish -f net10.0-maccatalyst -c Release \
|
||||
-p:RuntimeIdentifier=maccatalyst-arm64 \
|
||||
-p:CreatePackage=true \
|
||||
-p:CodesignKey="Apple Distribution: Your Name" \
|
||||
-p:CodesignProvision="Your Provisioning Profile"
|
||||
```
|
||||
|
||||
## 🧪 Tests (futur)
|
||||
|
||||
### Ajouter un projet de tests
|
||||
```bash
|
||||
dotnet new xunit -n TravelMateAdmin.Tests
|
||||
dotnet sln add TravelMateAdmin.Tests/TravelMateAdmin.Tests.csproj
|
||||
dotnet add TravelMateAdmin.Tests reference TravelMateAdmin/TravelMateAdmin.csproj
|
||||
```
|
||||
|
||||
### Lancer les tests
|
||||
```bash
|
||||
dotnet test
|
||||
```
|
||||
|
||||
## 📝 Git
|
||||
|
||||
### Initialiser le repo
|
||||
```bash
|
||||
git init
|
||||
git add .
|
||||
git commit -m "Initial commit: TravelMate Admin MAUI app"
|
||||
```
|
||||
|
||||
### Ignorer les fichiers de build
|
||||
Le `.gitignore` est déjà configuré pour :
|
||||
- bin/, obj/
|
||||
- .vs/, .vscode/
|
||||
- Configuration sensible
|
||||
|
||||
### Créer une branche
|
||||
```bash
|
||||
git checkout -b feature/nouvelle-fonctionnalite
|
||||
```
|
||||
|
||||
## 🔐 Sécurité
|
||||
|
||||
### Chiffrer la configuration (exemple)
|
||||
```bash
|
||||
# Générer une clé
|
||||
openssl rand -base64 32
|
||||
|
||||
# Chiffrer un fichier
|
||||
openssl enc -aes-256-cbc -salt -in AppSettings.cs -out AppSettings.cs.enc
|
||||
|
||||
# Déchiffrer
|
||||
openssl enc -d -aes-256-cbc -in AppSettings.cs.enc -out AppSettings.cs
|
||||
```
|
||||
|
||||
## 🛠️ Maintenance
|
||||
|
||||
### Vérifier les dépendances obsolètes
|
||||
```bash
|
||||
dotnet list package --outdated
|
||||
```
|
||||
|
||||
### Mettre à jour .NET
|
||||
```bash
|
||||
# Vérifier la version actuelle
|
||||
dotnet --version
|
||||
|
||||
# Télécharger la dernière version
|
||||
# https://dotnet.microsoft.com/download
|
||||
```
|
||||
|
||||
### Nettoyer NuGet cache
|
||||
```bash
|
||||
dotnet nuget locals all --clear
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 💡 Tips & Tricks
|
||||
|
||||
### Hot Reload
|
||||
Lors du développement, les changements XAML sont appliqués en temps réel avec Hot Reload.
|
||||
|
||||
### Raccourcis Visual Studio
|
||||
- `F5` : Run avec debug
|
||||
- `Ctrl+F5` (Cmd+F5 Mac) : Run sans debug
|
||||
- `Shift+F5` : Stop debugging
|
||||
|
||||
### Performance
|
||||
```bash
|
||||
# Build en Release pour tester les performances réelles
|
||||
dotnet build -c Release -f net10.0-maccatalyst
|
||||
```
|
||||
|
||||
### Multi-targeting
|
||||
Pour cibler plusieurs plateformes en une fois :
|
||||
```bash
|
||||
dotnet build
|
||||
# Build toutes les plateformes définies dans TargetFrameworks
|
||||
```
|
||||
Reference in New Issue
Block a user