add: journal note tags and directories

This commit is contained in:
trisua 2025-06-21 19:44:28 -04:00
parent a37312fecf
commit af6fbdf04e
16 changed files with 722 additions and 78 deletions

View file

@ -20,6 +20,7 @@ impl DataManager {
owner: get!(x->2(i64)) as usize,
title: get!(x->3(String)),
privacy: serde_json::from_str(&get!(x->4(String))).unwrap(),
dirs: serde_json::from_str(&get!(x->5(String))).unwrap(),
}
}
@ -128,13 +129,14 @@ impl DataManager {
let res = execute!(
&conn,
"INSERT INTO journals VALUES ($1, $2, $3, $4, $5)",
"INSERT INTO journals VALUES ($1, $2, $3, $4, $5, $6)",
params![
&(data.id as i64),
&(data.created as i64),
&(data.owner as i64),
&data.title,
&serde_json::to_string(&data.privacy).unwrap(),
&serde_json::to_string(&data.dirs).unwrap(),
]
);
@ -183,4 +185,5 @@ impl DataManager {
auto_method!(update_journal_title(&str)@get_journal_by_id:MANAGE_JOURNALS -> "UPDATE journals SET title = $1 WHERE id = $2" --cache-key-tmpl="atto.journal:{}");
auto_method!(update_journal_privacy(JournalPrivacyPermission)@get_journal_by_id:MANAGE_JOURNALS -> "UPDATE journals SET privacy = $1 WHERE id = $2" --serde --cache-key-tmpl="atto.journal:{}");
auto_method!(update_journal_dirs(Vec<(usize, usize, String)>)@get_journal_by_id:MANAGE_JOURNALS -> "UPDATE journals SET dirs = $1 WHERE id = $2" --serde --cache-key-tmpl="atto.journal:{}");
}