Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sea orm issues #69

Open
EevieForgor opened this issue Mar 1, 2023 · 2 comments
Open

sea orm issues #69

EevieForgor opened this issue Mar 1, 2023 · 2 comments

Comments

@EevieForgor
Copy link

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'

@bendo01
Copy link

bendo01 commented Mar 9, 2023

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>,
}

@EevieForgor
Copy link
Author

hey, forgot to respond but this worked, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants