import { Column, CreateDateColumn, Entity, PrimaryGeneratedColumn, UpdateDateColumn, } from "typeorm"; @Entity("snippets") export class SnippetEntity { @PrimaryGeneratedColumn("uuid") id: string; /** Unique identifier used to invoke the snippet: helpers.runSnippet('mySnippet', ...) */ @Column({ unique: true, nullable: true }) alias: string; /** Human-readable title displayed in the UI. */ @Column({ default: "" }) title: string; @Column("text", { nullable: true }) description: string | null; /** * The snippet body — written as a regular async function body. * It receives the same `page`, `context`, and `helpers` as exec code, plus * any positional `...args` passed by the caller. */ @Column("text") code: string; /** Latest version number; incremented whenever the snippet changes. */ @Column({ type: "int", default: 1 }) version: number; @CreateDateColumn() createdAt: Date; @UpdateDateColumn() updatedAt: Date; }