(
&self,
ctx: &Context<'_>,
input: SelectRepositoryInput,
)
| 380 | } |
| 381 | |
| 382 | async fn select_repository( |
| 383 | &self, |
| 384 | ctx: &Context<'_>, |
| 385 | input: SelectRepositoryInput, |
| 386 | ) -> Result<SelectRepositoryPayload> { |
| 387 | let SelectRepositoryInput { |
| 388 | repo_id, |
| 389 | current_topic_id, |
| 390 | .. |
| 391 | } = input; |
| 392 | |
| 393 | let repo_id: Option<RepoId> = match repo_id { |
| 394 | Some(repo_id) => Some(repo_id.to_string().try_into()?), |
| 395 | None => None, |
| 396 | }; |
| 397 | |
| 398 | let store = ctx.data_unchecked::<Store>(); |
| 399 | let psql::SelectRepositoryResult { repo, actor } = store.select_repository(repo_id).await?; |
| 400 | |
| 401 | let current_topic = match (repo_id, current_topic_id) { |
| 402 | (Some(repo_id), Some(topic_id)) => { |
| 403 | let topic_id: ExternalId = topic_id.to_string().try_into()?; |
| 404 | let key = Okey(topic_id, repo_id); |
| 405 | Some(store.fetch_topic_by_key(key).await?.try_into()?) |
| 406 | } |
| 407 | |
| 408 | _ => None, |
| 409 | }; |
| 410 | |
| 411 | Ok(SelectRepositoryPayload { |
| 412 | repo, |
| 413 | current_topic, |
| 414 | viewer: User::from(&actor), |
| 415 | }) |
| 416 | } |
| 417 | |
| 418 | async fn update_link_parent_topics( |
| 419 | &self, |
nothing calls this directly
no test coverage detected