IDNKFAS
parent: tbd commit: 472f76c
Showing 4 changed files with 14 insertions and 14 deletions
src/backend/git.rs
@@ -14,7 +14,7 @@ use crate::model::repository::{ | ||
14 | 14 | use crate::model::user::User; |
15 | 15 | use crate::{ |
16 | 16 | messages::repository::{ |
17 | CreateRepositoryRequest, CreateRepositoryResponse, RepositoryFileInspectRequest, | |
17 | RepositoryCreateRequest, RepositoryCreateResponse, RepositoryFileInspectRequest, | |
18 | 18 | RepositoryFileInspectionResponse, RepositoryInfoRequest, RepositoryIssueLabelsRequest, |
19 | 19 | RepositoryIssueLabelsResponse, RepositoryIssuesCountRequest, RepositoryIssuesCountResponse, |
20 | 20 | RepositoryIssuesRequest, RepositoryIssuesResponse, |
@@ -211,8 +211,8 @@ impl RepositoryBackend for GitBackend { | ||
211 | 211 | async fn create_repository( |
212 | 212 | &mut self, |
213 | 213 | _user: &User, |
214 | request: &CreateRepositoryRequest, | |
215 | ) -> Result<CreateRepositoryResponse, Error> { | |
214 | request: &RepositoryCreateRequest, | |
215 | ) -> Result<RepositoryCreateResponse, Error> { | |
216 | 216 | // Check if repository already exists in the database |
217 | 217 | if let Ok(repository) = self |
218 | 218 | .find_by_owner_user_name(&request.owner, &request.name) |
@@ -224,7 +224,7 @@ impl RepositoryBackend for GitBackend { | ||
224 | 224 | }; |
225 | 225 | error!("{:?}", err); |
226 | 226 | |
227 | return Ok(CreateRepositoryResponse::Failed); | |
227 | return Ok(RepositoryCreateResponse::Failed); | |
228 | 228 | } |
229 | 229 | |
230 | 230 | // Insert the repository into the database |
@@ -238,7 +238,7 @@ impl RepositoryBackend for GitBackend { | ||
238 | 238 | let err = GitBackendError::FailedInsertingIntoDatabase(err); |
239 | 239 | error!("Failed inserting into the database! {:?}", err); |
240 | 240 | |
241 | return Ok(CreateRepositoryResponse::Failed); | |
241 | return Ok(RepositoryCreateResponse::Failed); | |
242 | 242 | } |
243 | 243 | }; |
244 | 244 | |
@@ -255,7 +255,7 @@ impl RepositoryBackend for GitBackend { | ||
255 | 255 | "Created new repository with the name {}/{}/{}", |
256 | 256 | request.owner.instance.url, request.owner.username, request.name |
257 | 257 | ); |
258 | Ok(CreateRepositoryResponse::Created) | |
258 | Ok(RepositoryCreateResponse::Created) | |
259 | 259 | } |
260 | 260 | Err(err) => { |
261 | 261 | let err = GitBackendError::FailedCreatingRepository(err); |
@@ -270,7 +270,7 @@ impl RepositoryBackend for GitBackend { | ||
270 | 270 | } |
271 | 271 | |
272 | 272 | // ??? |
273 | Ok(CreateRepositoryResponse::Failed) | |
273 | Ok(RepositoryCreateResponse::Failed) | |
274 | 274 | //Err(Box::new(err)) |
275 | 275 | } |
276 | 276 | } |
src/backend/mod.rs
@@ -13,7 +13,7 @@ use crate::{ | ||
13 | 13 | RegisterAccountResponse, |
14 | 14 | }, |
15 | 15 | repository::{ |
16 | CreateRepositoryRequest, CreateRepositoryResponse, RepositoryFileInspectRequest, | |
16 | RepositoryCreateRequest, RepositoryCreateResponse, RepositoryFileInspectRequest, | |
17 | 17 | RepositoryFileInspectionResponse, RepositoryInfoRequest, RepositoryIssueLabelsRequest, |
18 | 18 | RepositoryIssueLabelsResponse, RepositoryIssuesCountRequest, |
19 | 19 | RepositoryIssuesCountResponse, RepositoryIssuesRequest, RepositoryIssuesResponse, |
@@ -34,8 +34,8 @@ pub trait RepositoryBackend: IssuesBackend { | ||
34 | 34 | async fn create_repository( |
35 | 35 | &mut self, |
36 | 36 | user: &User, |
37 | request: &CreateRepositoryRequest, | |
38 | ) -> Result<CreateRepositoryResponse, Error>; | |
37 | request: &RepositoryCreateRequest, | |
38 | ) -> Result<RepositoryCreateResponse, Error>; | |
39 | 39 | async fn repository_info( |
40 | 40 | &mut self, |
41 | 41 | requester: Option<&User>, |
src/connection/repository.rs
@@ -2,7 +2,7 @@ use anyhow::Error; | ||
2 | 2 | |
3 | 3 | use crate::{ |
4 | 4 | messages::repository::{ |
5 | CreateRepositoryRequest, RepositoryFileInspectRequest, RepositoryInfoRequest, | |
5 | RepositoryCreateRequest, RepositoryFileInspectRequest, RepositoryInfoRequest, | |
6 | 6 | RepositoryIssueLabelsRequest, RepositoryIssuesCountRequest, RepositoryIssuesRequest, |
7 | 7 | }, |
8 | 8 | model::authenticated::{AuthenticatedUser, Message, MessageHandler, NetworkMessage, State}, |
@@ -44,7 +44,7 @@ pub async fn repository_handle( | ||
44 | 44 | } |
45 | 45 | |
46 | 46 | async fn create_repository( |
47 | Message(request): Message<CreateRepositoryRequest>, | |
47 | Message(request): Message<RepositoryCreateRequest>, | |
48 | 48 | State(connection_state): State<ConnectionState>, |
49 | 49 | AuthenticatedUser(user): AuthenticatedUser, |
50 | 50 | ) -> Result<(), RepositoryError> { |
src/messages/repository.rs
@@ -20,7 +20,7 @@ use crate::model::{ | ||
20 | 20 | /// - User Authorization |
21 | 21 | /// - Potential User permissions checks |
22 | 22 | #[derive(Clone, Serialize, Deserialize)] |
23 | pub struct CreateRepositoryRequest { | |
23 | pub struct RepositoryCreateRequest { | |
24 | 24 | pub name: String, |
25 | 25 | pub description: Option<String>, |
26 | 26 | pub visibility: RepositoryVisibility, |
@@ -29,7 +29,7 @@ pub struct CreateRepositoryRequest { | ||
29 | 29 | } |
30 | 30 | |
31 | 31 | #[derive(Clone, Serialize, Deserialize)] |
32 | pub enum CreateRepositoryResponse { | |
32 | pub enum RepositoryCreateResponse { | |
33 | 33 | Created, |
34 | 34 | Failed, |
35 | 35 | } |