Files
afterwork/BACKEND_CONFIGURATION.md
dahoud 92612abbd7 fix(chat): Correction race condition + Implémentation TODOs
## Corrections Critiques

### Race Condition - Statuts de Messages
- Fix : Les icônes de statut (✓, ✓✓, ✓✓ bleu) ne s'affichaient pas
- Cause : WebSocket delivery confirmations arrivaient avant messages locaux
- Solution : Pattern Optimistic UI dans chat_bloc.dart
  - Création message temporaire immédiate
  - Ajout à la liste AVANT requête HTTP
  - Remplacement par message serveur à la réponse
- Fichier : lib/presentation/state_management/chat_bloc.dart

## Implémentation TODOs (13/21)

### Social (social_header_widget.dart)
-  Copier lien du post dans presse-papiers
-  Partage natif via Share.share()
-  Dialogue de signalement avec 5 raisons

### Partage (share_post_dialog.dart)
-  Interface sélection d'amis avec checkboxes
-  Partage externe via Share API

### Média (media_upload_service.dart)
-  Parsing JSON réponse backend
-  Méthode deleteMedia() pour suppression
-  Génération miniature vidéo

### Posts (create_post_dialog.dart, edit_post_dialog.dart)
-  Extraction URL depuis uploads
-  Documentation chargement médias

### Chat (conversations_screen.dart)
-  Navigation vers notifications
-  ConversationSearchDelegate pour recherche

## Nouveaux Fichiers

### Configuration
- build-prod.ps1 : Script build production avec dart-define
- lib/core/constants/env_config.dart : Gestion environnements

### Documentation
- TODOS_IMPLEMENTED.md : Documentation complète TODOs

## Améliorations

### Architecture
- Refactoring injection de dépendances
- Amélioration routing et navigation
- Optimisation providers (UserProvider, FriendsProvider)

### UI/UX
- Amélioration thème et couleurs
- Optimisation animations
- Meilleure gestion erreurs

### Services
- Configuration API avec env_config
- Amélioration datasources (events, users)
- Optimisation modèles de données
2026-01-10 10:43:17 +00:00

4.5 KiB

🔧 Configuration Backend AfterWork

Confirmation

OUI, le backend mic-after-work-server-impl-quarkus-main est bien le backend associé à l'application Flutter afterwork !

📁 Chemins

  • Backend : C:\Users\dadyo\PersonalProjects\mic-after-work-server-impl-quarkus-main
  • Frontend : C:\Users\dadyo\PersonalProjects\lions-workspace\afterwork

🔍 Correspondances Vérifiées

Élément Backend Frontend
Entités Events, Users, Friendship Event, User, Friend
Endpoints /users, /events Urls.authenticateUser, Urls.createEvent
Base de données afterwork_db (PostgreSQL) -
Port 8080 Configuré sur 192.168.1.8:8080
Authentification POST /users/authenticate authenticateUser()

🚀 Démarrage du Backend

Prérequis

  1. PostgreSQL installé et en cours d'exécution
  2. Base de données afterwork_db créée
  3. Utilisateur PostgreSQL afterwork avec mot de passe @ft3rw0rk

Commandes

# Se déplacer dans le répertoire backend
cd C:\Users\dadyo\PersonalProjects\mic-after-work-server-impl-quarkus-main

# Démarrer en mode développement
mvn clean compile quarkus:dev

Le backend démarrera sur : http://localhost:8080

Vérification

Une fois démarré, vérifiez :

🗄️ Configuration Base de Données

Créer la Base de Données

-- Connexion à PostgreSQL
psql -U postgres

-- Créer la base de données
CREATE DATABASE afterwork_db;

-- Créer l'utilisateur
CREATE USER afterwork WITH PASSWORD '@ft3rw0rk';

-- Donner les permissions
GRANT ALL PRIVILEGES ON DATABASE afterwork_db TO afterwork;

-- Connexion à la base
\c afterwork_db

-- Donner les permissions sur le schéma
GRANT ALL ON SCHEMA public TO afterwork;

👤 Création d'un Utilisateur de Test

Comme le fichier import.sql est vide, vous devez créer un utilisateur via l'API :

Option 1 : Via Swagger UI

  1. Accédez à http://localhost:8080/q/swagger-ui
  2. Trouvez l'endpoint POST /users
  3. Cliquez sur "Try it out"
  4. Utilisez ce JSON :
{
  "nom": "Doe",
  "prenoms": "John",
  "email": "test@example.com",
  "motDePasse": "password123",
  "role": "USER",
  "profileImageUrl": "https://via.placeholder.com/150"
}

Option 2 : Via curl

curl -X POST http://localhost:8080/users `
  -H "Content-Type: application/json" `
  -d '{
    \"nom\": \"Doe\",
    \"prenoms\": \"John\",
    \"email\": \"test@example.com\",
    \"motDePasse\": \"password123\",
    \"role\": \"USER\",
    \"profileImageUrl\": \"https://via.placeholder.com/150\"
  }'

Option 3 : Via SQL Direct

-- Connexion à la base
psql -U afterwork -d afterwork_db

-- Insérer un utilisateur (le mot de passe sera haché par le backend)
INSERT INTO users (id, nom, prenoms, email, mot_de_passe, role, profile_image_url, created_at, updated_at)
VALUES (
  gen_random_uuid(),
  'Doe',
  'John',
  'test@example.com',
  '$2a$10$N.zmdr9k7uOCQb376NoUnuTJ8iAt6Z5EHsM8lE9P8jW9TjnOvQF9G', -- BCrypt hash de "password123"
  'USER',
  'https://via.placeholder.com/150',
  NOW(),
  NOW()
);

🔐 Identifiants de Test

Une fois l'utilisateur créé :

Email : test@example.com
Mot de passe : password123

🌐 Configuration Réseau

Backend

  • Adresse locale : http://localhost:8080
  • Adresse réseau : http://192.168.1.8:8080

Frontend (Flutter)

  • Configuré pour se connecter à : http://192.168.1.8:8080
  • Fichier de configuration : lib/core/constants/env_config.dart

🧪 Test de l'Authentification

# Créer un utilisateur
curl -X POST http://192.168.1.8:8080/users `
  -H "Content-Type: application/json" `
  -d '{\"nom\":\"Doe\",\"prenoms\":\"John\",\"email\":\"test@example.com\",\"motDePasse\":\"password123\",\"role\":\"USER\"}'

# Tester l'authentification
curl -X POST http://192.168.1.8:8080/users/authenticate `
  -H "Content-Type: application/json" `
  -d '{\"email\":\"test@example.com\",\"motDePasse\":\"password123\"}'

📊 Résumé

Backend identifié : mic-after-work-server-impl-quarkus-main
Compatibilité confirmée : Entités et endpoints correspondent
Base de données : PostgreSQL (afterwork_db)
Port : 8080
Framework : Quarkus 3.16.3


Date : 5 janvier 2026
Auteur : AI Assistant