feat: add repo importing
This commit is contained in:
19
api/src/endpoints/add_repo.rs
Normal file
19
api/src/endpoints/add_repo.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
use crate::{auth::User, error::Result, user::RepositorySchema};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::AppState;
|
||||
|
||||
#[derive(Serialize)]
|
||||
struct AddResponse {
|
||||
id: String,
|
||||
}
|
||||
|
||||
pub async fn add_repo(
|
||||
app_state: web::Data<AppState>,
|
||||
user: web::ReqData<User>,
|
||||
payload: web::Json<RepositorySchema>,
|
||||
) -> Result<HttpResponse> {
|
||||
let repo = payload.into_inner();
|
||||
app_state.user.add_repository(&user.id, repo).await
|
||||
}
|
||||
Reference in New Issue
Block a user