import type { IdObject, DateValue } from "./common.js"; import type EJSONType from "../../EJSONType.js"; import type { Organization } from "../Organization.js"; import type { Project } from "../Project.js"; import type { User } from "../User.js"; type ObjectIDCtor = typeof EJSONType["ObjectID"]; type ObjectID = InstanceType; /** * Auteur d'une actualité */ export interface NewsAuthor { id: string; name: string; type: string; profilThumbImageUrl?: string; [k: string]: unknown; } /** * Personne ayant partagé l'actualité */ export interface NewsSharedBy { id: string; name: string; type: string; updated: DateValue; comment: string | null; profilThumbImageUrl?: string; [k: string]: unknown; } /** * Cible de l'actualité */ export interface NewsTarget { id: string; name: string; type: string; profilThumbImageUrl?: string; [k: string]: unknown; } /** * Mention dans une actualité */ export interface NewsMention { id: string; slug: string; type: string; name: string; value: string; count: string; [k: string]: unknown; } /** * Médias fichiers */ export interface NewsMediaFile { countFiles: string; files: any[]; } /** * Médias images */ export interface NewsMediaImg { countImages: string; images: any[]; } /** * Scope de l'actualité */ export interface NewsScope { type: string; [k: string]: unknown; } /** * Structure JSON brute retournée par l'API */ export interface NewsItemJson { _id: IdObject; id: string; type: "news"; collection: "news"; text: string; date: DateValue; created: DateValue; updated: DateValue; markdownActive: boolean; scope: NewsScope; comment: string | null; typeSig: "news"; author: NewsAuthor; sharedBy: NewsSharedBy[]; lastAuthorShare: NewsSharedBy; target: NewsTarget; mediaFile: NewsMediaFile; mediaImg: NewsMediaImg; mentions?: NewsMention[]; [key: string]: unknown; } /** * Structure normalisée utilisée côté client * Les dates sont converties en objets Date * Les counts sont convertis en numbers * Les champs author, target, sharedBy peuvent être des instances d'entités */ export interface NewsItemNormalized { _id: ObjectID; id: string; type: "news"; collection: "news"; text: string; date: Date; created: Date; updated: Date; markdownActive: boolean; scope: NewsScope; comment: string | null; typeSig: "news"; author: NewsAuthor | User | Organization; sharedBy: Array<(Omit & { updated: Date; }) | User | Organization>; lastAuthorShare: (Omit & { updated: Date; }) | User | Organization; target: NewsTarget | User | Organization | Project; mediaFile: NewsMediaFile; mediaImg: NewsMediaImg; mentions?: NewsMention[]; [key: string]: unknown; } export {};