draft db actions

This commit is contained in:
yggverse 2024-10-03 00:31:41 +03:00
parent ad3f6083e1
commit 17dedbd36e
3 changed files with 52 additions and 31 deletions

View file

@ -113,4 +113,28 @@ impl App {
pub fn run(&self) -> ExitCode {
self.app.run()
}
pub fn save(&self) {
// Cleanup previous record
match self.database.clean() {
Ok(_) => {
// Delegate clean action to children components
// self.browser.clean(app_id) @TODO
// ..
// Create new record
match self.database.add() {
Ok(_) => {
// let app_id = self.database.last_insert_id();
// Delegate save action to children components
// self.browser.save(app_id) @TODO
// ..
}
Err(error) => panic!("{error}"), // @TODO
}
}
Err(error) => panic!("{error}"), // @TODO
}
}
}