Configure Maven repository for unionflow-server-api dependency
This commit is contained in:
8
src/main/resources/META-INF/beans.xml
Normal file
8
src/main/resources/META-INF/beans.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="https://jakarta.ee/xml/ns/jakartaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee
|
||||
https://jakarta.ee/xml/ns/jakartaee/beans_4_0.xsd"
|
||||
version="4.0"
|
||||
bean-discovery-mode="all">
|
||||
</beans>
|
||||
56
src/main/resources/application-minimal.properties
Normal file
56
src/main/resources/application-minimal.properties
Normal file
@@ -0,0 +1,56 @@
|
||||
# Configuration UnionFlow Server - Mode Minimal
|
||||
quarkus.application.name=unionflow-server-minimal
|
||||
quarkus.application.version=1.0.0
|
||||
|
||||
# Configuration HTTP
|
||||
quarkus.http.port=8080
|
||||
quarkus.http.host=0.0.0.0
|
||||
|
||||
# Configuration CORS
|
||||
quarkus.http.cors=true
|
||||
quarkus.http.cors.origins=*
|
||||
quarkus.http.cors.methods=GET,POST,PUT,DELETE,OPTIONS
|
||||
quarkus.http.cors.headers=Content-Type,Authorization
|
||||
|
||||
# Configuration Base de données H2 (en mémoire)
|
||||
quarkus.datasource.db-kind=h2
|
||||
quarkus.datasource.username=sa
|
||||
quarkus.datasource.password=
|
||||
quarkus.datasource.jdbc.url=jdbc:h2:mem:unionflow_minimal;DB_CLOSE_DELAY=-1;MODE=PostgreSQL
|
||||
|
||||
# Configuration Hibernate
|
||||
quarkus.hibernate-orm.database.generation=drop-and-create
|
||||
quarkus.hibernate-orm.log.sql=true
|
||||
quarkus.hibernate-orm.jdbc.timezone=UTC
|
||||
quarkus.hibernate-orm.packages=dev.lions.unionflow.server.entity
|
||||
|
||||
# Désactiver Flyway
|
||||
quarkus.flyway.migrate-at-start=false
|
||||
|
||||
# Désactiver Keycloak temporairement
|
||||
quarkus.oidc.tenant-enabled=false
|
||||
|
||||
# Chemins publics (tous publics en mode minimal)
|
||||
quarkus.http.auth.permission.public.paths=/*
|
||||
quarkus.http.auth.permission.public.policy=permit
|
||||
|
||||
# Configuration OpenAPI
|
||||
quarkus.smallrye-openapi.info-title=UnionFlow Server API - Minimal
|
||||
quarkus.smallrye-openapi.info-version=1.0.0
|
||||
quarkus.smallrye-openapi.info-description=API REST pour la gestion d'union (mode minimal)
|
||||
quarkus.smallrye-openapi.servers=http://localhost:8080
|
||||
|
||||
# Configuration Swagger UI
|
||||
quarkus.swagger-ui.always-include=true
|
||||
quarkus.swagger-ui.path=/swagger-ui
|
||||
|
||||
# Configuration santé
|
||||
quarkus.smallrye-health.root-path=/health
|
||||
|
||||
# Configuration logging
|
||||
quarkus.log.console.enable=true
|
||||
quarkus.log.console.level=INFO
|
||||
quarkus.log.console.format=%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c{2.}] (%t) %s%e%n
|
||||
quarkus.log.category."dev.lions.unionflow".level=DEBUG
|
||||
quarkus.log.category."org.hibernate".level=WARN
|
||||
quarkus.log.category."io.quarkus".level=INFO
|
||||
77
src/main/resources/application-prod.properties
Normal file
77
src/main/resources/application-prod.properties
Normal file
@@ -0,0 +1,77 @@
|
||||
# Configuration UnionFlow Server - PRODUCTION
|
||||
# Ce fichier est utilisé avec le profil Quarkus "prod"
|
||||
|
||||
# Configuration HTTP
|
||||
quarkus.http.port=8085
|
||||
quarkus.http.host=0.0.0.0
|
||||
|
||||
# Configuration CORS - Production (strict)
|
||||
quarkus.http.cors=true
|
||||
quarkus.http.cors.origins=${CORS_ORIGINS:https://unionflow.lions.dev,https://security.lions.dev}
|
||||
quarkus.http.cors.methods=GET,POST,PUT,DELETE,OPTIONS
|
||||
quarkus.http.cors.headers=Content-Type,Authorization
|
||||
quarkus.http.cors.allow-credentials=true
|
||||
|
||||
# Configuration Base de données PostgreSQL - Production
|
||||
quarkus.datasource.db-kind=postgresql
|
||||
quarkus.datasource.username=${DB_USERNAME:unionflow}
|
||||
quarkus.datasource.password=${DB_PASSWORD}
|
||||
quarkus.datasource.jdbc.url=${DB_URL:jdbc:postgresql://localhost:5432/unionflow}
|
||||
quarkus.datasource.jdbc.min-size=5
|
||||
quarkus.datasource.jdbc.max-size=20
|
||||
|
||||
# Configuration Hibernate - Production (IMPORTANT: update, pas drop-and-create)
|
||||
quarkus.hibernate-orm.database.generation=update
|
||||
quarkus.hibernate-orm.log.sql=false
|
||||
quarkus.hibernate-orm.jdbc.timezone=UTC
|
||||
quarkus.hibernate-orm.packages=dev.lions.unionflow.server.entity
|
||||
quarkus.hibernate-orm.metrics.enabled=false
|
||||
|
||||
# Configuration Flyway - Production (ACTIVÉ)
|
||||
quarkus.flyway.migrate-at-start=true
|
||||
quarkus.flyway.baseline-on-migrate=true
|
||||
quarkus.flyway.baseline-version=1.0.0
|
||||
|
||||
# Configuration Keycloak OIDC - Production
|
||||
quarkus.oidc.auth-server-url=${KEYCLOAK_AUTH_SERVER_URL:https://security.lions.dev/realms/unionflow}
|
||||
quarkus.oidc.client-id=unionflow-server
|
||||
quarkus.oidc.credentials.secret=${KEYCLOAK_CLIENT_SECRET}
|
||||
quarkus.oidc.tls.verification=required
|
||||
quarkus.oidc.application-type=service
|
||||
|
||||
# Configuration Keycloak Policy Enforcer
|
||||
quarkus.keycloak.policy-enforcer.enable=false
|
||||
quarkus.keycloak.policy-enforcer.lazy-load-paths=true
|
||||
quarkus.keycloak.policy-enforcer.enforcement-mode=PERMISSIVE
|
||||
|
||||
# Chemins publics (non protégés)
|
||||
quarkus.http.auth.permission.public.paths=/health,/q/*,/favicon.ico
|
||||
quarkus.http.auth.permission.public.policy=permit
|
||||
|
||||
# Configuration OpenAPI - Production (Swagger désactivé ou protégé)
|
||||
quarkus.smallrye-openapi.info-title=UnionFlow Server API
|
||||
quarkus.smallrye-openapi.info-version=1.0.0
|
||||
quarkus.smallrye-openapi.info-description=API REST pour la gestion d'union avec authentification Keycloak
|
||||
quarkus.smallrye-openapi.servers=https://api.lions.dev/unionflow
|
||||
|
||||
# Configuration Swagger UI - Production (DÉSACTIVÉ pour sécurité)
|
||||
quarkus.swagger-ui.always-include=false
|
||||
|
||||
# Configuration santé
|
||||
quarkus.smallrye-health.root-path=/health
|
||||
|
||||
# Configuration logging - Production
|
||||
quarkus.log.console.enable=true
|
||||
quarkus.log.console.level=INFO
|
||||
quarkus.log.console.format=%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c{2.}] (%t) %s%e%n
|
||||
quarkus.log.category."dev.lions.unionflow".level=INFO
|
||||
quarkus.log.category."org.hibernate".level=WARN
|
||||
quarkus.log.category."io.quarkus".level=INFO
|
||||
quarkus.log.category."org.jboss.resteasy".level=WARN
|
||||
|
||||
# Configuration Wave Money - Production
|
||||
wave.api.key=${WAVE_API_KEY:}
|
||||
wave.api.secret=${WAVE_API_SECRET:}
|
||||
wave.api.base.url=${WAVE_API_BASE_URL:https://api.wave.com/v1}
|
||||
wave.environment=${WAVE_ENVIRONMENT:production}
|
||||
wave.webhook.secret=${WAVE_WEBHOOK_SECRET:}
|
||||
31
src/main/resources/application-test.properties
Normal file
31
src/main/resources/application-test.properties
Normal file
@@ -0,0 +1,31 @@
|
||||
# Configuration UnionFlow Server - Profil Test
|
||||
# Ce fichier est chargé automatiquement quand le profil 'test' est actif
|
||||
|
||||
# Configuration Base de données H2 pour tests
|
||||
quarkus.datasource.db-kind=h2
|
||||
quarkus.datasource.username=sa
|
||||
quarkus.datasource.password=
|
||||
quarkus.datasource.jdbc.url=jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;MODE=PostgreSQL
|
||||
|
||||
# Configuration Hibernate pour tests
|
||||
quarkus.hibernate-orm.database.generation=drop-and-create
|
||||
# Désactiver complètement l'exécution des scripts SQL au démarrage
|
||||
quarkus.hibernate-orm.sql-load-script-source=none
|
||||
# Empêcher Hibernate d'exécuter les scripts SQL automatiquement
|
||||
# Note: Ne pas définir quarkus.hibernate-orm.sql-load-script car une chaîne vide peut causer des problèmes
|
||||
|
||||
# Configuration Flyway pour tests (désactivé complètement)
|
||||
quarkus.flyway.migrate-at-start=false
|
||||
quarkus.flyway.enabled=false
|
||||
quarkus.flyway.baseline-on-migrate=false
|
||||
# Note: Ne pas définir quarkus.flyway.locations car une chaîne vide cause une erreur de configuration
|
||||
|
||||
# Configuration Keycloak pour tests (désactivé)
|
||||
quarkus.oidc.tenant-enabled=false
|
||||
quarkus.keycloak.policy-enforcer.enable=false
|
||||
|
||||
# Configuration HTTP pour tests
|
||||
quarkus.http.port=0
|
||||
quarkus.http.test-port=0
|
||||
|
||||
|
||||
103
src/main/resources/application.properties
Normal file
103
src/main/resources/application.properties
Normal file
@@ -0,0 +1,103 @@
|
||||
# Configuration UnionFlow Server
|
||||
quarkus.application.name=unionflow-server
|
||||
quarkus.application.version=1.0.0
|
||||
|
||||
# Configuration HTTP
|
||||
quarkus.http.port=8085
|
||||
quarkus.http.host=0.0.0.0
|
||||
|
||||
# Configuration CORS
|
||||
quarkus.http.cors=true
|
||||
quarkus.http.cors.origins=${CORS_ORIGINS:http://localhost:8086,https://unionflow.lions.dev,https://security.lions.dev}
|
||||
quarkus.http.cors.methods=GET,POST,PUT,DELETE,OPTIONS
|
||||
quarkus.http.cors.headers=Content-Type,Authorization
|
||||
|
||||
# Configuration Base de données PostgreSQL (par défaut)
|
||||
quarkus.datasource.db-kind=postgresql
|
||||
quarkus.datasource.username=${DB_USERNAME:unionflow}
|
||||
quarkus.datasource.password=${DB_PASSWORD}
|
||||
quarkus.datasource.jdbc.url=${DB_URL:jdbc:postgresql://localhost:5432/unionflow}
|
||||
quarkus.datasource.jdbc.min-size=2
|
||||
quarkus.datasource.jdbc.max-size=10
|
||||
|
||||
# Configuration Base de données PostgreSQL pour développement
|
||||
%dev.quarkus.datasource.username=skyfile
|
||||
%dev.quarkus.datasource.password=${DB_PASSWORD_DEV:skyfile}
|
||||
%dev.quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:5432/unionflow
|
||||
|
||||
# Configuration Hibernate
|
||||
quarkus.hibernate-orm.database.generation=update
|
||||
quarkus.hibernate-orm.log.sql=false
|
||||
quarkus.hibernate-orm.jdbc.timezone=UTC
|
||||
quarkus.hibernate-orm.packages=dev.lions.unionflow.server.entity
|
||||
# Désactiver l'avertissement PanacheEntity (nous utilisons BaseEntity personnalisé)
|
||||
quarkus.hibernate-orm.metrics.enabled=false
|
||||
|
||||
# Configuration Hibernate pour développement
|
||||
%dev.quarkus.hibernate-orm.database.generation=drop-and-create
|
||||
%dev.quarkus.hibernate-orm.sql-load-script=import.sql
|
||||
%dev.quarkus.hibernate-orm.log.sql=true
|
||||
|
||||
# Configuration Flyway pour migrations
|
||||
quarkus.flyway.migrate-at-start=true
|
||||
quarkus.flyway.baseline-on-migrate=true
|
||||
quarkus.flyway.baseline-version=1.0.0
|
||||
|
||||
# Configuration Flyway pour développement (désactivé)
|
||||
%dev.quarkus.flyway.migrate-at-start=false
|
||||
|
||||
# Configuration Keycloak OIDC (par défaut)
|
||||
quarkus.oidc.auth-server-url=http://localhost:8180/realms/unionflow
|
||||
quarkus.oidc.client-id=unionflow-server
|
||||
quarkus.oidc.credentials.secret=${KEYCLOAK_CLIENT_SECRET}
|
||||
quarkus.oidc.tls.verification=none
|
||||
quarkus.oidc.application-type=service
|
||||
|
||||
# Configuration Keycloak pour développement
|
||||
%dev.quarkus.oidc.tenant-enabled=false
|
||||
%dev.quarkus.oidc.auth-server-url=http://localhost:8180/realms/unionflow
|
||||
|
||||
# Configuration Keycloak Policy Enforcer (temporairement désactivé)
|
||||
quarkus.keycloak.policy-enforcer.enable=false
|
||||
quarkus.keycloak.policy-enforcer.lazy-load-paths=true
|
||||
quarkus.keycloak.policy-enforcer.enforcement-mode=PERMISSIVE
|
||||
|
||||
# Chemins publics (non protégés)
|
||||
quarkus.http.auth.permission.public.paths=/health,/q/*,/favicon.ico,/auth/callback,/auth/*
|
||||
quarkus.http.auth.permission.public.policy=permit
|
||||
|
||||
# Configuration OpenAPI
|
||||
quarkus.smallrye-openapi.info-title=UnionFlow Server API
|
||||
quarkus.smallrye-openapi.info-version=1.0.0
|
||||
quarkus.smallrye-openapi.info-description=API REST pour la gestion d'union avec authentification Keycloak
|
||||
quarkus.smallrye-openapi.servers=http://localhost:8085
|
||||
|
||||
# Configuration Swagger UI
|
||||
quarkus.swagger-ui.always-include=true
|
||||
quarkus.swagger-ui.path=/swagger-ui
|
||||
|
||||
# Configuration santé
|
||||
quarkus.smallrye-health.root-path=/health
|
||||
|
||||
# Configuration logging
|
||||
quarkus.log.console.enable=true
|
||||
quarkus.log.console.level=INFO
|
||||
quarkus.log.console.format=%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c{2.}] (%t) %s%e%n
|
||||
quarkus.log.category."dev.lions.unionflow".level=INFO
|
||||
quarkus.log.category."org.hibernate".level=WARN
|
||||
quarkus.log.category."io.quarkus".level=INFO
|
||||
|
||||
# Configuration logging pour développement
|
||||
%dev.quarkus.log.category."dev.lions.unionflow".level=DEBUG
|
||||
%dev.quarkus.log.category."org.hibernate.SQL".level=DEBUG
|
||||
|
||||
# Configuration Jandex pour résoudre les warnings de réflexion
|
||||
quarkus.index-dependency.unionflow-server-api.group-id=dev.lions.unionflow
|
||||
quarkus.index-dependency.unionflow-server-api.artifact-id=unionflow-server-api
|
||||
|
||||
# Configuration Wave Money
|
||||
wave.api.key=${WAVE_API_KEY:}
|
||||
wave.api.secret=${WAVE_API_SECRET:}
|
||||
wave.api.base.url=${WAVE_API_BASE_URL:https://api.wave.com/v1}
|
||||
wave.environment=${WAVE_ENVIRONMENT:sandbox}
|
||||
wave.webhook.secret=${WAVE_WEBHOOK_SECRET:}
|
||||
@@ -0,0 +1,143 @@
|
||||
-- Migration V1.2: Création de la table organisations
|
||||
-- Auteur: UnionFlow Team
|
||||
-- Date: 2025-01-15
|
||||
-- Description: Création de la table organisations avec toutes les colonnes nécessaires
|
||||
|
||||
-- Création de la table organisations
|
||||
CREATE TABLE organisations (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
|
||||
-- Informations de base
|
||||
nom VARCHAR(200) NOT NULL,
|
||||
nom_court VARCHAR(50),
|
||||
type_organisation VARCHAR(50) NOT NULL DEFAULT 'ASSOCIATION',
|
||||
statut VARCHAR(50) NOT NULL DEFAULT 'ACTIVE',
|
||||
description TEXT,
|
||||
date_fondation DATE,
|
||||
numero_enregistrement VARCHAR(100) UNIQUE,
|
||||
|
||||
-- Informations de contact
|
||||
email VARCHAR(255) NOT NULL UNIQUE,
|
||||
telephone VARCHAR(20),
|
||||
telephone_secondaire VARCHAR(20),
|
||||
email_secondaire VARCHAR(255),
|
||||
|
||||
-- Adresse
|
||||
adresse VARCHAR(500),
|
||||
ville VARCHAR(100),
|
||||
code_postal VARCHAR(20),
|
||||
region VARCHAR(100),
|
||||
pays VARCHAR(100),
|
||||
|
||||
-- Coordonnées géographiques
|
||||
latitude DECIMAL(9,6) CHECK (latitude >= -90 AND latitude <= 90),
|
||||
longitude DECIMAL(9,6) CHECK (longitude >= -180 AND longitude <= 180),
|
||||
|
||||
-- Web et réseaux sociaux
|
||||
site_web VARCHAR(500),
|
||||
logo VARCHAR(500),
|
||||
reseaux_sociaux VARCHAR(1000),
|
||||
|
||||
-- Hiérarchie
|
||||
organisation_parente_id UUID,
|
||||
niveau_hierarchique INTEGER NOT NULL DEFAULT 0,
|
||||
|
||||
-- Statistiques
|
||||
nombre_membres INTEGER NOT NULL DEFAULT 0,
|
||||
nombre_administrateurs INTEGER NOT NULL DEFAULT 0,
|
||||
|
||||
-- Finances
|
||||
budget_annuel DECIMAL(14,2) CHECK (budget_annuel >= 0),
|
||||
devise VARCHAR(3) DEFAULT 'XOF',
|
||||
cotisation_obligatoire BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
montant_cotisation_annuelle DECIMAL(12,2) CHECK (montant_cotisation_annuelle >= 0),
|
||||
|
||||
-- Informations complémentaires
|
||||
objectifs TEXT,
|
||||
activites_principales TEXT,
|
||||
certifications VARCHAR(500),
|
||||
partenaires VARCHAR(1000),
|
||||
notes VARCHAR(1000),
|
||||
|
||||
-- Paramètres
|
||||
organisation_publique BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
accepte_nouveaux_membres BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
|
||||
-- Métadonnées
|
||||
actif BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
date_creation TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
date_modification TIMESTAMP,
|
||||
cree_par VARCHAR(100),
|
||||
modifie_par VARCHAR(100),
|
||||
version BIGINT NOT NULL DEFAULT 0,
|
||||
|
||||
-- Contraintes
|
||||
CONSTRAINT chk_organisation_statut CHECK (statut IN ('ACTIVE', 'SUSPENDUE', 'DISSOUTE', 'EN_ATTENTE')),
|
||||
CONSTRAINT chk_organisation_type CHECK (type_organisation IN (
|
||||
'ASSOCIATION', 'LIONS_CLUB', 'ROTARY_CLUB', 'COOPERATIVE',
|
||||
'FONDATION', 'ONG', 'SYNDICAT', 'AUTRE'
|
||||
)),
|
||||
CONSTRAINT chk_organisation_devise CHECK (devise IN ('XOF', 'EUR', 'USD', 'GBP', 'CHF')),
|
||||
CONSTRAINT chk_organisation_niveau CHECK (niveau_hierarchique >= 0 AND niveau_hierarchique <= 10),
|
||||
CONSTRAINT chk_organisation_membres CHECK (nombre_membres >= 0),
|
||||
CONSTRAINT chk_organisation_admins CHECK (nombre_administrateurs >= 0)
|
||||
);
|
||||
|
||||
-- Création des index pour optimiser les performances
|
||||
CREATE INDEX idx_organisation_nom ON organisations(nom);
|
||||
CREATE INDEX idx_organisation_email ON organisations(email);
|
||||
CREATE INDEX idx_organisation_statut ON organisations(statut);
|
||||
CREATE INDEX idx_organisation_type ON organisations(type_organisation);
|
||||
CREATE INDEX idx_organisation_ville ON organisations(ville);
|
||||
CREATE INDEX idx_organisation_pays ON organisations(pays);
|
||||
CREATE INDEX idx_organisation_parente ON organisations(organisation_parente_id);
|
||||
CREATE INDEX idx_organisation_numero_enregistrement ON organisations(numero_enregistrement);
|
||||
CREATE INDEX idx_organisation_actif ON organisations(actif);
|
||||
CREATE INDEX idx_organisation_date_creation ON organisations(date_creation);
|
||||
CREATE INDEX idx_organisation_publique ON organisations(organisation_publique);
|
||||
CREATE INDEX idx_organisation_accepte_membres ON organisations(accepte_nouveaux_membres);
|
||||
|
||||
-- Index composites pour les recherches fréquentes
|
||||
CREATE INDEX idx_organisation_statut_actif ON organisations(statut, actif);
|
||||
CREATE INDEX idx_organisation_type_ville ON organisations(type_organisation, ville);
|
||||
CREATE INDEX idx_organisation_pays_region ON organisations(pays, region);
|
||||
CREATE INDEX idx_organisation_publique_actif ON organisations(organisation_publique, actif);
|
||||
|
||||
-- Index pour les recherches textuelles
|
||||
CREATE INDEX idx_organisation_nom_lower ON organisations(LOWER(nom));
|
||||
CREATE INDEX idx_organisation_nom_court_lower ON organisations(LOWER(nom_court));
|
||||
CREATE INDEX idx_organisation_ville_lower ON organisations(LOWER(ville));
|
||||
|
||||
-- Ajout de la colonne organisation_id à la table membres (si elle n'existe pas déjà)
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1 FROM information_schema.columns
|
||||
WHERE table_name = 'membres' AND column_name = 'organisation_id'
|
||||
) THEN
|
||||
ALTER TABLE membres ADD COLUMN organisation_id BIGINT;
|
||||
ALTER TABLE membres ADD CONSTRAINT fk_membre_organisation
|
||||
FOREIGN KEY (organisation_id) REFERENCES organisations(id);
|
||||
CREATE INDEX idx_membre_organisation ON membres(organisation_id);
|
||||
END IF;
|
||||
END $$;
|
||||
|
||||
-- IMPORTANT: Aucune donnée fictive n'est insérée dans ce script de migration.
|
||||
-- Les données doivent être insérées manuellement via l'interface d'administration
|
||||
-- ou via des scripts de migration séparés si nécessaire pour la production.
|
||||
|
||||
-- Mise à jour des statistiques de la base de données
|
||||
ANALYZE organisations;
|
||||
|
||||
-- Commentaires sur la table et les colonnes principales
|
||||
COMMENT ON TABLE organisations IS 'Table des organisations (Lions Clubs, Associations, Coopératives, etc.)';
|
||||
COMMENT ON COLUMN organisations.nom IS 'Nom officiel de l''organisation';
|
||||
COMMENT ON COLUMN organisations.nom_court IS 'Nom court ou sigle de l''organisation';
|
||||
COMMENT ON COLUMN organisations.type_organisation IS 'Type d''organisation (LIONS_CLUB, ASSOCIATION, etc.)';
|
||||
COMMENT ON COLUMN organisations.statut IS 'Statut actuel de l''organisation (ACTIVE, SUSPENDUE, etc.)';
|
||||
COMMENT ON COLUMN organisations.organisation_parente_id IS 'ID de l''organisation parente pour la hiérarchie';
|
||||
COMMENT ON COLUMN organisations.niveau_hierarchique IS 'Niveau dans la hiérarchie (0 = racine)';
|
||||
COMMENT ON COLUMN organisations.nombre_membres IS 'Nombre total de membres actifs';
|
||||
COMMENT ON COLUMN organisations.organisation_publique IS 'Si l''organisation est visible publiquement';
|
||||
COMMENT ON COLUMN organisations.accepte_nouveaux_membres IS 'Si l''organisation accepte de nouveaux membres';
|
||||
COMMENT ON COLUMN organisations.version IS 'Version pour le contrôle de concurrence optimiste';
|
||||
419
src/main/resources/db/migration/V1.3__Convert_Ids_To_UUID.sql
Normal file
419
src/main/resources/db/migration/V1.3__Convert_Ids_To_UUID.sql
Normal file
@@ -0,0 +1,419 @@
|
||||
-- Migration V1.3: Conversion des colonnes ID de BIGINT vers UUID
|
||||
-- Auteur: UnionFlow Team
|
||||
-- Date: 2025-01-16
|
||||
-- Description: Convertit toutes les colonnes ID et clés étrangères de BIGINT vers UUID
|
||||
-- ATTENTION: Cette migration supprime toutes les données existantes pour simplifier la conversion
|
||||
-- Pour une migration avec préservation des données, voir V1.3.1__Convert_Ids_To_UUID_With_Data.sql
|
||||
|
||||
-- ============================================
|
||||
-- ÉTAPE 1: Suppression des contraintes de clés étrangères
|
||||
-- ============================================
|
||||
|
||||
-- Supprimer les contraintes de clés étrangères existantes
|
||||
DO $$
|
||||
BEGIN
|
||||
-- Supprimer FK membres -> organisations
|
||||
IF EXISTS (
|
||||
SELECT 1 FROM information_schema.table_constraints
|
||||
WHERE constraint_name = 'fk_membre_organisation'
|
||||
AND table_name = 'membres'
|
||||
) THEN
|
||||
ALTER TABLE membres DROP CONSTRAINT fk_membre_organisation;
|
||||
END IF;
|
||||
|
||||
-- Supprimer FK cotisations -> membres
|
||||
IF EXISTS (
|
||||
SELECT 1 FROM information_schema.table_constraints
|
||||
WHERE constraint_name LIKE 'fk_cotisation%'
|
||||
AND table_name = 'cotisations'
|
||||
) THEN
|
||||
ALTER TABLE cotisations DROP CONSTRAINT IF EXISTS fk_cotisation_membre CASCADE;
|
||||
END IF;
|
||||
|
||||
-- Supprimer FK evenements -> organisations
|
||||
IF EXISTS (
|
||||
SELECT 1 FROM information_schema.table_constraints
|
||||
WHERE constraint_name LIKE 'fk_evenement%'
|
||||
AND table_name = 'evenements'
|
||||
) THEN
|
||||
ALTER TABLE evenements DROP CONSTRAINT IF EXISTS fk_evenement_organisation CASCADE;
|
||||
END IF;
|
||||
|
||||
-- Supprimer FK inscriptions_evenement -> membres et evenements
|
||||
IF EXISTS (
|
||||
SELECT 1 FROM information_schema.table_constraints
|
||||
WHERE constraint_name LIKE 'fk_inscription%'
|
||||
AND table_name = 'inscriptions_evenement'
|
||||
) THEN
|
||||
ALTER TABLE inscriptions_evenement DROP CONSTRAINT IF EXISTS fk_inscription_membre CASCADE;
|
||||
ALTER TABLE inscriptions_evenement DROP CONSTRAINT IF EXISTS fk_inscription_evenement CASCADE;
|
||||
END IF;
|
||||
|
||||
-- Supprimer FK demandes_aide -> membres et organisations
|
||||
IF EXISTS (
|
||||
SELECT 1 FROM information_schema.table_constraints
|
||||
WHERE constraint_name LIKE 'fk_demande%'
|
||||
AND table_name = 'demandes_aide'
|
||||
) THEN
|
||||
ALTER TABLE demandes_aide DROP CONSTRAINT IF EXISTS fk_demande_demandeur CASCADE;
|
||||
ALTER TABLE demandes_aide DROP CONSTRAINT IF EXISTS fk_demande_evaluateur CASCADE;
|
||||
ALTER TABLE demandes_aide DROP CONSTRAINT IF EXISTS fk_demande_organisation CASCADE;
|
||||
END IF;
|
||||
END $$;
|
||||
|
||||
-- ============================================
|
||||
-- ÉTAPE 2: Supprimer les séquences (BIGSERIAL)
|
||||
-- ============================================
|
||||
|
||||
DROP SEQUENCE IF EXISTS membres_SEQ CASCADE;
|
||||
DROP SEQUENCE IF EXISTS cotisations_SEQ CASCADE;
|
||||
DROP SEQUENCE IF EXISTS evenements_SEQ CASCADE;
|
||||
DROP SEQUENCE IF EXISTS organisations_id_seq CASCADE;
|
||||
|
||||
-- ============================================
|
||||
-- ÉTAPE 3: Supprimer les tables existantes (pour recréation avec UUID)
|
||||
-- ============================================
|
||||
|
||||
-- Supprimer les tables dans l'ordre inverse des dépendances
|
||||
DROP TABLE IF EXISTS inscriptions_evenement CASCADE;
|
||||
DROP TABLE IF EXISTS demandes_aide CASCADE;
|
||||
DROP TABLE IF EXISTS cotisations CASCADE;
|
||||
DROP TABLE IF EXISTS evenements CASCADE;
|
||||
DROP TABLE IF EXISTS membres CASCADE;
|
||||
DROP TABLE IF EXISTS organisations CASCADE;
|
||||
|
||||
-- ============================================
|
||||
-- ÉTAPE 4: Recréer les tables avec UUID
|
||||
-- ============================================
|
||||
|
||||
-- Table organisations avec UUID
|
||||
CREATE TABLE organisations (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
|
||||
-- Informations de base
|
||||
nom VARCHAR(200) NOT NULL,
|
||||
nom_court VARCHAR(50),
|
||||
type_organisation VARCHAR(50) NOT NULL DEFAULT 'ASSOCIATION',
|
||||
statut VARCHAR(50) NOT NULL DEFAULT 'ACTIVE',
|
||||
description TEXT,
|
||||
date_fondation DATE,
|
||||
numero_enregistrement VARCHAR(100) UNIQUE,
|
||||
|
||||
-- Informations de contact
|
||||
email VARCHAR(255) NOT NULL UNIQUE,
|
||||
telephone VARCHAR(20),
|
||||
telephone_secondaire VARCHAR(20),
|
||||
email_secondaire VARCHAR(255),
|
||||
|
||||
-- Adresse
|
||||
adresse VARCHAR(500),
|
||||
ville VARCHAR(100),
|
||||
code_postal VARCHAR(20),
|
||||
region VARCHAR(100),
|
||||
pays VARCHAR(100),
|
||||
|
||||
-- Coordonnées géographiques
|
||||
latitude DECIMAL(9,6) CHECK (latitude >= -90 AND latitude <= 90),
|
||||
longitude DECIMAL(9,6) CHECK (longitude >= -180 AND longitude <= 180),
|
||||
|
||||
-- Web et réseaux sociaux
|
||||
site_web VARCHAR(500),
|
||||
logo VARCHAR(500),
|
||||
reseaux_sociaux VARCHAR(1000),
|
||||
|
||||
-- Hiérarchie
|
||||
organisation_parente_id UUID,
|
||||
niveau_hierarchique INTEGER NOT NULL DEFAULT 0,
|
||||
|
||||
-- Statistiques
|
||||
nombre_membres INTEGER NOT NULL DEFAULT 0,
|
||||
nombre_administrateurs INTEGER NOT NULL DEFAULT 0,
|
||||
|
||||
-- Finances
|
||||
budget_annuel DECIMAL(14,2) CHECK (budget_annuel >= 0),
|
||||
devise VARCHAR(3) DEFAULT 'XOF',
|
||||
cotisation_obligatoire BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
montant_cotisation_annuelle DECIMAL(12,2) CHECK (montant_cotisation_annuelle >= 0),
|
||||
|
||||
-- Informations complémentaires
|
||||
objectifs TEXT,
|
||||
activites_principales TEXT,
|
||||
certifications VARCHAR(500),
|
||||
partenaires VARCHAR(1000),
|
||||
notes VARCHAR(1000),
|
||||
|
||||
-- Paramètres
|
||||
organisation_publique BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
accepte_nouveaux_membres BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
|
||||
-- Métadonnées (héritées de BaseEntity)
|
||||
actif BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
date_creation TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
date_modification TIMESTAMP,
|
||||
cree_par VARCHAR(255),
|
||||
modifie_par VARCHAR(255),
|
||||
version BIGINT NOT NULL DEFAULT 0,
|
||||
|
||||
-- Contraintes
|
||||
CONSTRAINT chk_organisation_statut CHECK (statut IN ('ACTIVE', 'SUSPENDUE', 'DISSOUTE', 'EN_ATTENTE')),
|
||||
CONSTRAINT chk_organisation_type CHECK (type_organisation IN (
|
||||
'ASSOCIATION', 'LIONS_CLUB', 'ROTARY_CLUB', 'COOPERATIVE',
|
||||
'FONDATION', 'ONG', 'SYNDICAT', 'AUTRE'
|
||||
)),
|
||||
CONSTRAINT chk_organisation_devise CHECK (devise IN ('XOF', 'EUR', 'USD', 'GBP', 'CHF')),
|
||||
CONSTRAINT chk_organisation_niveau CHECK (niveau_hierarchique >= 0 AND niveau_hierarchique <= 10),
|
||||
CONSTRAINT chk_organisation_membres CHECK (nombre_membres >= 0),
|
||||
CONSTRAINT chk_organisation_admins CHECK (nombre_administrateurs >= 0),
|
||||
|
||||
-- Clé étrangère pour hiérarchie
|
||||
CONSTRAINT fk_organisation_parente FOREIGN KEY (organisation_parente_id)
|
||||
REFERENCES organisations(id) ON DELETE SET NULL
|
||||
);
|
||||
|
||||
-- Table membres avec UUID
|
||||
CREATE TABLE membres (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
|
||||
numero_membre VARCHAR(20) UNIQUE NOT NULL,
|
||||
prenom VARCHAR(100) NOT NULL,
|
||||
nom VARCHAR(100) NOT NULL,
|
||||
email VARCHAR(255) UNIQUE NOT NULL,
|
||||
mot_de_passe VARCHAR(255),
|
||||
telephone VARCHAR(20),
|
||||
date_naissance DATE NOT NULL,
|
||||
date_adhesion DATE NOT NULL,
|
||||
roles VARCHAR(500),
|
||||
|
||||
-- Clé étrangère vers organisations
|
||||
organisation_id UUID,
|
||||
|
||||
-- Métadonnées (héritées de BaseEntity)
|
||||
actif BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
date_creation TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
date_modification TIMESTAMP,
|
||||
cree_par VARCHAR(255),
|
||||
modifie_par VARCHAR(255),
|
||||
version BIGINT NOT NULL DEFAULT 0,
|
||||
|
||||
CONSTRAINT fk_membre_organisation FOREIGN KEY (organisation_id)
|
||||
REFERENCES organisations(id) ON DELETE SET NULL
|
||||
);
|
||||
|
||||
-- Table cotisations avec UUID
|
||||
CREATE TABLE cotisations (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
|
||||
numero_reference VARCHAR(50) UNIQUE NOT NULL,
|
||||
membre_id UUID NOT NULL,
|
||||
type_cotisation VARCHAR(50) NOT NULL,
|
||||
montant_du DECIMAL(12,2) NOT NULL CHECK (montant_du >= 0),
|
||||
montant_paye DECIMAL(12,2) NOT NULL DEFAULT 0 CHECK (montant_paye >= 0),
|
||||
code_devise VARCHAR(3) NOT NULL DEFAULT 'XOF',
|
||||
statut VARCHAR(30) NOT NULL,
|
||||
date_echeance DATE NOT NULL,
|
||||
date_paiement TIMESTAMP,
|
||||
description VARCHAR(500),
|
||||
periode VARCHAR(20),
|
||||
annee INTEGER NOT NULL CHECK (annee >= 2020 AND annee <= 2100),
|
||||
mois INTEGER CHECK (mois >= 1 AND mois <= 12),
|
||||
observations VARCHAR(1000),
|
||||
recurrente BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
nombre_rappels INTEGER NOT NULL DEFAULT 0 CHECK (nombre_rappels >= 0),
|
||||
date_dernier_rappel TIMESTAMP,
|
||||
valide_par_id UUID,
|
||||
nom_validateur VARCHAR(100),
|
||||
date_validation TIMESTAMP,
|
||||
methode_paiement VARCHAR(50),
|
||||
reference_paiement VARCHAR(100),
|
||||
|
||||
-- Métadonnées (héritées de BaseEntity)
|
||||
actif BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
date_creation TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
date_modification TIMESTAMP,
|
||||
cree_par VARCHAR(255),
|
||||
modifie_par VARCHAR(255),
|
||||
version BIGINT NOT NULL DEFAULT 0,
|
||||
|
||||
CONSTRAINT fk_cotisation_membre FOREIGN KEY (membre_id)
|
||||
REFERENCES membres(id) ON DELETE CASCADE,
|
||||
CONSTRAINT chk_cotisation_statut CHECK (statut IN ('EN_ATTENTE', 'PAYEE', 'EN_RETARD', 'PARTIELLEMENT_PAYEE', 'ANNULEE')),
|
||||
CONSTRAINT chk_cotisation_devise CHECK (code_devise ~ '^[A-Z]{3}$')
|
||||
);
|
||||
|
||||
-- Table evenements avec UUID
|
||||
CREATE TABLE evenements (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
|
||||
titre VARCHAR(200) NOT NULL,
|
||||
description VARCHAR(2000),
|
||||
date_debut TIMESTAMP NOT NULL,
|
||||
date_fin TIMESTAMP,
|
||||
lieu VARCHAR(255) NOT NULL,
|
||||
adresse VARCHAR(500),
|
||||
ville VARCHAR(100),
|
||||
pays VARCHAR(100),
|
||||
code_postal VARCHAR(20),
|
||||
latitude DECIMAL(9,6),
|
||||
longitude DECIMAL(9,6),
|
||||
type_evenement VARCHAR(50) NOT NULL,
|
||||
statut VARCHAR(50) NOT NULL,
|
||||
url_inscription VARCHAR(500),
|
||||
url_informations VARCHAR(500),
|
||||
image_url VARCHAR(500),
|
||||
capacite_max INTEGER,
|
||||
cout_participation DECIMAL(12,2),
|
||||
devise VARCHAR(3),
|
||||
est_public BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
tags VARCHAR(500),
|
||||
notes VARCHAR(1000),
|
||||
|
||||
-- Clé étrangère vers organisations
|
||||
organisation_id UUID,
|
||||
|
||||
-- Métadonnées (héritées de BaseEntity)
|
||||
actif BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
date_creation TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
date_modification TIMESTAMP,
|
||||
cree_par VARCHAR(255),
|
||||
modifie_par VARCHAR(255),
|
||||
version BIGINT NOT NULL DEFAULT 0,
|
||||
|
||||
CONSTRAINT fk_evenement_organisation FOREIGN KEY (organisation_id)
|
||||
REFERENCES organisations(id) ON DELETE SET NULL
|
||||
);
|
||||
|
||||
-- Table inscriptions_evenement avec UUID
|
||||
CREATE TABLE inscriptions_evenement (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
|
||||
membre_id UUID NOT NULL,
|
||||
evenement_id UUID NOT NULL,
|
||||
date_inscription TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
statut VARCHAR(20) DEFAULT 'CONFIRMEE',
|
||||
commentaire VARCHAR(500),
|
||||
|
||||
-- Métadonnées (héritées de BaseEntity)
|
||||
actif BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
date_creation TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
date_modification TIMESTAMP,
|
||||
cree_par VARCHAR(255),
|
||||
modifie_par VARCHAR(255),
|
||||
version BIGINT NOT NULL DEFAULT 0,
|
||||
|
||||
CONSTRAINT fk_inscription_membre FOREIGN KEY (membre_id)
|
||||
REFERENCES membres(id) ON DELETE CASCADE,
|
||||
CONSTRAINT fk_inscription_evenement FOREIGN KEY (evenement_id)
|
||||
REFERENCES evenements(id) ON DELETE CASCADE,
|
||||
CONSTRAINT chk_inscription_statut CHECK (statut IN ('CONFIRMEE', 'EN_ATTENTE', 'ANNULEE', 'REFUSEE')),
|
||||
CONSTRAINT uk_inscription_membre_evenement UNIQUE (membre_id, evenement_id)
|
||||
);
|
||||
|
||||
-- Table demandes_aide avec UUID
|
||||
CREATE TABLE demandes_aide (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
|
||||
titre VARCHAR(200) NOT NULL,
|
||||
description TEXT NOT NULL,
|
||||
type_aide VARCHAR(50) NOT NULL,
|
||||
statut VARCHAR(50) NOT NULL,
|
||||
montant_demande DECIMAL(10,2),
|
||||
montant_approuve DECIMAL(10,2),
|
||||
date_demande TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
date_evaluation TIMESTAMP,
|
||||
date_versement TIMESTAMP,
|
||||
justification TEXT,
|
||||
commentaire_evaluation TEXT,
|
||||
urgence BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
documents_fournis VARCHAR(500),
|
||||
|
||||
-- Clés étrangères
|
||||
demandeur_id UUID NOT NULL,
|
||||
evaluateur_id UUID,
|
||||
organisation_id UUID NOT NULL,
|
||||
|
||||
-- Métadonnées (héritées de BaseEntity)
|
||||
actif BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
date_creation TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
date_modification TIMESTAMP,
|
||||
cree_par VARCHAR(255),
|
||||
modifie_par VARCHAR(255),
|
||||
version BIGINT NOT NULL DEFAULT 0,
|
||||
|
||||
CONSTRAINT fk_demande_demandeur FOREIGN KEY (demandeur_id)
|
||||
REFERENCES membres(id) ON DELETE CASCADE,
|
||||
CONSTRAINT fk_demande_evaluateur FOREIGN KEY (evaluateur_id)
|
||||
REFERENCES membres(id) ON DELETE SET NULL,
|
||||
CONSTRAINT fk_demande_organisation FOREIGN KEY (organisation_id)
|
||||
REFERENCES organisations(id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
-- ============================================
|
||||
-- ÉTAPE 5: Recréer les index
|
||||
-- ============================================
|
||||
|
||||
-- Index pour organisations
|
||||
CREATE INDEX idx_organisation_nom ON organisations(nom);
|
||||
CREATE INDEX idx_organisation_email ON organisations(email);
|
||||
CREATE INDEX idx_organisation_statut ON organisations(statut);
|
||||
CREATE INDEX idx_organisation_type ON organisations(type_organisation);
|
||||
CREATE INDEX idx_organisation_ville ON organisations(ville);
|
||||
CREATE INDEX idx_organisation_pays ON organisations(pays);
|
||||
CREATE INDEX idx_organisation_parente ON organisations(organisation_parente_id);
|
||||
CREATE INDEX idx_organisation_numero_enregistrement ON organisations(numero_enregistrement);
|
||||
CREATE INDEX idx_organisation_actif ON organisations(actif);
|
||||
CREATE INDEX idx_organisation_date_creation ON organisations(date_creation);
|
||||
CREATE INDEX idx_organisation_publique ON organisations(organisation_publique);
|
||||
CREATE INDEX idx_organisation_accepte_membres ON organisations(accepte_nouveaux_membres);
|
||||
CREATE INDEX idx_organisation_statut_actif ON organisations(statut, actif);
|
||||
|
||||
-- Index pour membres
|
||||
CREATE INDEX idx_membre_email ON membres(email);
|
||||
CREATE INDEX idx_membre_numero ON membres(numero_membre);
|
||||
CREATE INDEX idx_membre_actif ON membres(actif);
|
||||
CREATE INDEX idx_membre_organisation ON membres(organisation_id);
|
||||
|
||||
-- Index pour cotisations
|
||||
CREATE INDEX idx_cotisation_membre ON cotisations(membre_id);
|
||||
CREATE INDEX idx_cotisation_reference ON cotisations(numero_reference);
|
||||
CREATE INDEX idx_cotisation_statut ON cotisations(statut);
|
||||
CREATE INDEX idx_cotisation_echeance ON cotisations(date_echeance);
|
||||
CREATE INDEX idx_cotisation_type ON cotisations(type_cotisation);
|
||||
CREATE INDEX idx_cotisation_annee_mois ON cotisations(annee, mois);
|
||||
|
||||
-- Index pour evenements
|
||||
CREATE INDEX idx_evenement_date_debut ON evenements(date_debut);
|
||||
CREATE INDEX idx_evenement_statut ON evenements(statut);
|
||||
CREATE INDEX idx_evenement_type ON evenements(type_evenement);
|
||||
CREATE INDEX idx_evenement_organisation ON evenements(organisation_id);
|
||||
|
||||
-- Index pour inscriptions_evenement
|
||||
CREATE INDEX idx_inscription_membre ON inscriptions_evenement(membre_id);
|
||||
CREATE INDEX idx_inscription_evenement ON inscriptions_evenement(evenement_id);
|
||||
CREATE INDEX idx_inscription_date ON inscriptions_evenement(date_inscription);
|
||||
|
||||
-- Index pour demandes_aide
|
||||
CREATE INDEX idx_demande_demandeur ON demandes_aide(demandeur_id);
|
||||
CREATE INDEX idx_demande_evaluateur ON demandes_aide(evaluateur_id);
|
||||
CREATE INDEX idx_demande_organisation ON demandes_aide(organisation_id);
|
||||
CREATE INDEX idx_demande_statut ON demandes_aide(statut);
|
||||
CREATE INDEX idx_demande_type ON demandes_aide(type_aide);
|
||||
CREATE INDEX idx_demande_date_demande ON demandes_aide(date_demande);
|
||||
|
||||
-- ============================================
|
||||
-- ÉTAPE 6: Commentaires sur les tables
|
||||
-- ============================================
|
||||
|
||||
COMMENT ON TABLE organisations IS 'Table des organisations (Lions Clubs, Associations, Coopératives, etc.) avec UUID';
|
||||
COMMENT ON TABLE membres IS 'Table des membres avec UUID';
|
||||
COMMENT ON TABLE cotisations IS 'Table des cotisations avec UUID';
|
||||
COMMENT ON TABLE evenements IS 'Table des événements avec UUID';
|
||||
COMMENT ON TABLE inscriptions_evenement IS 'Table des inscriptions aux événements avec UUID';
|
||||
COMMENT ON TABLE demandes_aide IS 'Table des demandes d''aide avec UUID';
|
||||
|
||||
COMMENT ON COLUMN organisations.id IS 'UUID unique de l''organisation';
|
||||
COMMENT ON COLUMN membres.id IS 'UUID unique du membre';
|
||||
COMMENT ON COLUMN cotisations.id IS 'UUID unique de la cotisation';
|
||||
COMMENT ON COLUMN evenements.id IS 'UUID unique de l''événement';
|
||||
COMMENT ON COLUMN inscriptions_evenement.id IS 'UUID unique de l''inscription';
|
||||
COMMENT ON COLUMN demandes_aide.id IS 'UUID unique de la demande d''aide';
|
||||
|
||||
10
src/main/resources/import.sql
Normal file
10
src/main/resources/import.sql
Normal file
@@ -0,0 +1,10 @@
|
||||
-- Script d'insertion de données initiales pour UnionFlow
|
||||
-- Ce fichier est exécuté automatiquement par Hibernate au démarrage
|
||||
-- Utilisé uniquement en mode développement (quarkus.hibernate-orm.database.generation=drop-and-create)
|
||||
--
|
||||
-- IMPORTANT: Ce fichier ne doit PAS contenir de données fictives pour la production.
|
||||
-- Les données doivent être insérées manuellement via l'interface d'administration
|
||||
-- ou via des scripts de migration Flyway si nécessaire.
|
||||
--
|
||||
-- Ce fichier est laissé vide intentionnellement pour éviter l'insertion automatique
|
||||
-- de données fictives lors du démarrage du serveur.
|
||||
307
src/main/resources/keycloak/unionflow-realm.json
Normal file
307
src/main/resources/keycloak/unionflow-realm.json
Normal file
@@ -0,0 +1,307 @@
|
||||
{
|
||||
"realm": "unionflow",
|
||||
"displayName": "UnionFlow",
|
||||
"displayNameHtml": "<div class=\"kc-logo-text\"><span>UnionFlow</span></div>",
|
||||
"enabled": true,
|
||||
"sslRequired": "external",
|
||||
"registrationAllowed": true,
|
||||
"registrationEmailAsUsername": true,
|
||||
"rememberMe": true,
|
||||
"verifyEmail": false,
|
||||
"loginWithEmailAllowed": true,
|
||||
"duplicateEmailsAllowed": false,
|
||||
"resetPasswordAllowed": true,
|
||||
"editUsernameAllowed": false,
|
||||
"bruteForceProtected": true,
|
||||
"permanentLockout": false,
|
||||
"maxFailureWaitSeconds": 900,
|
||||
"minimumQuickLoginWaitSeconds": 60,
|
||||
"waitIncrementSeconds": 60,
|
||||
"quickLoginCheckMilliSeconds": 1000,
|
||||
"maxDeltaTimeSeconds": 43200,
|
||||
"failureFactor": 30,
|
||||
"defaultRoles": ["offline_access", "uma_authorization", "default-roles-unionflow"],
|
||||
"requiredCredentials": ["password"],
|
||||
"otpPolicyType": "totp",
|
||||
"otpPolicyAlgorithm": "HmacSHA1",
|
||||
"otpPolicyInitialCounter": 0,
|
||||
"otpPolicyDigits": 6,
|
||||
"otpPolicyLookAheadWindow": 1,
|
||||
"otpPolicyPeriod": 30,
|
||||
"supportedLocales": ["fr", "en"],
|
||||
"defaultLocale": "fr",
|
||||
"internationalizationEnabled": true,
|
||||
"clients": [
|
||||
{
|
||||
"clientId": "unionflow-server",
|
||||
"name": "UnionFlow Server API",
|
||||
"description": "Client pour l'API serveur UnionFlow",
|
||||
"enabled": true,
|
||||
"clientAuthenticatorType": "client-secret",
|
||||
"secret": "dev-secret",
|
||||
"redirectUris": ["http://localhost:8080/*"],
|
||||
"webOrigins": ["http://localhost:8080", "http://localhost:3000"],
|
||||
"protocol": "openid-connect",
|
||||
"attributes": {
|
||||
"saml.assertion.signature": "false",
|
||||
"saml.force.post.binding": "false",
|
||||
"saml.multivalued.roles": "false",
|
||||
"saml.encrypt": "false",
|
||||
"saml.server.signature": "false",
|
||||
"saml.server.signature.keyinfo.ext": "false",
|
||||
"exclude.session.state.from.auth.response": "false",
|
||||
"saml_force_name_id_format": "false",
|
||||
"saml.client.signature": "false",
|
||||
"tls.client.certificate.bound.access.tokens": "false",
|
||||
"saml.authnstatement": "false",
|
||||
"display.on.consent.screen": "false",
|
||||
"saml.onetimeuse.condition": "false"
|
||||
},
|
||||
"authenticationFlowBindingOverrides": {},
|
||||
"fullScopeAllowed": true,
|
||||
"nodeReRegistrationTimeout": -1,
|
||||
"protocolMappers": [
|
||||
{
|
||||
"name": "email",
|
||||
"protocol": "openid-connect",
|
||||
"protocolMapper": "oidc-usermodel-property-mapper",
|
||||
"consentRequired": false,
|
||||
"config": {
|
||||
"userinfo.token.claim": "true",
|
||||
"user.attribute": "email",
|
||||
"id.token.claim": "true",
|
||||
"access.token.claim": "true",
|
||||
"claim.name": "email",
|
||||
"jsonType.label": "String"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "given_name",
|
||||
"protocol": "openid-connect",
|
||||
"protocolMapper": "oidc-usermodel-property-mapper",
|
||||
"consentRequired": false,
|
||||
"config": {
|
||||
"userinfo.token.claim": "true",
|
||||
"user.attribute": "firstName",
|
||||
"id.token.claim": "true",
|
||||
"access.token.claim": "true",
|
||||
"claim.name": "given_name",
|
||||
"jsonType.label": "String"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "family_name",
|
||||
"protocol": "openid-connect",
|
||||
"protocolMapper": "oidc-usermodel-property-mapper",
|
||||
"consentRequired": false,
|
||||
"config": {
|
||||
"userinfo.token.claim": "true",
|
||||
"user.attribute": "lastName",
|
||||
"id.token.claim": "true",
|
||||
"access.token.claim": "true",
|
||||
"claim.name": "family_name",
|
||||
"jsonType.label": "String"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "roles",
|
||||
"protocol": "openid-connect",
|
||||
"protocolMapper": "oidc-usermodel-realm-role-mapper",
|
||||
"consentRequired": false,
|
||||
"config": {
|
||||
"userinfo.token.claim": "true",
|
||||
"id.token.claim": "true",
|
||||
"access.token.claim": "true",
|
||||
"claim.name": "roles",
|
||||
"jsonType.label": "String",
|
||||
"multivalued": "true"
|
||||
}
|
||||
}
|
||||
],
|
||||
"defaultClientScopes": ["web-origins", "role_list", "profile", "roles", "email"],
|
||||
"optionalClientScopes": ["address", "phone", "offline_access", "microprofile-jwt"]
|
||||
},
|
||||
{
|
||||
"clientId": "unionflow-mobile",
|
||||
"name": "UnionFlow Mobile App",
|
||||
"description": "Client pour l'application mobile UnionFlow",
|
||||
"enabled": true,
|
||||
"publicClient": true,
|
||||
"redirectUris": ["unionflow://callback", "http://localhost:3000/callback"],
|
||||
"webOrigins": ["*"],
|
||||
"protocol": "openid-connect",
|
||||
"attributes": {
|
||||
"pkce.code.challenge.method": "S256"
|
||||
},
|
||||
"fullScopeAllowed": true,
|
||||
"defaultClientScopes": ["web-origins", "role_list", "profile", "roles", "email"],
|
||||
"optionalClientScopes": ["address", "phone", "offline_access", "microprofile-jwt"]
|
||||
}
|
||||
],
|
||||
"roles": {
|
||||
"realm": [
|
||||
{
|
||||
"name": "ADMIN",
|
||||
"description": "Administrateur système avec tous les droits",
|
||||
"composite": false,
|
||||
"clientRole": false,
|
||||
"containerId": "unionflow"
|
||||
},
|
||||
{
|
||||
"name": "PRESIDENT",
|
||||
"description": "Président de l'union avec droits de gestion complète",
|
||||
"composite": false,
|
||||
"clientRole": false,
|
||||
"containerId": "unionflow"
|
||||
},
|
||||
{
|
||||
"name": "SECRETAIRE",
|
||||
"description": "Secrétaire avec droits de gestion des membres et événements",
|
||||
"composite": false,
|
||||
"clientRole": false,
|
||||
"containerId": "unionflow"
|
||||
},
|
||||
{
|
||||
"name": "TRESORIER",
|
||||
"description": "Trésorier avec droits de gestion financière",
|
||||
"composite": false,
|
||||
"clientRole": false,
|
||||
"containerId": "unionflow"
|
||||
},
|
||||
{
|
||||
"name": "GESTIONNAIRE_MEMBRE",
|
||||
"description": "Gestionnaire des membres avec droits de CRUD sur les membres",
|
||||
"composite": false,
|
||||
"clientRole": false,
|
||||
"containerId": "unionflow"
|
||||
},
|
||||
{
|
||||
"name": "ORGANISATEUR_EVENEMENT",
|
||||
"description": "Organisateur d'événements avec droits de gestion des événements",
|
||||
"composite": false,
|
||||
"clientRole": false,
|
||||
"containerId": "unionflow"
|
||||
},
|
||||
{
|
||||
"name": "MEMBRE",
|
||||
"description": "Membre standard avec droits de consultation",
|
||||
"composite": false,
|
||||
"clientRole": false,
|
||||
"containerId": "unionflow"
|
||||
}
|
||||
]
|
||||
},
|
||||
"users": [
|
||||
{
|
||||
"username": "admin",
|
||||
"enabled": true,
|
||||
"emailVerified": true,
|
||||
"firstName": "Administrateur",
|
||||
"lastName": "Système",
|
||||
"email": "admin@unionflow.dev",
|
||||
"credentials": [
|
||||
{
|
||||
"type": "password",
|
||||
"value": "admin123",
|
||||
"temporary": false
|
||||
}
|
||||
],
|
||||
"realmRoles": ["ADMIN", "PRESIDENT"],
|
||||
"clientRoles": {}
|
||||
},
|
||||
{
|
||||
"username": "president",
|
||||
"enabled": true,
|
||||
"emailVerified": true,
|
||||
"firstName": "Jean",
|
||||
"lastName": "Dupont",
|
||||
"email": "president@unionflow.dev",
|
||||
"credentials": [
|
||||
{
|
||||
"type": "password",
|
||||
"value": "president123",
|
||||
"temporary": false
|
||||
}
|
||||
],
|
||||
"realmRoles": ["PRESIDENT", "MEMBRE"],
|
||||
"clientRoles": {}
|
||||
},
|
||||
{
|
||||
"username": "secretaire",
|
||||
"enabled": true,
|
||||
"emailVerified": true,
|
||||
"firstName": "Marie",
|
||||
"lastName": "Martin",
|
||||
"email": "secretaire@unionflow.dev",
|
||||
"credentials": [
|
||||
{
|
||||
"type": "password",
|
||||
"value": "secretaire123",
|
||||
"temporary": false
|
||||
}
|
||||
],
|
||||
"realmRoles": ["SECRETAIRE", "GESTIONNAIRE_MEMBRE", "MEMBRE"],
|
||||
"clientRoles": {}
|
||||
},
|
||||
{
|
||||
"username": "tresorier",
|
||||
"enabled": true,
|
||||
"emailVerified": true,
|
||||
"firstName": "Pierre",
|
||||
"lastName": "Durand",
|
||||
"email": "tresorier@unionflow.dev",
|
||||
"credentials": [
|
||||
{
|
||||
"type": "password",
|
||||
"value": "tresorier123",
|
||||
"temporary": false
|
||||
}
|
||||
],
|
||||
"realmRoles": ["TRESORIER", "MEMBRE"],
|
||||
"clientRoles": {}
|
||||
},
|
||||
{
|
||||
"username": "membre1",
|
||||
"enabled": true,
|
||||
"emailVerified": true,
|
||||
"firstName": "Sophie",
|
||||
"lastName": "Bernard",
|
||||
"email": "membre1@unionflow.dev",
|
||||
"credentials": [
|
||||
{
|
||||
"type": "password",
|
||||
"value": "membre123",
|
||||
"temporary": false
|
||||
}
|
||||
],
|
||||
"realmRoles": ["MEMBRE"],
|
||||
"clientRoles": {}
|
||||
}
|
||||
],
|
||||
"groups": [
|
||||
{
|
||||
"name": "Administration",
|
||||
"path": "/Administration",
|
||||
"realmRoles": ["ADMIN"],
|
||||
"subGroups": []
|
||||
},
|
||||
{
|
||||
"name": "Bureau",
|
||||
"path": "/Bureau",
|
||||
"realmRoles": ["PRESIDENT", "SECRETAIRE", "TRESORIER"],
|
||||
"subGroups": []
|
||||
},
|
||||
{
|
||||
"name": "Gestionnaires",
|
||||
"path": "/Gestionnaires",
|
||||
"realmRoles": ["GESTIONNAIRE_MEMBRE", "ORGANISATEUR_EVENEMENT"],
|
||||
"subGroups": []
|
||||
},
|
||||
{
|
||||
"name": "Membres",
|
||||
"path": "/Membres",
|
||||
"realmRoles": ["MEMBRE"],
|
||||
"subGroups": []
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user