Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,16 @@ impl TableData {
&self,
ctx: &Context<'_>,
columns: Option<Vec<String>>,
) -> Option<Result<HashMap<String, Vec<Value>>>> {
Some(self.inner_data(ctx, columns).await)
}
}

impl TableData {
async fn inner_data(
&self,
ctx: &Context<'_>,
columns: Option<Vec<String>>,
) -> Result<HashMap<String, Vec<Value>>> {
let auth = ctx.data::<Option<AuthHeader>>()?;
let headers = auth.as_ref().map(AuthHeader::as_header_map);
Expand All @@ -161,7 +171,7 @@ struct Run {
#[Object]
impl Run {
async fn scan_number(&self) -> Option<i64> {
if let NodeAttributes::Container(attr) = &self.data.attributes {
if let NodeAttributes::Container(attr) = &*self.data.attributes {
attr.metadata.start_doc().map(|sd| sd.scan_id)
} else {
None
Expand Down Expand Up @@ -191,7 +201,7 @@ impl Run {
)
.await?;
for dataset in stream_data.into_data() {
match dataset.attributes {
match *dataset.attributes {
NodeAttributes::Array(attrs) => sources.push(RunData::Array(ArrayData {
run: self,
stream: stream.id.clone(),
Expand Down
4 changes: 2 additions & 2 deletions src/model/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ impl DataOption {
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Data {
pub id: String,
pub attributes: NodeAttributes,
pub links: Links,
pub attributes: Box<NodeAttributes>,
pub links: Box<Links>,
pub meta: Value,
}

Expand Down
Loading