use {crate::types::graphql::ProgramAuthorityGraphQL, juniper::GraphQLObject};
#[derive(Debug, Clone, GraphQLObject)]
#[graphql(name = "AuthorityConfig")]
pub struct AuthorityConfigGraphQL {
pub account_metadata: crate::accounts::graphql::AccountMetadataGraphQL,
pub authorities: Vec<ProgramAuthorityGraphQL>,
}
impl TryFrom<crate::accounts::postgres::AuthorityConfigRow> for AuthorityConfigGraphQL {
type Error = carbon_core::error::Error;
fn try_from(row: crate::accounts::postgres::AuthorityConfigRow) -> Result<Self, Self::Error> {
Ok(Self {
account_metadata: row.account_metadata.into(),
authorities: row
.authorities
.0
.into_iter()
.map(|item| item.into())
.collect(),
})
}
}