Db, refactor start
This commit is contained in:
parent
556b6b3db6
commit
cee9bf78ef
4 changed files with 24 additions and 14 deletions
8
db/Cargo.toml
Normal file
8
db/Cargo.toml
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
[package]
|
||||||
|
name = "db"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
sqlx = { version = "0.8.6", features = ["postgres", "runtime-tokio"] }
|
||||||
|
tokio = "1.45.0"
|
||||||
|
|
@ -1,7 +1,3 @@
|
||||||
use crate::atproto::{
|
|
||||||
Did,
|
|
||||||
Uri,
|
|
||||||
}
|
|
||||||
use sqlx::{
|
use sqlx::{
|
||||||
query,
|
query,
|
||||||
Database,
|
Database,
|
||||||
|
|
@ -20,11 +16,6 @@ pub struct Db<Dbimp: Database> {
|
||||||
pool: Pool<Dbimp>
|
pool: Pool<Dbimp>
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct User {
|
|
||||||
userdid: Did,
|
|
||||||
handle: Handle,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
enum Role {
|
enum Role {
|
||||||
Owner,
|
Owner,
|
||||||
|
|
@ -40,11 +31,6 @@ impl ToString for Role {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Participant {
|
|
||||||
participantdid: Did,
|
|
||||||
role: Role,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct Session {
|
pub struct Session {
|
||||||
sessionuri: Uri,
|
sessionuri: Uri,
|
||||||
label: Option<String>,
|
label: Option<String>,
|
||||||
15
db/src/interfaces.rs
Normal file
15
db/src/interfaces.rs
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
use atproto::{
|
||||||
|
Did,
|
||||||
|
Uri,
|
||||||
|
};
|
||||||
|
|
||||||
|
pub struct User {
|
||||||
|
userdid: Did,
|
||||||
|
handle: Handle,
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Participant {
|
||||||
|
participantdid: Did,
|
||||||
|
role: Role,
|
||||||
|
}
|
||||||
|
|
||||||
1
db/src/lib.rs
Normal file
1
db/src/lib.rs
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
pub struct db;
|
||||||
Loading…
Add table
Add a link
Reference in a new issue