feat: add language support

This commit is contained in:
Julien Calixte
2026-03-01 17:46:02 +01:00
parent 2b54c8dd00
commit 6374566316
4 changed files with 16 additions and 4 deletions

View File

@@ -21,7 +21,7 @@
},
"language": {
"type": "string",
"description": "Most used language in the note",
"description": "Most used language in the note. In ISO 639-3 code.",
"maxLength": 10,
"knownValues": [
"afr",

View File

@@ -108,14 +108,16 @@ export const upsertNote = (note: Note) => {
createdAt,
did,
rkey,
discoverable
discoverable,
language
)
VALUES (?, ?, ?, ?, ?, ?)
VALUES (?, ?, ?, ?, ?, ?, ?)
ON CONFLICT(did, rkey)
DO UPDATE SET
title = excluded.title,
publishedAt = excluded.publishedAt,
discoverable = excluded.discoverable
discoverable = excluded.discoverable,
language = excluded.language
`,
note.title,
note.publishedAt ? new Date(note.publishedAt).toISOString() : now,
@@ -123,5 +125,6 @@ export const upsertNote = (note: Note) => {
note.did,
note.rkey,
note.discoverable !== false ? 1 : 0,
note.language,
);
};

View File

@@ -5,4 +5,5 @@ export type Note = {
publishedAt: string;
createdAt: string;
discoverable?: boolean;
language?: string
};

View File

@@ -20,6 +20,14 @@ try {
// Column already exists — no-op
}
try {
db.exec(
`ALTER TABLE note ADD COLUMN language STRING;`,
);
} catch {
// Column already exists — no-op
}
try {
db.exec(`ALTER TABLE note RENAME COLUMN listed TO discoverable;`);
} catch {