use {
crate::types::graphql::KeyGraphQL, carbon_core::graphql::primitives::U8, juniper::GraphQLObject,
};
#[derive(Debug, Clone, GraphQLObject)]
#[graphql(name = "EditionMarkerV2")]
pub struct EditionMarkerV2GraphQL {
pub account_metadata: crate::accounts::graphql::AccountMetadataGraphQL,
pub key: KeyGraphQL,
pub ledger: Vec<U8>,
}
impl TryFrom<crate::accounts::postgres::EditionMarkerV2Row> for EditionMarkerV2GraphQL {
type Error = carbon_core::error::Error;
fn try_from(row: crate::accounts::postgres::EditionMarkerV2Row) -> Result<Self, Self::Error> {
Ok(Self {
account_metadata: row.account_metadata.into(),
key: row.key.0.into(),
ledger: row
.ledger
.into_iter()
.map(carbon_core::graphql::primitives::U8)
.collect(),
})
}
}