mirror of
https://github.com/nullishamy/ferri.git
synced 2025-06-28 09:04:18 +00:00
refactor: everything
This commit is contained in:
parent
90577e43b0
commit
022e6f9c6d
32 changed files with 1570 additions and 668 deletions
|
@ -9,33 +9,47 @@ use clap::Parser;
|
|||
#[derive(Parser)]
|
||||
#[command(version, about, long_about = None)]
|
||||
struct Cli {
|
||||
#[arg(short, long)]
|
||||
init: bool
|
||||
#[arg(short, long)]
|
||||
init: bool,
|
||||
}
|
||||
|
||||
#[rocket::main]
|
||||
async fn main() {
|
||||
let cli = Cli::parse();
|
||||
if cli.init {
|
||||
// Seed DB
|
||||
let pool = SqlitePool::connect(&env::var("DATABASE_URL").unwrap()).await.unwrap();
|
||||
let mut conn = pool.acquire().await.unwrap();
|
||||
|
||||
sqlx::query!(r#"
|
||||
let cli = Cli::parse();
|
||||
if cli.init {
|
||||
// Seed DB
|
||||
let pool = SqlitePool::connect(&env::var("DATABASE_URL").unwrap())
|
||||
.await
|
||||
.unwrap();
|
||||
let mut conn = pool.acquire().await.unwrap();
|
||||
|
||||
sqlx::query!(
|
||||
r#"
|
||||
INSERT INTO actor (id, inbox, outbox)
|
||||
VALUES (?1, ?2, ?3)
|
||||
"#, "https://ferri.amy.mov/users/amy", "https://ferri.amy.mov/users/amy/inbox", "https://ferri.amy.mov/users/amy/outbox")
|
||||
.execute(&mut *conn)
|
||||
.await.unwrap();
|
||||
"#,
|
||||
"https://ferri.amy.mov/users/amy",
|
||||
"https://ferri.amy.mov/users/amy/inbox",
|
||||
"https://ferri.amy.mov/users/amy/outbox"
|
||||
)
|
||||
.execute(&mut *conn)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
sqlx::query!(r#"
|
||||
INSERT INTO user (id, actor_id, display_name)
|
||||
VALUES (?1, ?2, ?3)
|
||||
"#, "amy", "https://ferri.amy.mov/users/amy", "amy")
|
||||
.execute(&mut *conn)
|
||||
.await.unwrap();
|
||||
} else {
|
||||
let _ = launch().launch().await;
|
||||
}
|
||||
sqlx::query!(
|
||||
r#"
|
||||
INSERT INTO user (id, username, actor_id, display_name)
|
||||
VALUES (?1, ?2, ?3, ?4)
|
||||
"#,
|
||||
"9b9d497b-2731-435f-a929-e609ca69dac9",
|
||||
"amy",
|
||||
"https://ferri.amy.mov/users/amy",
|
||||
"amy"
|
||||
)
|
||||
.execute(&mut *conn)
|
||||
.await
|
||||
.unwrap();
|
||||
} else {
|
||||
let _ = launch().launch().await;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue