mirror of
https://github.com/perstarkse/minne.git
synced 2026-03-24 18:31:45 +01:00
updated devenv, new structure
This commit is contained in:
@@ -24,6 +24,14 @@ pub async fn index_handler(
|
||||
|
||||
let queue_length = state.rabbitmq_consumer.get_queue_length().await?;
|
||||
|
||||
// let knowledge_entities = User::get_knowledge_entities(
|
||||
// &auth.current_user.clone().unwrap().id,
|
||||
// &state.surreal_db_client,
|
||||
// )
|
||||
// .await?;
|
||||
|
||||
// info!("{:?}", knowledge_entities);
|
||||
|
||||
let output = render_template(
|
||||
IndexData::template_name(),
|
||||
IndexData {
|
||||
|
||||
@@ -7,6 +7,8 @@ use axum_session_auth::Authentication;
|
||||
use surrealdb::{engine::any::Any, Surreal};
|
||||
use uuid::Uuid;
|
||||
|
||||
use super::knowledge_entity::KnowledgeEntity;
|
||||
|
||||
stored_object!(User, "user", {
|
||||
email: String,
|
||||
password: String,
|
||||
@@ -153,4 +155,18 @@ impl User {
|
||||
Err(ApiError::UserNotFound)
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn get_knowledge_entities(
|
||||
id: &str,
|
||||
db: &SurrealDbClient,
|
||||
) -> Result<Vec<KnowledgeEntity>, ApiError> {
|
||||
let entities: Vec<KnowledgeEntity> = db
|
||||
.client
|
||||
.query("SELECT * FROM knowledge_entity WHERE user_id = $user_id")
|
||||
.bind(("user_id", id.to_owned()))
|
||||
.await?
|
||||
.take(0)?;
|
||||
|
||||
Ok(entities)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user