Make old operations use new types
parent: tbd commit: b22dd12
Showing 3 changed files with 35 insertions and 35 deletions
giterated-daemon/src/backend/git/mod.rs
@@ -4,17 +4,17 @@ use async_trait::async_trait; | ||
4 | 4 | use git2::BranchType; |
5 | 5 | use giterated_models::instance::{Instance, RepositoryCreateRequest}; |
6 | 6 | |
7 | use giterated_models::issue::{IssueInfoBasic, IssueTag}; | |
7 | 8 | use giterated_models::object::Object; |
8 | 9 | use giterated_models::repository::{ |
9 | AccessList, Commit, DefaultBranch, Description, IssueLabel, Repository, RepositoryBranch, | |
10 | AccessList, Commit, DefaultBranch, Description, Repository, RepositoryBranch, | |
10 | 11 | RepositoryBranchRequest, RepositoryBranchesRequest, RepositoryCommitBeforeRequest, |
11 | 12 | RepositoryCommitFromIdRequest, RepositoryDiff, RepositoryDiffPatchRequest, |
12 | 13 | RepositoryDiffRequest, RepositoryFile, RepositoryFileFromIdRequest, |
13 | RepositoryFileFromPathRequest, RepositoryFileInspectRequest, RepositoryIssue, | |
14 | RepositoryIssueLabelsRequest, RepositoryIssuesCountRequest, RepositoryIssuesRequest, | |
15 | RepositoryLastCommitOfFileRequest, RepositoryStatistics, RepositoryStatisticsRequest, | |
16 | RepositoryTag, RepositoryTagRequest, RepositoryTagsRequest, RepositoryTreeEntry, | |
17 | RepositoryVisibility, Visibility, | |
14 | RepositoryFileFromPathRequest, RepositoryFileInspectRequest, RepositoryIssueTagsRequest, | |
15 | RepositoryIssuesCountRequest, RepositoryIssuesRequest, RepositoryLastCommitOfFileRequest, | |
16 | RepositoryStatistics, RepositoryStatisticsRequest, RepositoryTag, RepositoryTagRequest, | |
17 | RepositoryTagsRequest, RepositoryTreeEntry, RepositoryVisibility, Visibility, | |
18 | 18 | }; |
19 | 19 | |
20 | 20 | use giterated_models::user::User; |
@@ -729,11 +729,11 @@ impl IssuesBackend for GitBackend { | ||
729 | 729 | todo!() |
730 | 730 | } |
731 | 731 | |
732 | fn issue_labels( | |
732 | fn issue_tags( | |
733 | 733 | &mut self, |
734 | 734 | _requester: &Option<AuthenticatedUser>, |
735 | _request: &RepositoryIssueLabelsRequest, | |
736 | ) -> Result<Vec<IssueLabel>, Error> { | |
735 | _request: &RepositoryIssueTagsRequest, | |
736 | ) -> Result<Vec<IssueTag>, Error> { | |
737 | 737 | todo!() |
738 | 738 | } |
739 | 739 | |
@@ -741,7 +741,7 @@ impl IssuesBackend for GitBackend { | ||
741 | 741 | &mut self, |
742 | 742 | _requester: &Option<AuthenticatedUser>, |
743 | 743 | _request: &RepositoryIssuesRequest, |
744 | ) -> Result<Vec<RepositoryIssue>, Error> { | |
744 | ) -> Result<Vec<IssueInfoBasic>, Error> { | |
745 | 745 | todo!() |
746 | 746 | } |
747 | 747 | } |
giterated-daemon/src/backend/mod.rs
@@ -6,6 +6,7 @@ pub mod user; | ||
6 | 6 | |
7 | 7 | use anyhow::Error; |
8 | 8 | use async_trait::async_trait; |
9 | use giterated_models::issue::{IssueInfoBasic, IssueTag}; | |
9 | 10 | use giterated_models::object::Object; |
10 | 11 | use giterated_stack::{AuthenticatedUser, GiteratedStack, OperationState, StackOperationState}; |
11 | 12 | use serde_json::Value; |
@@ -18,14 +19,13 @@ use giterated_models::instance::{ | ||
18 | 19 | }; |
19 | 20 | |
20 | 21 | use giterated_models::repository::{ |
21 | Commit, IssueLabel, Repository, RepositoryBranch, RepositoryBranchRequest, | |
22 | RepositoryBranchesRequest, RepositoryCommitBeforeRequest, RepositoryCommitFromIdRequest, | |
23 | RepositoryDiff, RepositoryDiffPatchRequest, RepositoryDiffRequest, RepositoryFile, | |
24 | RepositoryFileFromIdRequest, RepositoryFileFromPathRequest, RepositoryFileInspectRequest, | |
25 | RepositoryIssue, RepositoryIssueLabelsRequest, RepositoryIssuesCountRequest, | |
26 | RepositoryIssuesRequest, RepositoryLastCommitOfFileRequest, RepositoryStatistics, | |
27 | RepositoryStatisticsRequest, RepositorySummary, RepositoryTag, RepositoryTagRequest, | |
28 | RepositoryTagsRequest, RepositoryTreeEntry, | |
22 | Commit, Repository, RepositoryBranch, RepositoryBranchRequest, RepositoryBranchesRequest, | |
23 | RepositoryCommitBeforeRequest, RepositoryCommitFromIdRequest, RepositoryDiff, | |
24 | RepositoryDiffPatchRequest, RepositoryDiffRequest, RepositoryFile, RepositoryFileFromIdRequest, | |
25 | RepositoryFileFromPathRequest, RepositoryFileInspectRequest, RepositoryIssueTagsRequest, | |
26 | RepositoryIssuesCountRequest, RepositoryIssuesRequest, RepositoryLastCommitOfFileRequest, | |
27 | RepositoryStatistics, RepositoryStatisticsRequest, RepositorySummary, RepositoryTag, | |
28 | RepositoryTagRequest, RepositoryTagsRequest, RepositoryTreeEntry, | |
29 | 29 | }; |
30 | 30 | |
31 | 31 | use giterated_models::user::User; |
@@ -142,16 +142,16 @@ pub trait IssuesBackend { | ||
142 | 142 | requester: &Option<AuthenticatedUser>, |
143 | 143 | request: &RepositoryIssuesCountRequest, |
144 | 144 | ) -> Result<u64, Error>; |
145 | fn issue_labels( | |
145 | fn issue_tags( | |
146 | 146 | &mut self, |
147 | 147 | requester: &Option<AuthenticatedUser>, |
148 | request: &RepositoryIssueLabelsRequest, | |
149 | ) -> Result<Vec<IssueLabel>, Error>; | |
148 | request: &RepositoryIssueTagsRequest, | |
149 | ) -> Result<Vec<IssueTag>, Error>; | |
150 | 150 | fn issues( |
151 | 151 | &mut self, |
152 | 152 | requester: &Option<AuthenticatedUser>, |
153 | 153 | request: &RepositoryIssuesRequest, |
154 | ) -> Result<Vec<RepositoryIssue>, Error>; | |
154 | ) -> Result<Vec<IssueInfoBasic>, Error>; | |
155 | 155 | } |
156 | 156 | |
157 | 157 | #[async_trait::async_trait] |
giterated-models/src/repository/operations.rs
@@ -2,15 +2,15 @@ use serde::{Deserialize, Serialize}; | ||
2 | 2 | |
3 | 3 | use crate::{ |
4 | 4 | error::{OperationError, RepositoryError}, |
5 | issue::{IssueInfoBasic, IssueTag}, | |
5 | 6 | object::Object, |
6 | 7 | object_backend::ObjectBackend, |
7 | 8 | operation::GiteratedOperation, |
8 | 9 | }; |
9 | 10 | |
10 | 11 | use super::{ |
11 | Commit, IssueLabel, Repository, RepositoryBranch, RepositoryBranchFilter, RepositoryDiff, | |
12 | RepositoryFile, RepositoryIssue, RepositoryStatistics, RepositoryTag, RepositoryTreeEntry, | |
13 | RepositoryView, | |
12 | Commit, Repository, RepositoryBranch, RepositoryBranchFilter, RepositoryDiff, RepositoryFile, | |
13 | RepositoryStatistics, RepositoryTag, RepositoryTreeEntry, RepositoryView, | |
14 | 14 | }; |
15 | 15 | |
16 | 16 | /// A request to get a repository's information. |
@@ -176,7 +176,7 @@ impl GiteratedOperation<Repository> for RepositoryIssuesCountRequest { | ||
176 | 176 | type Failure = RepositoryError; |
177 | 177 | } |
178 | 178 | |
179 | /// A request to get a repository's issues count. | |
179 | /// A request to get a repository's issue tags. | |
180 | 180 | /// |
181 | 181 | /// # Authentication |
182 | 182 | /// - Instance Authentication |
@@ -186,14 +186,14 @@ impl GiteratedOperation<Repository> for RepositoryIssuesCountRequest { | ||
186 | 186 | /// - User Authorization |
187 | 187 | /// - Potential User permissions checks |
188 | 188 | #[derive(Clone, Debug, Serialize, Deserialize)] |
189 | pub struct RepositoryIssueLabelsRequest; | |
189 | pub struct RepositoryIssueTagsRequest; | |
190 | 190 | |
191 | impl GiteratedOperation<Repository> for RepositoryIssueLabelsRequest { | |
192 | type Success = Vec<IssueLabel>; | |
191 | impl GiteratedOperation<Repository> for RepositoryIssueTagsRequest { | |
192 | type Success = Vec<IssueTag>; | |
193 | 193 | type Failure = RepositoryError; |
194 | 194 | } |
195 | 195 | |
196 | /// A request to get a repository's issue labels. | |
196 | /// A request to get a repository's issues. | |
197 | 197 | /// |
198 | 198 | /// # Authentication |
199 | 199 | /// - Instance Authentication |
@@ -206,7 +206,7 @@ impl GiteratedOperation<Repository> for RepositoryIssueLabelsRequest { | ||
206 | 206 | pub struct RepositoryIssuesRequest; |
207 | 207 | |
208 | 208 | impl GiteratedOperation<Repository> for RepositoryIssuesRequest { |
209 | type Success = Vec<RepositoryIssue>; | |
209 | type Success = Vec<IssueInfoBasic>; | |
210 | 210 | type Failure = RepositoryError; |
211 | 211 | } |
212 | 212 | |
@@ -532,18 +532,18 @@ impl<S: Clone + Send + Sync, B: ObjectBackend<S> + std::fmt::Debug> Object<'_, S | ||
532 | 532 | // .await |
533 | 533 | // } |
534 | 534 | |
535 | pub async fn issue_labels( | |
535 | pub async fn issue_tags( | |
536 | 536 | &mut self, |
537 | 537 | operation_state: &S, |
538 | ) -> Result<Vec<IssueLabel>, OperationError<RepositoryError>> { | |
539 | self.request::<RepositoryIssueLabelsRequest>(RepositoryIssueLabelsRequest, operation_state) | |
538 | ) -> Result<Vec<IssueTag>, OperationError<RepositoryError>> { | |
539 | self.request::<RepositoryIssueTagsRequest>(RepositoryIssueTagsRequest, operation_state) | |
540 | 540 | .await |
541 | 541 | } |
542 | 542 | |
543 | 543 | pub async fn issues( |
544 | 544 | &mut self, |
545 | 545 | operation_state: &S, |
546 | ) -> Result<Vec<RepositoryIssue>, OperationError<RepositoryError>> { | |
546 | ) -> Result<Vec<IssueInfoBasic>, OperationError<RepositoryError>> { | |
547 | 547 | self.request::<RepositoryIssuesRequest>(RepositoryIssuesRequest, operation_state) |
548 | 548 | .await |
549 | 549 | } |