Refactoring

This commit is contained in:
dahoud
2026-02-02 00:59:52 +00:00
parent 8f5267d895
commit bcbae7c599
2 changed files with 12 additions and 92 deletions

View File

@@ -1,19 +1,19 @@
# ==================================================================== # ====================================================================
# AfterWork Server - Configuration PRODUCTION (profil prod) # AfterWork Server - Configuration PRODUCTION (profil prod)
# ==================================================================== # ====================================================================
# Charg<EFBFBD> avec QUARKUS_PROFILE=prod (Kubernetes ConfigMap). # Charg? avec QUARKUS_PROFILE=prod (Kubernetes ConfigMap).
# Ce fichier remplace application-production.properties pour coh<EFBFBD>rence # Ce fichier remplace application-production.properties pour coh?rence
# avec le d<EFBFBD>ploiement (QUARKUS_PROFILE=prod). # avec le d?ploiement (QUARKUS_PROFILE=prod).
# ==================================================================== # ====================================================================
# HTTP - Chemin de base de l'API # HTTP - Chemin de base de l'API
# ==================================================================== # ====================================================================
# Permet d'acc<EFBFBD>der <EFBFBD> l'API via https://api.lions.dev/afterwork # Permet d'acc?der ? l'API via https://api.lions.dev/afterwork
# #
# IMPORTANT - Configuration Ingress requise: # IMPORTANT - Configuration Ingress requise:
# Cette application utilise quarkus.http.root-path pour <EFBFBD>tre "context-aware", # Cette application utilise quarkus.http.root-path pour ?tre "context-aware",
# ce qui permet <EFBFBD> Swagger UI de g<EFBFBD>n<EFBFBD>rer les bonnes URLs. # ce qui permet ? Swagger UI de g?n?rer les bonnes URLs.
# L'Ingress Kubernetes DOIT pr<EFBFBD>server le chemin complet (PAS de rewrite-target). # L'Ingress Kubernetes DOIT pr?server le chemin complet (PAS de rewrite-target).
# #
# Configuration Ingress correcte: # Configuration Ingress correcte:
# - path: /afterwork # - path: /afterwork
@@ -32,9 +32,9 @@ quarkus.smallrye-openapi.path=/openapi
quarkus.smallrye-openapi.servers=https://api.lions.dev quarkus.smallrye-openapi.servers=https://api.lions.dev
# ==================================================================== # ====================================================================
# Base de donn<EFBFBD>es PostgreSQL # Base de donn?es PostgreSQL
# ==================================================================== # ====================================================================
# IMPORTANT: Les credentials doivent <EFBFBD>tre fournis via variables d'environnement # IMPORTANT: Les credentials doivent ?tre fournis via variables d'environnement
# en production (Kubernetes Secrets ou Vault). # en production (Kubernetes Secrets ou Vault).
quarkus.datasource.db-kind=postgresql quarkus.datasource.db-kind=postgresql
quarkus.datasource.jdbc.url=jdbc:postgresql://${DB_HOST:postgresql-service.postgresql.svc.cluster.local}:${DB_PORT:5432}/${DB_NAME:mic-after-work-server-impl-quarkus-main} quarkus.datasource.jdbc.url=jdbc:postgresql://${DB_HOST:postgresql-service.postgresql.svc.cluster.local}:${DB_PORT:5432}/${DB_NAME:mic-after-work-server-impl-quarkus-main}
@@ -53,9 +53,10 @@ quarkus.flyway.locations=db/migration
quarkus.flyway.baseline-on-migrate=true quarkus.flyway.baseline-on-migrate=true
quarkus.flyway.baseline-version=1 quarkus.flyway.baseline-version=1
quarkus.flyway.validate-on-migrate=true quarkus.flyway.validate-on-migrate=true
(ex: V1_1 ajout?e apr?s que la prod ait d?j? V2..V19).
, donc sans risque sur une base d?j? migr?e.
# ==================================================================== # ====================================================================
# Hibernate ORM - Mode validation (Flyway g<EFBFBD>re le schema) # Hibernate ORM - Mode validation (Flyway g?re le schema)
# ==================================================================== # ====================================================================
quarkus.hibernate-orm.database.generation=none quarkus.hibernate-orm.database.generation=none
quarkus.hibernate-orm.log.sql=false quarkus.hibernate-orm.log.sql=false

