use {
crate::types::graphql::KeyGraphQL,
carbon_core::graphql::primitives::{Pubkey, U64},
juniper::GraphQLObject,
};
#[derive(Debug, Clone, GraphQLObject)]
#[graphql(name = "Edition")]
pub struct EditionGraphQL {
pub account_metadata: crate::accounts::graphql::AccountMetadataGraphQL,
pub key: KeyGraphQL,
pub parent: Pubkey,
pub edition: U64,
}
impl TryFrom<crate::accounts::postgres::EditionRow> for EditionGraphQL {
type Error = carbon_core::error::Error;
fn try_from(row: crate::accounts::postgres::EditionRow) -> Result<Self, Self::Error> {
Ok(Self {
account_metadata: row.account_metadata.into(),
key: row.key.0.into(),
parent: carbon_core::graphql::primitives::Pubkey(row.parent.0),
edition: carbon_core::graphql::primitives::U64(*row.edition),
})
}
}