Unverified Commit fa75c57e authored by Kourser's avatar Kourser
Browse files

Modèle de données : skins, adressage messagerie, main courante, presse

- Exercise.playerSkin (habillage joueur par exercice)
- MessageRecipient.characterId (adressage par personnage + repli animation)
- LogEntry : source, assignee, dueLabel, status (main courante opérationnelle)
- NewsArticle.outlet (média presse)
Migrations : player_skin, recipient_character, maincourante_ops, news_outlet.

Co-Authored-By: Claude (RCA)
parent f3577aaf
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
-- Habillage de l'espace joueur par exercice.
CREATE TYPE "PlayerSkin" AS ENUM ('DEFAULT', 'MICROSOFT', 'GOOGLE');

ALTER TABLE "Exercise" ADD COLUMN "playerSkin" "PlayerSkin" NOT NULL DEFAULT 'DEFAULT';
+9 −0
Original line number Diff line number Diff line
-- Adressage des messages par personnage (remise retroactive + repli animation).
ALTER TABLE "MessageRecipient" ADD COLUMN "characterId" TEXT;

CREATE INDEX "MessageRecipient_characterId_idx" ON "MessageRecipient"("characterId");

ALTER TABLE "MessageRecipient"
  ADD CONSTRAINT "MessageRecipient_characterId_fkey"
  FOREIGN KEY ("characterId") REFERENCES "Character"("id")
  ON DELETE SET NULL ON UPDATE CASCADE;
+7 −0
Original line number Diff line number Diff line
-- Main courante operationnelle : source + suivi des decisions/actions.
CREATE TYPE "LogStatus" AS ENUM ('TODO', 'IN_PROGRESS', 'DONE');

ALTER TABLE "LogEntry" ADD COLUMN "source" TEXT;
ALTER TABLE "LogEntry" ADD COLUMN "assignee" TEXT;
ALTER TABLE "LogEntry" ADD COLUMN "dueLabel" TEXT;
ALTER TABLE "LogEntry" ADD COLUMN "status" "LogStatus";
+4 −0
Original line number Diff line number Diff line
-- Media (outlet) d'un article de presse : pilote l'habillage cote joueur.
CREATE TYPE "NewsOutlet" AS ENUM ('GENERIC', 'LEMONDE', 'FIGARO', 'FRANCEINFO', 'OUESTFRANCE');

ALTER TABLE "NewsArticle" ADD COLUMN "outlet" "NewsOutlet" NOT NULL DEFAULT 'GENERIC';
+37 −0
Original line number Diff line number Diff line
@@ -72,6 +72,14 @@ enum ExerciseStatus {
  ARCHIVED
}

/// Habillage de l'espace joueur (suite cosmetique appliquee a tout l'exercice).
/// DEFAULT = habillage natif Cythin ; MICROSOFT = Outlook + Teams ; GOOGLE = Gmail + Google Chat.
enum PlayerSkin {
  DEFAULT
  MICROSOFT
  GOOGLE
}

/// Un exercice de crise (preparation -> deroule -> cloture).
model Exercise {
  id          String         @id @default(cuid())
@@ -82,6 +90,7 @@ model Exercise {
  objectives  String?
  sector      String?
  status      ExerciseStatus @default(DRAFT)
  playerSkin  PlayerSkin     @default(DEFAULT)

  // Horloge d'exercice pilotable (pilotage au lot 3, cf. spec-technique §1.4).
  clockRunning       Boolean   @default(false)
@@ -128,6 +137,7 @@ model Character {
  simEmail    String?
  avatarColor String?
  participant Participant?
  messageRecipients MessageRecipient[]

  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
@@ -255,10 +265,15 @@ model MessageRecipient {
  kind          RecipientKind
  participantId String?
  participant   Participant?  @relation(fields: [participantId], references: [id], onDelete: Cascade)
  // Personnage destinataire (adressage durable) : permet la remise a un joueur qui
  // rejoint plus tard, et le repli vers l'animation tant qu'aucun joueur ne l'incarne.
  characterId   String?
  character     Character?    @relation(fields: [characterId], references: [id], onDelete: SetNull)
  readAt        DateTime?

  @@index([tenantId])
  @@index([participantId])
  @@index([characterId])
  @@index([messageId])
}

@@ -270,6 +285,13 @@ enum LogCategory {
  ALERTE
}

/// Statut de suivi d'une decision/action (pilotage de la cellule de crise).
enum LogStatus {
  TODO
  IN_PROGRESS
  DONE
}

/// Une entree de main courante (journal de bord partage de la cellule de crise).
model LogEntry {
  id                  String      @id @default(cuid())
@@ -282,6 +304,11 @@ model LogEntry {
  authorLabel         String
  authorParticipantId String?
  authorUserId        String?
  // Suivi operationnel (source de l'info ; responsable/echeance/statut pour decisions & actions).
  source              String?
  assignee            String?
  dueLabel            String?
  status              LogStatus?
  atExerciseSec       Int
  createdAt           DateTime    @default(now())

@@ -375,6 +402,15 @@ model SocialPost {
  @@index([exerciseId, createdAt])
}

/// Media simule : pilote l'habillage (masthead, couleurs, typo) de l'article cote joueur.
enum NewsOutlet {
  GENERIC
  LEMONDE
  FIGARO
  FRANCEINFO
  OUESTFRANCE
}

/// Un article de presse simule (publie par l'animation).
model NewsArticle {
  id            String     @id @default(cuid())
@@ -382,6 +418,7 @@ model NewsArticle {
  tenant        Tenant     @relation(fields: [tenantId], references: [id], onDelete: Cascade)
  exerciseId    String
  exercise      Exercise   @relation(fields: [exerciseId], references: [id], onDelete: Cascade)
  outlet        NewsOutlet @default(GENERIC)
  headline      String
  category      String?
  source        String