feat: add language support
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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,
|
||||
);
|
||||
};
|
||||
|
||||
@@ -5,4 +5,5 @@ export type Note = {
|
||||
publishedAt: string;
|
||||
createdAt: string;
|
||||
discoverable?: boolean;
|
||||
language?: string
|
||||
};
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user