feat: add language support
This commit is contained in:
@@ -21,7 +21,7 @@
|
|||||||
},
|
},
|
||||||
"language": {
|
"language": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "Most used language in the note",
|
"description": "Most used language in the note. In ISO 639-3 code.",
|
||||||
"maxLength": 10,
|
"maxLength": 10,
|
||||||
"knownValues": [
|
"knownValues": [
|
||||||
"afr",
|
"afr",
|
||||||
|
|||||||
@@ -108,14 +108,16 @@ export const upsertNote = (note: Note) => {
|
|||||||
createdAt,
|
createdAt,
|
||||||
did,
|
did,
|
||||||
rkey,
|
rkey,
|
||||||
discoverable
|
discoverable,
|
||||||
|
language
|
||||||
)
|
)
|
||||||
VALUES (?, ?, ?, ?, ?, ?)
|
VALUES (?, ?, ?, ?, ?, ?, ?)
|
||||||
ON CONFLICT(did, rkey)
|
ON CONFLICT(did, rkey)
|
||||||
DO UPDATE SET
|
DO UPDATE SET
|
||||||
title = excluded.title,
|
title = excluded.title,
|
||||||
publishedAt = excluded.publishedAt,
|
publishedAt = excluded.publishedAt,
|
||||||
discoverable = excluded.discoverable
|
discoverable = excluded.discoverable,
|
||||||
|
language = excluded.language
|
||||||
`,
|
`,
|
||||||
note.title,
|
note.title,
|
||||||
note.publishedAt ? new Date(note.publishedAt).toISOString() : now,
|
note.publishedAt ? new Date(note.publishedAt).toISOString() : now,
|
||||||
@@ -123,5 +125,6 @@ export const upsertNote = (note: Note) => {
|
|||||||
note.did,
|
note.did,
|
||||||
note.rkey,
|
note.rkey,
|
||||||
note.discoverable !== false ? 1 : 0,
|
note.discoverable !== false ? 1 : 0,
|
||||||
|
note.language,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,4 +5,5 @@ export type Note = {
|
|||||||
publishedAt: string;
|
publishedAt: string;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
discoverable?: boolean;
|
discoverable?: boolean;
|
||||||
|
language?: string
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -20,6 +20,14 @@ try {
|
|||||||
// Column already exists — no-op
|
// Column already exists — no-op
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
db.exec(
|
||||||
|
`ALTER TABLE note ADD COLUMN language STRING;`,
|
||||||
|
);
|
||||||
|
} catch {
|
||||||
|
// Column already exists — no-op
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
db.exec(`ALTER TABLE note RENAME COLUMN listed TO discoverable;`);
|
db.exec(`ALTER TABLE note RENAME COLUMN listed TO discoverable;`);
|
||||||
} catch {
|
} catch {
|
||||||
|
|||||||
Reference in New Issue
Block a user