examples
examples copied to clipboard
sea orm issues
i get an error when using async_graphql to return a seaorm model from two routes:
thread 'main' panicked at: 'entity::user::Model' and 'entity::config::Model' have the same GraphQL name 'Model'
add this to your model #[graphql(name = "GenericLiterateCategory")]
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize, SimpleObject)]
#[sea_orm(schema_name = "public", table_name = "posts")]
#[graphql(name = "Post")] // <- this makes GraphQL recognize Model to Post Entity
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: Uuid,
pub title: String,
pub created_by: Option<Uuid>,
pub updated_by: Option<Uuid>,
pub created_at: Option<DateTime>,
pub updated_at: Option<DateTime>,
pub sync_at: Option<DateTime>,
pub deleted_at: Option<DateTime>,
}
hey, forgot to respond but this worked, thank you!