diff --git a/src/backend/git.rs b/src/backend/git.rs index a2d5899..e54a9e8 100644 --- a/src/backend/git.rs +++ b/src/backend/git.rs @@ -14,7 +14,7 @@ use crate::model::repository::{ use crate::model::user::User; use crate::{ messages::repository::{ - CreateRepositoryRequest, CreateRepositoryResponse, RepositoryFileInspectRequest, + RepositoryCreateRequest, RepositoryCreateResponse, RepositoryFileInspectRequest, RepositoryFileInspectionResponse, RepositoryInfoRequest, RepositoryIssueLabelsRequest, RepositoryIssueLabelsResponse, RepositoryIssuesCountRequest, RepositoryIssuesCountResponse, RepositoryIssuesRequest, RepositoryIssuesResponse, @@ -211,8 +211,8 @@ impl RepositoryBackend for GitBackend { async fn create_repository( &mut self, _user: &User, - request: &CreateRepositoryRequest, - ) -> Result { + request: &RepositoryCreateRequest, + ) -> Result { // Check if repository already exists in the database if let Ok(repository) = self .find_by_owner_user_name(&request.owner, &request.name) @@ -224,7 +224,7 @@ impl RepositoryBackend for GitBackend { }; error!("{:?}", err); - return Ok(CreateRepositoryResponse::Failed); + return Ok(RepositoryCreateResponse::Failed); } // Insert the repository into the database @@ -238,7 +238,7 @@ impl RepositoryBackend for GitBackend { let err = GitBackendError::FailedInsertingIntoDatabase(err); error!("Failed inserting into the database! {:?}", err); - return Ok(CreateRepositoryResponse::Failed); + return Ok(RepositoryCreateResponse::Failed); } }; @@ -255,7 +255,7 @@ impl RepositoryBackend for GitBackend { "Created new repository with the name {}/{}/{}", request.owner.instance.url, request.owner.username, request.name ); - Ok(CreateRepositoryResponse::Created) + Ok(RepositoryCreateResponse::Created) } Err(err) => { let err = GitBackendError::FailedCreatingRepository(err); @@ -270,7 +270,7 @@ impl RepositoryBackend for GitBackend { } // ??? - Ok(CreateRepositoryResponse::Failed) + Ok(RepositoryCreateResponse::Failed) //Err(Box::new(err)) } } diff --git a/src/backend/mod.rs b/src/backend/mod.rs index dd6efae..c676a0c 100644 --- a/src/backend/mod.rs +++ b/src/backend/mod.rs @@ -13,7 +13,7 @@ use crate::{ RegisterAccountResponse, }, repository::{ - CreateRepositoryRequest, CreateRepositoryResponse, RepositoryFileInspectRequest, + RepositoryCreateRequest, RepositoryCreateResponse, RepositoryFileInspectRequest, RepositoryFileInspectionResponse, RepositoryInfoRequest, RepositoryIssueLabelsRequest, RepositoryIssueLabelsResponse, RepositoryIssuesCountRequest, RepositoryIssuesCountResponse, RepositoryIssuesRequest, RepositoryIssuesResponse, @@ -34,8 +34,8 @@ pub trait RepositoryBackend: IssuesBackend { async fn create_repository( &mut self, user: &User, - request: &CreateRepositoryRequest, - ) -> Result; + request: &RepositoryCreateRequest, + ) -> Result; async fn repository_info( &mut self, requester: Option<&User>, diff --git a/src/connection/repository.rs b/src/connection/repository.rs index 7f4b30f..12506fe 100644 --- a/src/connection/repository.rs +++ b/src/connection/repository.rs @@ -2,7 +2,7 @@ use anyhow::Error; use crate::{ messages::repository::{ - CreateRepositoryRequest, RepositoryFileInspectRequest, RepositoryInfoRequest, + RepositoryCreateRequest, RepositoryFileInspectRequest, RepositoryInfoRequest, RepositoryIssueLabelsRequest, RepositoryIssuesCountRequest, RepositoryIssuesRequest, }, model::authenticated::{AuthenticatedUser, Message, MessageHandler, NetworkMessage, State}, @@ -44,7 +44,7 @@ pub async fn repository_handle( } async fn create_repository( - Message(request): Message, + Message(request): Message, State(connection_state): State, AuthenticatedUser(user): AuthenticatedUser, ) -> Result<(), RepositoryError> { diff --git a/src/messages/repository.rs b/src/messages/repository.rs index 82fd3bc..2d1ae60 100644 --- a/src/messages/repository.rs +++ b/src/messages/repository.rs @@ -20,7 +20,7 @@ use crate::model::{ /// - User Authorization /// - Potential User permissions checks #[derive(Clone, Serialize, Deserialize)] -pub struct CreateRepositoryRequest { +pub struct RepositoryCreateRequest { pub name: String, pub description: Option, pub visibility: RepositoryVisibility, @@ -29,7 +29,7 @@ pub struct CreateRepositoryRequest { } #[derive(Clone, Serialize, Deserialize)] -pub enum CreateRepositoryResponse { +pub enum RepositoryCreateResponse { Created, Failed, }