mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-07 07:15:45 +00:00
feat: add publication
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
import { BaseEntity } from "@edr/api-common";
|
||||
import { Column, Entity, Index } from "typeorm";
|
||||
|
||||
/**
|
||||
* One document in the freight portal's public library (/publications) — a
|
||||
* PDF, Markdown write-up, or PowerPoint deck about the platform, uploaded and
|
||||
* curated from the backoffice. Unlike `SupportDocument`'s five fixed slugs
|
||||
* edited in place, this is a real table of many rows and each upload is a
|
||||
* whole new file — there is no version-history log here, a re-upload just
|
||||
* replaces the file columns (see `PublicationsService.replaceFile`).
|
||||
*/
|
||||
@Entity({ schema: "freight", name: "publications" })
|
||||
@Index(["published", "sortOrder"])
|
||||
export class Publication extends BaseEntity {
|
||||
@Column({ name: "title", type: "varchar", length: 200 })
|
||||
title!: string;
|
||||
|
||||
@Column({ name: "description", type: "text", nullable: true })
|
||||
description?: string | null;
|
||||
|
||||
@Column({ name: "category", type: "varchar", length: 60, nullable: true })
|
||||
category?: string | null;
|
||||
|
||||
/** MinIO object key. Never a signed URL — those expire; sign on read instead. */
|
||||
@Column({ name: "file_key", type: "varchar", length: 512 })
|
||||
fileKey!: string;
|
||||
|
||||
/** Original filename, used for the download's Content-Disposition. */
|
||||
@Column({ name: "file_name", type: "varchar", length: 255 })
|
||||
fileName!: string;
|
||||
|
||||
@Column({ name: "file_mime_type", type: "varchar", length: 120 })
|
||||
fileMimeType!: string;
|
||||
|
||||
@Column({ name: "file_size_bytes", type: "bigint" })
|
||||
fileSizeBytes!: number;
|
||||
|
||||
/** Manual ordering in the backoffice list and the public grid. */
|
||||
@Column({ name: "sort_order", type: "integer", default: 0 })
|
||||
sortOrder!: number;
|
||||
|
||||
/** Unpublish without deleting — hides it from the public list only. */
|
||||
@Column({ name: "published", type: "boolean", default: true })
|
||||
published!: boolean;
|
||||
|
||||
@Column({ name: "published_at", type: "timestamptz", nullable: true })
|
||||
publishedAt?: Date | null;
|
||||
|
||||
@Column({ name: "uploaded_by_id", type: "uuid", nullable: true })
|
||||
uploadedById?: string | null;
|
||||
}
|
||||
Reference in New Issue
Block a user