refactor: remove loco-rs deps

This commit is contained in:
2025-03-01 15:21:14 +08:00
parent a68aab1452
commit 2844e1fc32
66 changed files with 2565 additions and 1876 deletions

View File

@@ -5,5 +5,6 @@ pub mod schema_root;
pub mod service;
pub mod util;
pub use config::GraphQLConfig;
pub use schema_root::schema;
pub use service::GraphQLService;

View File

@@ -1,7 +1,8 @@
use async_graphql::dynamic::{Schema, SchemaError};
use async_graphql::dynamic::Schema;
use sea_orm::DatabaseConnection;
use super::{config::GraphQLConfig, schema_root};
use crate::errors::RResult;
#[derive(Debug)]
pub struct GraphQLService {
@@ -9,7 +10,10 @@ pub struct GraphQLService {
}
impl GraphQLService {
pub fn new(config: GraphQLConfig, db: DatabaseConnection) -> Result<Self, SchemaError> {
pub async fn from_config_and_database(
config: GraphQLConfig,
db: DatabaseConnection,
) -> RResult<Self> {
let schema = schema_root::schema(db, config.depth_limit, config.complexity_limit)?;
Ok(Self { schema })
}