ConusAI vendor v0.1.0-dev.20261027+9b1131fb
ci / gate (push) Waiting to run

This commit is contained in:
ConusAI vendor v0.1.0-dev.20261027+9b1131fb
2026-10-27 18:05:17 +00:00
commit 3102273ec7
538 changed files with 80203 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
// The tables of the notes module. Two, both project-owned.
//
// `notes_note` is the note. `notes_attachment` links a note to a row of the files module: the file
// id is an opaque id and never a foreign key (spec §4.4), and the bytes, the size, the digest and
// the object in the Blob store stay the files module's, so there is one canonical copy of a file.
import { defineEntity, idSchema } from "@conusai-kit/data"
import { z } from "zod"
export const notes = defineEntity({
name: "note",
table: "notes_note",
tenancy: "project",
fields: {
title: z.string().min(1).max(200),
body: z.string().max(20_000),
createdBy: idSchema,
},
indexes: [["createdBy"]],
})
export const attachments = defineEntity({
name: "attachment",
table: "notes_attachment",
tenancy: "project",
fields: {
noteId: idSchema,
fileId: idSchema,
attachedBy: idSchema,
},
// A file is attached to a note once; attaching it again is the call it already answered.
unique: [["noteId", "fileId"]],
// The file's own index: deleting a file looks its attachments up by it.
indexes: [["noteId"], ["fileId"]],
})
/** Every table this module owns, in the order a migration creates them. */
export const NOTES_ENTITIES = Object.freeze([notes, attachments])