progress-pile/progress-pile-server/src/graphql/query.rs

22 lines
476 B
Rust
Raw Normal View History

2025-05-08 06:33:08 +09:00
use async_graphql::{
*,
http::GraphiQLSource,
};
use axum::{
response::{Html, IntoResponse},
routing::get,
Router,
};
use crate::{entity::{UserEntity, UserModel},};
pub struct Query;
#[Object]
impl Query {
pub async fn user(&self, user_name: String) -> Result<Option<UserModel>> {
Ok(UserEntity::find_by_name(&user_name).await?)
}
pub async fn users(&self) -> Result<Vec<UserModel>> {
Ok(UserEntity::find_all().await?)
}
}