(
&self,
parent: &RepoTopic,
name: String,
)
| 744 | } |
| 745 | |
| 746 | fn make_topic( |
| 747 | &self, |
| 748 | parent: &RepoTopic, |
| 749 | name: String, |
| 750 | ) -> Result<(RepoTopic, BTreeSet<ParentTopic>)> { |
| 751 | let added = chrono::Utc::now(); |
| 752 | let id = ExternalId::make(); |
| 753 | let parent_topics = BTreeSet::from([parent.to_parent_topic()]); |
| 754 | |
| 755 | let topic = RepoTopic { |
| 756 | api_version: API_VERSION.into(), |
| 757 | metadata: RepoTopicMetadata { |
| 758 | added, |
| 759 | id, |
| 760 | details: Some(RepoTopicDetails { |
| 761 | root: false, |
| 762 | synonyms: vec![Synonym { |
| 763 | added, |
| 764 | locale: self.locale.to_owned(), |
| 765 | name, |
| 766 | }], |
| 767 | timerange: None, |
| 768 | }), |
| 769 | }, |
| 770 | parent_topics: parent_topics.clone(), |
| 771 | children: BTreeSet::new(), |
| 772 | }; |
| 773 | |
| 774 | Ok((topic, parent_topics)) |
| 775 | } |
| 776 | |
| 777 | fn ensure_topic(&self, mutation: &Mutation, topic_id: &ExternalId) -> RepoTopic { |
| 778 | match mutation.fetch_topic(self.repo_id, topic_id) { |
no test coverage detected