add: journals base
add: avatar/banner upload endpoints
This commit is contained in:
parent
b3cac5f97a
commit
bb682add85
14 changed files with 323 additions and 22 deletions
|
@ -1 +1,2 @@
|
|||
pub const CREATE_TABLE_USERS: &str = include_str!("./sql/create_users.sql");
|
||||
pub const CREATE_TABLE_PAGES: &str = include_str!("./sql/create_pages.sql");
|
||||
|
|
|
@ -34,17 +34,9 @@ impl DataManager {
|
|||
},
|
||||
NoTls,
|
||||
);
|
||||
|
||||
let pool = Pool::builder().max_size(15).build(manager).await.unwrap();
|
||||
|
||||
let this = Self(config.clone(), read_langs(), pool);
|
||||
let c = this.clone();
|
||||
let conn = c.connect().await?;
|
||||
|
||||
conn.execute(super::common::CREATE_TABLE_USERS, &[])
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
Ok(this)
|
||||
Ok(Self(config.clone(), read_langs(), pool))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
9
crates/core/src/database/drivers/sql/create_pages.sql
Normal file
9
crates/core/src/database/drivers/sql/create_pages.sql
Normal file
|
@ -0,0 +1,9 @@
|
|||
CREATE TABLE IF NOT EXISTS pages (
|
||||
id INTEGER NOT NULL PRIMARY KEY,
|
||||
created INTEGER NOT NULL,
|
||||
title TEXT NOT NULL,
|
||||
prompt TEXT NOT NULL,
|
||||
owner TEXT NOT NULL,
|
||||
read_access TEXT NOT NULL,
|
||||
write_access TEXT NOT NULL
|
||||
)
|
|
@ -15,10 +15,9 @@ impl DataManager {
|
|||
/// Create a new [`DataManager`] (and init database).
|
||||
pub async fn new(config: Config) -> Result<Self> {
|
||||
let this = Self(config.clone(), read_langs());
|
||||
let conn = this.connect().await?;
|
||||
|
||||
let conn = this.connect().await?;
|
||||
conn.pragma_update(None, "journal_mode", "WAL").unwrap();
|
||||
conn.execute(super::common::CREATE_TABLE_USERS, ()).unwrap();
|
||||
|
||||
Ok(this)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue