From e46714230fda761b1f4718d7d4032302a7812c46 Mon Sep 17 00:00:00 2001 From: Julien Calixte Date: Mon, 9 Feb 2026 22:12:30 +0100 Subject: [PATCH] prune: remove content prop --- CLAUDE.md | 2 +- src/data/db.ts | 25 ++++++++++--------------- src/data/note.ts | 1 - src/migrations/init.ts | 1 - 4 files changed, 11 insertions(+), 18 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 7c3000b..b777ae1 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -37,7 +37,7 @@ deno fmt - **Runtime**: Deno (not Bun, despite the README). Uses `deno.json` for task definitions and import maps. - **Database**: SQLite via `https://deno.land/x/sqlite/mod.ts`. DB path is configurable via `SQLITE_PATH` env var, defaults to `notes.db`. -- **Note schema**: Defined as an AT Protocol lexicon in `lexicons/space/litenote/note.json`. Notes have `title`, `content` (markdown), optional `images` (blob refs), `publishedAt`, and `createdAt`. Primary key is `(did, rkey)`. +- **Note schema**: Defined as an AT Protocol lexicon in `lexicons/space/litenote/note.json`. Notes have `title`, optional `images` (blob refs), `publishedAt`, and `createdAt`. Primary key is `(did, rkey)`. - **API endpoints**: - `GET /notes?cursor=&limit=` — paginated notes (all users) - `GET /:did/notes?cursor=&limit=` — paginated notes for a specific DID diff --git a/src/data/db.ts b/src/data/db.ts index b8421eb..948b20e 100644 --- a/src/data/db.ts +++ b/src/data/db.ts @@ -5,20 +5,19 @@ export const db = new DB(Deno.env.get("SQLITE_PATH") ?? "notes.db"); export const getNotes = (cursor?: string, limit = 20) => { const rows = cursor - ? db.query<[string, string, string, string, string, string]>( - "SELECT did, rkey, title, content, publishedAt, createdAt FROM note WHERE rkey < ? ORDER BY rkey DESC LIMIT ?", + ? db.query<[string, string, string, string, string]>( + "SELECT did, rkey, title, publishedAt, createdAt FROM note WHERE rkey < ? ORDER BY rkey DESC LIMIT ?", [cursor, limit], ) - : db.query<[string, string, string, string, string, string]>( - "SELECT did, rkey, title, content, publishedAt, createdAt FROM note ORDER BY rkey DESC LIMIT ?", + : db.query<[string, string, string, string, string]>( + "SELECT did, rkey, title, publishedAt, createdAt FROM note ORDER BY rkey DESC LIMIT ?", [limit], ); - const notes = rows.map(([did, rkey, title, content, publishedAt, createdAt]) => ({ + const notes = rows.map(([did, rkey, title, publishedAt, createdAt]) => ({ did, rkey, title, - content, publishedAt, createdAt, })); @@ -31,20 +30,19 @@ export const getNotes = (cursor?: string, limit = 20) => { export const getNotesByDid = (did: string, cursor?: string, limit = 20) => { const rows = cursor - ? db.query<[string, string, string, string, string, string]>( - "SELECT did, rkey, title, content, publishedAt, createdAt FROM note WHERE did = ? AND rkey < ? ORDER BY rkey DESC LIMIT ?", + ? db.query<[string, string, string, string, string]>( + "SELECT did, rkey, title, publishedAt, createdAt FROM note WHERE did = ? AND rkey < ? ORDER BY rkey DESC LIMIT ?", [did, cursor, limit], ) - : db.query<[string, string, string, string, string, string]>( - "SELECT did, rkey, title, content, publishedAt, createdAt FROM note WHERE did = ? ORDER BY rkey DESC LIMIT ?", + : db.query<[string, string, string, string, string]>( + "SELECT did, rkey, title, publishedAt, createdAt FROM note WHERE did = ? ORDER BY rkey DESC LIMIT ?", [did, limit], ); - const notes = rows.map(([did, rkey, title, content, publishedAt, createdAt]) => ({ + const notes = rows.map(([did, rkey, title, publishedAt, createdAt]) => ({ did, rkey, title, - content, publishedAt, createdAt, })); @@ -60,7 +58,6 @@ export const upsertNote = (note: Note) => { ` INSERT INTO note ( title, - content, publishedAt, createdAt, did, @@ -70,12 +67,10 @@ export const upsertNote = (note: Note) => { ON CONFLICT(did, rkey) DO UPDATE SET title = excluded.title, - content = excluded.content, publishedAt = excluded.publishedAt `, [ note.title, - note.content, new Date(note.publishedAt).toISOString(), // publishedAt new Date(note.createdAt).toISOString(), // createdAt note.did, diff --git a/src/data/note.ts b/src/data/note.ts index ca6bdd2..c65cddb 100644 --- a/src/data/note.ts +++ b/src/data/note.ts @@ -2,7 +2,6 @@ export type Note = { did: string; rkey: string; title: string; - content: string; publishedAt: Date; createdAt: Date; }; diff --git a/src/migrations/init.ts b/src/migrations/init.ts index 094262b..40f240b 100644 --- a/src/migrations/init.ts +++ b/src/migrations/init.ts @@ -3,7 +3,6 @@ import { db } from "../data/db.ts"; db.execute(` CREATE TABLE IF NOT EXISTS note ( title TEXT NOT NULL, - content TEXT NOT NULL, publishedAt DATETIME, createdAt DATETIME NOT NULL, did TEXT NOT NULL,