1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-21 09:38:01 +02:00

Server: Add function to get db default value

This commit is contained in:
Laurent Cozic 2023-09-19 14:52:59 +01:00
parent 6cdb1a714a
commit 6962ba115e
2 changed files with 8 additions and 0 deletions

Binary file not shown.

View File

@ -75,6 +75,14 @@ export function changeTypeToString(t: ChangeType): string {
throw new Error(`Unkown type: ${t}`);
}
export const getDefaultValue = (tableName: string, colName: string): string|number|null => {
const table = databaseSchema[tableName];
if (!table) throw new Error(`Invalid table name: ${tableName}`);
const col = table[colName];
if (!col) throw new Error(`Invalid column name: ${tableName}.${colName}`);
return col.defaultValue;
};
export enum ShareType {
Note = 1, // When a note is shared via a public link
Folder = 3, // When a complete folder is shared with another Joplin Server user