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

async-graphql enum should simply be a ordinary enum #30

Closed
Tracked by #34
billy1624 opened this issue Aug 4, 2022 · 1 comment · Fixed by #36
Closed
Tracked by #34

async-graphql enum should simply be a ordinary enum #30

billy1624 opened this issue Aug 4, 2022 · 1 comment · Fixed by #36

Comments

@billy1624
Copy link
Member

The async-graphql enum is just a wrapper of the SeaORM enum. So, it's confusing at a glance to see SeaORM attributes appear on the it.

#[derive(Debug, Copy, Clone, Eq, PartialEq, EnumIter, DeriveActiveEnum, Enum)]
#[graphql(remote = "sea_orm_active_enums::Rating")]
#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "Rating")]
pub enum Rating {
#[sea_orm(string_value = "G")]
G,
#[sea_orm(string_value = "PG")]
Pg,
#[sea_orm(string_value = "PG-13")]
Pg13,
#[sea_orm(string_value = "R")]
R,
#[sea_orm(string_value = "NC-17")]
Nc17,
}

The above can be simplify to

use crate::orm::sea_orm_active_enums;
use async_graphql::*;
use sea_orm::entity::prelude::*;

#[derive(Debug, Copy, Clone, Eq, PartialEq, Enum)]
#[graphql(remote = "sea_orm_active_enums::Rating")]
pub enum Rating {
    G,
    Pg,
    Pg13,
    R,
    Nc17,
}
@karatakis
Copy link
Collaborator

Good point. It will be replaced ASAP

@karatakis karatakis mentioned this issue Aug 8, 2022
17 tasks
@karatakis karatakis mentioned this issue Aug 29, 2022
4 tasks
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

Successfully merging a pull request may close this issue.

2 participants