refactor: structure of an hexagonal architecture
Created a kernel crate to store models and future action implementations. Will be useful to create admin cli.
This commit is contained in:
parent
69af48bb62
commit
3713cc2443
87 changed files with 834 additions and 474 deletions
14
lib/kernel/src/repositories/users.rs
Normal file
14
lib/kernel/src/repositories/users.rs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
// user repositories
|
||||
|
||||
use crate::models::user::User;
|
||||
|
||||
use super::storage::Storage;
|
||||
use anyhow::{Result, Context};
|
||||
|
||||
async fn get_user_by_id(storage: &Storage, user_id: &str) -> Result<User> {
|
||||
sqlx::query_as::<_, User>("SELECT * FROM users WHERE id = $1")
|
||||
.bind(user_id)
|
||||
.fetch_one(&storage.0)
|
||||
.await
|
||||
.context("To get user from claim")
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue