feat: add publication

This commit is contained in:
ghost2023
2026-09-04 14:43:17 +03:00
parent ad791e2074
commit 0dd0e8d992
28 changed files with 1323 additions and 10 deletions

View File

@@ -17,6 +17,7 @@ export * from "./booking-window-ws";
export * from "./support-chat";
export * from "./portal-content";
export * from "./portal-content.defaults";
export * from "./publications";
export enum TradeDirection {
IMPORT = "IMPORT",

View File

@@ -0,0 +1,43 @@
/**
* Public document library for the freight portal (/publications): PDFs,
* Markdown write-ups and PowerPoint decks about the platform, uploaded and
* curated from the backoffice. Unlike `support-content`'s five fixed slugs,
* this is a real table of many rows — each row is one whole file, replaced
* wholesale rather than edited in place, so there is no version history here.
*/
/** MinIO key prefix every uploaded publication file is stored under. */
export const PUBLICATION_FILE_PREFIX = "publications/";
/** Mime types accepted for a publication upload. */
export const PUBLICATION_ALLOWED_MIME_TYPES = [
"application/pdf",
"text/markdown",
"text/x-markdown",
"application/vnd.ms-powerpoint",
"application/vnd.openxmlformats-officedocument.presentationml.presentation",
] as const;
/** One document in the public library. */
export interface Publication {
id: string;
title: string;
description: string | null;
category: string | null;
fileName: string;
fileMimeType: string;
fileSizeBytes: number;
sortOrder: number;
published: boolean;
publishedAt: string | null;
createdAt: string;
updatedAt: string;
}
/**
* Shape the anonymous portal reads — no `fileKey` (that's a MinIO object
* name, not a browser-reachable URL — a presigned MinIO URL isn't reachable
* from the browser here, see `apiConfig.ts`'s `fileViewUrl`). The portal
* builds the file's URL itself from `id` via `GET /api/publications/:id/file`.
*/
export type PublicationSummary = Omit<Publication, "published">;