MCPcopy Create free account
hub / github.com/emwalker/digraph / upsert_link

Method upsert_link

backend/src/graphql/mutation.rs:492–512  ·  view source on GitHub ↗
(
        &self,
        ctx: &Context<'_>,
        input: UpsertLinkInput,
    )

Source from the content-addressed store, hash-verified

490 }
491
492 async fn upsert_link(
493 &self,
494 ctx: &Context<'_>,
495 input: UpsertLinkInput,
496 ) -> Result<UpsertLinkPayload> {
497 let store = ctx.data_unchecked::<Store>();
498 let result = store.upsert_link(input).await?;
499
500 let link_edge = if let Some(link) = &result.link {
501 let link_id = link.id();
502 let link: Link = store.fetch_link(link_id.to_owned()).await?.try_into()?;
503 Some(LinkEdge::new(String::from("0"), link))
504 } else {
505 None
506 };
507
508 Ok(UpsertLinkPayload {
509 alerts: result.alerts.iter().map(alert::Alert::from).collect_vec(),
510 link_edge,
511 })
512 }
513
514 async fn upsert_topic(
515 &self,

Callers

nothing calls this directly

Calls 4

idMethod · 0.45
try_intoMethod · 0.45
fetch_linkMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected