Checkpoint: Implémentation des fonctionnalités de communication : formulaire de contact avec choix email/canal, canaux de discussion intégrés (page Mes Échanges), demandes de mise en relation avec gestion admin des canaux, navigation mise à jour dans DashboardLayout, bouton Demande de mise en relation sur fiche établissement. Migration DB : tables canaux_discussion, membres_canal, messages_canal, demandes_mise_en_relation.

This commit is contained in:
Manus
2026-05-13 10:40:13 -04:00
parent 46321a1eaf
commit 0205859880
13 changed files with 2437 additions and 57 deletions

View File

@@ -0,0 +1,52 @@
CREATE TABLE `canaux_discussion` (
`id` int AUTO_INCREMENT NOT NULL,
`titre` varchar(255) NOT NULL,
`description` text,
`type` enum('contact_referent','mise_en_relation_public','mise_en_relation_prive') NOT NULL,
`visibilite` enum('public','prive') NOT NULL DEFAULT 'prive',
`etablissementId` int,
`demandeContactId` int,
`demandeMiseEnRelationId` int,
`creePar` int NOT NULL,
`statut` enum('ouvert','ferme') NOT NULL DEFAULT 'ouvert',
`createdAt` timestamp NOT NULL DEFAULT (now()),
`updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,
CONSTRAINT `canaux_discussion_id` PRIMARY KEY(`id`)
);
--> statement-breakpoint
CREATE TABLE `demandes_mise_en_relation` (
`id` int AUTO_INCREMENT NOT NULL,
`demandeurId` int NOT NULL,
`demandeurNom` varchar(255) NOT NULL,
`demandeurEmail` varchar(320),
`etablissementDemandeurId` int,
`sujet` varchar(500) NOT NULL,
`message` text NOT NULL,
`statut` enum('en_attente','traite','ferme') NOT NULL DEFAULT 'en_attente',
`canalId` int,
`traitePar` int,
`traiteAt` timestamp,
`createdAt` timestamp NOT NULL DEFAULT (now()),
`updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,
CONSTRAINT `demandes_mise_en_relation_id` PRIMARY KEY(`id`)
);
--> statement-breakpoint
CREATE TABLE `membres_canaux_discussion` (
`id` int AUTO_INCREMENT NOT NULL,
`canalId` int NOT NULL,
`userId` int NOT NULL,
`role` enum('membre','animateur') NOT NULL DEFAULT 'membre',
`createdAt` timestamp NOT NULL DEFAULT (now()),
CONSTRAINT `membres_canaux_discussion_id` PRIMARY KEY(`id`)
);
--> statement-breakpoint
CREATE TABLE `messages_canaux` (
`id` int AUTO_INCREMENT NOT NULL,
`canalId` int NOT NULL,
`auteurId` int NOT NULL,
`auteurNom` varchar(255) NOT NULL,
`contenu` text NOT NULL,
`lu` boolean NOT NULL DEFAULT false,
`createdAt` timestamp NOT NULL DEFAULT (now()),
CONSTRAINT `messages_canaux_id` PRIMARY KEY(`id`)
);

File diff suppressed because it is too large Load Diff

View File

@@ -29,6 +29,13 @@
"when": 1776767429233,
"tag": "0003_dry_dragon_man",
"breakpoints": true
},
{
"idx": 4,
"version": "5",
"when": 1778682305530,
"tag": "0004_empty_energizer",
"breakpoints": true
}
]
}

View File

@@ -183,3 +183,60 @@ export const demandesContact = mysqlTable("demandes_contact", {
});
export type DemandeContact = typeof demandesContact.$inferSelect;
// ─── Canaux de Discussion ─────────────────────────────────────────────────────
export const canauxDiscussion = mysqlTable("canaux_discussion", {
id: int("id").autoincrement().primaryKey(),
titre: varchar("titre", { length: 255 }).notNull(),
description: text("description"),
type: mysqlEnum("type", ["contact_referent", "mise_en_relation_public", "mise_en_relation_prive"]).notNull(),
visibilite: mysqlEnum("visibilite", ["public", "prive"]).default("prive").notNull(),
etablissementId: int("etablissementId"),
demandeContactId: int("demandeContactId"),
demandeMiseEnRelationId: int("demandeMiseEnRelationId"),
creePar: int("creePar").notNull(),
statut: mysqlEnum("statut", ["ouvert", "ferme"]).default("ouvert").notNull(),
createdAt: timestamp("createdAt").defaultNow().notNull(),
updatedAt: timestamp("updatedAt").defaultNow().onUpdateNow().notNull(),
});
export type CanalDiscussion = typeof canauxDiscussion.$inferSelect;
// ─── Membres des Canaux ───────────────────────────────────────────────────────
export const membresCanauxDiscussion = mysqlTable("membres_canaux_discussion", {
id: int("id").autoincrement().primaryKey(),
canalId: int("canalId").notNull(),
userId: int("userId").notNull(),
role: mysqlEnum("role", ["membre", "animateur"]).default("membre").notNull(),
createdAt: timestamp("createdAt").defaultNow().notNull(),
});
export type MembreCanalDiscussion = typeof membresCanauxDiscussion.$inferSelect;
// ─── Messages des Canaux ──────────────────────────────────────────────────────
export const messagesCanaux = mysqlTable("messages_canaux", {
id: int("id").autoincrement().primaryKey(),
canalId: int("canalId").notNull(),
auteurId: int("auteurId").notNull(),
auteurNom: varchar("auteurNom", { length: 255 }).notNull(),
contenu: text("contenu").notNull(),
lu: boolean("lu").default(false).notNull(),
createdAt: timestamp("createdAt").defaultNow().notNull(),
});
export type MessageCanal = typeof messagesCanaux.$inferSelect;
// ─── Demandes de Mise en Relation ─────────────────────────────────────────────
export const demandesMiseEnRelation = mysqlTable("demandes_mise_en_relation", {
id: int("id").autoincrement().primaryKey(),
demandeurId: int("demandeurId").notNull(),
demandeurNom: varchar("demandeurNom", { length: 255 }).notNull(),
demandeurEmail: varchar("demandeurEmail", { length: 320 }),
etablissementDemandeurId: int("etablissementDemandeurId"),
sujet: varchar("sujet", { length: 500 }).notNull(),
message: text("message").notNull(),
statut: mysqlEnum("statut", ["en_attente", "traite", "ferme"]).default("en_attente").notNull(),
canalId: int("canalId"),
traitePar: int("traitePar"),
traiteAt: timestamp("traiteAt"),
createdAt: timestamp("createdAt").defaultNow().notNull(),
updatedAt: timestamp("updatedAt").defaultNow().onUpdateNow().notNull(),
});
export type DemandeMiseEnRelation = typeof demandesMiseEnRelation.$inferSelect;