View File

@@ -1,81 +0,0 @@
-- V1_1__Create_Base_Tables_For_Fresh_Db.sql
-- Création des tables de base pour une base de données vierge.
-- À exécuter après V1__Baseline lorsque le schéma n'a pas été créé par Hibernate.
-- Les migrations V2, V3, V4, V7+ supposent que users, establishments et events existent.
-- Table users (structure minimale attendue par V3 et l'entité Users)
CREATE TABLE IF NOT EXISTS users (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
first_name VARCHAR(100) NOT NULL DEFAULT '',
last_name VARCHAR(100) NOT NULL DEFAULT '',
email VARCHAR(100) NOT NULL UNIQUE,
password_hash VARCHAR(255) NOT NULL DEFAULT '',
role VARCHAR(50) NOT NULL,
profile_image_url VARCHAR(500),
bio VARCHAR(500),
loyalty_points INTEGER NOT NULL DEFAULT 0,
preferences JSONB NOT NULL DEFAULT '{}',
is_verified BOOLEAN NOT NULL DEFAULT false,
is_online BOOLEAN NOT NULL DEFAULT false,
last_seen TIMESTAMP,
is_active BOOLEAN NOT NULL DEFAULT true
);
-- Table establishments (V4 renomme total_ratings_count -> total_reviews_count)
CREATE TABLE IF NOT EXISTS establishments (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
name VARCHAR(255) NOT NULL,
type VARCHAR(100) NOT NULL,
address VARCHAR(500) NOT NULL,
city VARCHAR(100) NOT NULL,
postal_code VARCHAR(20) NOT NULL,
description VARCHAR(2000),
phone_number VARCHAR(50),
website VARCHAR(500),
average_rating DOUBLE PRECISION,
total_ratings_count INTEGER,
price_range VARCHAR(20),
verification_status VARCHAR(20) NOT NULL DEFAULT 'PENDING',
is_active BOOLEAN NOT NULL DEFAULT true,
latitude DOUBLE PRECISION,
longitude DOUBLE PRECISION,
manager_id UUID NOT NULL REFERENCES users(id)
);
-- Table events (structure minimale ; V2 et V7 ajoutent les colonnes supplémentaires)
CREATE TABLE IF NOT EXISTS events (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
title VARCHAR(255) NOT NULL,
description VARCHAR(1000),
start_date TIMESTAMP NOT NULL,
end_date TIMESTAMP NOT NULL,
category VARCHAR(100),
link VARCHAR(500),
image_url VARCHAR(500),
status VARCHAR(20) NOT NULL DEFAULT 'OPEN',
creator_id UUID NOT NULL REFERENCES users(id)
);
-- Table de jointure event_participants (events <-> users)
CREATE TABLE IF NOT EXISTS event_participants (
event_id UUID NOT NULL REFERENCES events(id) ON DELETE CASCADE,
user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
PRIMARY KEY (event_id, user_id)
);
-- Table de jointure user_favorite_events (users <-> events)
CREATE TABLE IF NOT EXISTS user_favorite_events (
user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
event_id UUID NOT NULL REFERENCES events(id) ON DELETE CASCADE,
PRIMARY KEY (user_id, event_id)
);
-- Index pour les FK et recherches courantes
CREATE INDEX IF NOT EXISTS idx_establishments_manager ON establishments(manager_id);
CREATE INDEX IF NOT EXISTS idx_events_creator ON events(creator_id);