refactor(api): reorder imports and update code formatting across repository endpoints
- Reordered actix-web imports to standardize import order - Reordered crate module imports to follow alphabetical ordering - Updated function calls to use multi-line formatting for better readability - Standardized blank lines around documentation comments - Applied consistent formatting to response handling methods - Normalized import organization across all repository-related API files - Improved code consistency and maintainability through standardized formatting - Applied formatting updates to all repository endpoint implementations
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::ToSchema;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::models::repos::RepoInvitation;
|
||||
use crate::service::AppService;
|
||||
@@ -18,12 +18,12 @@ pub struct AcceptInvitationParams {
|
||||
///
|
||||
/// Accepts a pending repository invitation using the token received via email.
|
||||
/// Requires authentication and a verified email address matching the invitation.
|
||||
///
|
||||
///
|
||||
/// Effects:
|
||||
/// - User is added as a repository member with the invited role
|
||||
/// - User is added to the workspace if not already a member
|
||||
/// - Invitation is marked as accepted
|
||||
///
|
||||
///
|
||||
/// Returns the accepted invitation with full metadata.
|
||||
#[utoipa::path(
|
||||
post,
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::models::repos::RepoDeployKey;
|
||||
use crate::service::repo::deploy_keys::AddDeployKeyParams;
|
||||
use crate::service::AppService;
|
||||
use crate::service::repo::deploy_keys::AddDeployKeyParams;
|
||||
use crate::session::Session;
|
||||
|
||||
#[derive(Debug, Deserialize, IntoParams)]
|
||||
@@ -21,17 +21,17 @@ pub struct PathParams {
|
||||
///
|
||||
/// Adds an SSH public key for automated deployments and CI/CD access to the repository.
|
||||
/// Requires Admin role or higher in the repository.
|
||||
///
|
||||
///
|
||||
/// Parameters:
|
||||
/// - title: Human-readable name for the deploy key (1-100 characters)
|
||||
/// - key: SSH public key in OpenSSH format (e.g., "ssh-rsa AAAA...")
|
||||
/// - read_only: Whether the key has read-only access (default: true)
|
||||
///
|
||||
///
|
||||
/// Effects:
|
||||
/// - Deploy key is added to the repository
|
||||
/// - Key can be used for Git operations (clone, fetch, push if not read-only)
|
||||
/// - Key fingerprint is calculated and stored
|
||||
///
|
||||
///
|
||||
/// Returns the created deploy key with metadata including fingerprint.
|
||||
#[utoipa::path(
|
||||
post,
|
||||
@@ -65,7 +65,12 @@ pub async fn add_deploy_key(
|
||||
) -> Result<HttpResponse, AppError> {
|
||||
let key = service
|
||||
.repo
|
||||
.repo_add_deploy_key(&session, &path.workspace_name, &path.repo_name, params.into_inner())
|
||||
.repo_add_deploy_key(
|
||||
&session,
|
||||
&path.workspace_name,
|
||||
&path.repo_name,
|
||||
params.into_inner(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(HttpResponse::Created().json(ApiResponse::new(key)))
|
||||
|
||||
+11
-6
@@ -1,12 +1,12 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::models::repos::RepoMember;
|
||||
use crate::service::repo::members::AddRepoMemberParams;
|
||||
use crate::service::AppService;
|
||||
use crate::service::repo::members::AddRepoMemberParams;
|
||||
use crate::session::Session;
|
||||
|
||||
#[derive(Debug, Deserialize, IntoParams)]
|
||||
@@ -21,12 +21,12 @@ pub struct PathParams {
|
||||
///
|
||||
/// Grants a user access to the repository with a specific role.
|
||||
/// Requires Admin role or higher in the repository.
|
||||
///
|
||||
///
|
||||
/// Requirements:
|
||||
/// - User must exist in the system
|
||||
/// - User must be a member of the workspace
|
||||
/// - Role must be one of: "read", "write", "admin" (cannot assign "owner")
|
||||
///
|
||||
///
|
||||
/// Returns the created member record with user information and role.
|
||||
#[utoipa::path(
|
||||
post,
|
||||
@@ -60,7 +60,12 @@ pub async fn add_member(
|
||||
) -> Result<HttpResponse, AppError> {
|
||||
let member = service
|
||||
.repo
|
||||
.repo_add_member(&session, &path.workspace_name, &path.repo_name, params.into_inner())
|
||||
.repo_add_member(
|
||||
&session,
|
||||
&path.workspace_name,
|
||||
&path.repo_name,
|
||||
params.into_inner(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(HttpResponse::Created().json(ApiResponse::new(member)))
|
||||
|
||||
+4
-4
@@ -1,8 +1,8 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::service::AppService;
|
||||
use crate::session::Session;
|
||||
@@ -19,13 +19,13 @@ pub struct PathParams {
|
||||
///
|
||||
/// Marks a repository as archived, making it read-only. All write operations (push, create issues, etc.) are disabled.
|
||||
/// Requires Owner role in the repository.
|
||||
///
|
||||
///
|
||||
/// Effects:
|
||||
/// - Repository status changes to "archived"
|
||||
/// - All write operations are blocked
|
||||
/// - Repository remains visible based on its visibility setting
|
||||
/// - Can be unarchived later by repository owners
|
||||
///
|
||||
///
|
||||
/// Returns success message on completion.
|
||||
#[utoipa::path(
|
||||
post,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::service::repo::protection::BranchMergeCheck;
|
||||
use crate::service::AppService;
|
||||
use crate::service::repo::protection::BranchMergeCheck;
|
||||
use crate::session::Session;
|
||||
|
||||
#[derive(Debug, Deserialize, IntoParams)]
|
||||
|
||||
+6
-6
@@ -1,12 +1,12 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::models::repos::Repo;
|
||||
use crate::service::repo::core::CreateRepoParams;
|
||||
use crate::service::AppService;
|
||||
use crate::service::repo::core::CreateRepoParams;
|
||||
use crate::session::Session;
|
||||
|
||||
#[derive(Debug, Deserialize, IntoParams)]
|
||||
@@ -18,17 +18,17 @@ pub struct PathParams {
|
||||
/// Create a new repository
|
||||
///
|
||||
/// Creates a new Git repository within the specified workspace. The authenticated user becomes the repository owner.
|
||||
///
|
||||
///
|
||||
/// Requirements:
|
||||
/// - User must have at least Member role in the workspace
|
||||
/// - Repository name must be unique within the workspace
|
||||
/// - Name must be 1-100 characters, alphanumeric, hyphens, underscores, and dots allowed
|
||||
///
|
||||
///
|
||||
/// Optional parameters:
|
||||
/// - description: Repository description (max 500 characters)
|
||||
/// - visibility: "public", "private", or "internal" (defaults to workspace setting)
|
||||
/// - default_branch: Default branch name (defaults to "main")
|
||||
///
|
||||
///
|
||||
/// Returns the created repository with full metadata.
|
||||
#[utoipa::path(
|
||||
post,
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::models::repos::RepoBranch;
|
||||
use crate::service::repo::branches::CreateBranchParams;
|
||||
use crate::service::AppService;
|
||||
use crate::service::repo::branches::CreateBranchParams;
|
||||
use crate::session::Session;
|
||||
|
||||
#[derive(Debug, Deserialize, IntoParams)]
|
||||
@@ -21,11 +21,11 @@ pub struct PathParams {
|
||||
///
|
||||
/// Creates a new branch in the repository based on an existing commit or branch.
|
||||
/// Requires Write role or higher in the repository.
|
||||
///
|
||||
///
|
||||
/// Parameters:
|
||||
/// - name: Branch name (1-100 characters, alphanumeric, hyphens, underscores, dots, slashes allowed)
|
||||
/// - from: Source branch name or commit SHA to branch from (defaults to default branch)
|
||||
///
|
||||
///
|
||||
/// Returns the created branch with metadata including the initial commit SHA.
|
||||
#[utoipa::path(
|
||||
post,
|
||||
@@ -59,7 +59,12 @@ pub async fn create_branch(
|
||||
) -> Result<HttpResponse, AppError> {
|
||||
let branch = service
|
||||
.repo
|
||||
.repo_create_branch(&session, &path.workspace_name, &path.repo_name, params.into_inner())
|
||||
.repo_create_branch(
|
||||
&session,
|
||||
&path.workspace_name,
|
||||
&path.repo_name,
|
||||
params.into_inner(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(HttpResponse::Created().json(ApiResponse::new(branch)))
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::models::repos::RepoCommitComment;
|
||||
use crate::service::repo::commit_status::CreateCommitCommentParams;
|
||||
use crate::service::AppService;
|
||||
use crate::service::repo::commit_status::CreateCommitCommentParams;
|
||||
use crate::session::Session;
|
||||
|
||||
#[derive(Debug, Deserialize, IntoParams)]
|
||||
@@ -21,18 +21,18 @@ pub struct PathParams {
|
||||
///
|
||||
/// Creates a new comment on a specific commit. Comments can be general or inline (attached to a specific file and line).
|
||||
/// Requires Write role or higher in the repository.
|
||||
///
|
||||
///
|
||||
/// Parameters:
|
||||
/// - commit_sha: Commit SHA to comment on (must exist in repository)
|
||||
/// - body: Comment body in markdown format (1-10000 characters)
|
||||
/// - path: File path for inline comments (optional)
|
||||
/// - line: Line number for inline comments (optional, requires path)
|
||||
///
|
||||
///
|
||||
/// Effects:
|
||||
/// - Comment is attached to the commit
|
||||
/// - Comment author receives notifications for replies
|
||||
/// - Inline comments appear in code review interfaces
|
||||
///
|
||||
///
|
||||
/// Returns the created comment with metadata including ID and timestamps.
|
||||
#[utoipa::path(
|
||||
post,
|
||||
@@ -65,7 +65,12 @@ pub async fn create_commit_comment(
|
||||
) -> Result<HttpResponse, AppError> {
|
||||
let comment = service
|
||||
.repo
|
||||
.repo_create_commit_comment(&session, &path.workspace_name, &path.repo_name, params.into_inner())
|
||||
.repo_create_commit_comment(
|
||||
&session,
|
||||
&path.workspace_name,
|
||||
&path.repo_name,
|
||||
params.into_inner(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(HttpResponse::Created().json(ApiResponse::new(comment)))
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::models::repos::RepoCommitStatus;
|
||||
use crate::service::repo::commit_status::CreateCommitStatusParams;
|
||||
use crate::service::AppService;
|
||||
use crate::service::repo::commit_status::CreateCommitStatusParams;
|
||||
use crate::session::Session;
|
||||
|
||||
#[derive(Debug, Deserialize, IntoParams)]
|
||||
@@ -21,19 +21,19 @@ pub struct PathParams {
|
||||
///
|
||||
/// Creates a new status check for a specific commit, typically used by CI/CD systems.
|
||||
/// Requires Write role or higher in the repository.
|
||||
///
|
||||
///
|
||||
/// Parameters:
|
||||
/// - commit_sha: Commit SHA to attach the status to (must exist in repository)
|
||||
/// - state: Status state ("pending", "success", "failure", "error")
|
||||
/// - context: Status context name (e.g., "ci/build", "ci/test") - must be unique per commit
|
||||
/// - description: Human-readable description of the status (optional, max 500 characters)
|
||||
/// - target_url: URL with detailed information about the status (optional)
|
||||
///
|
||||
///
|
||||
/// Effects:
|
||||
/// - Status is attached to the commit
|
||||
/// - Can be used by branch protection rules to enforce status checks
|
||||
/// - Multiple statuses can exist for the same commit with different contexts
|
||||
///
|
||||
///
|
||||
/// Returns the created status with metadata including ID and timestamps.
|
||||
#[utoipa::path(
|
||||
post,
|
||||
@@ -67,7 +67,12 @@ pub async fn create_commit_status(
|
||||
) -> Result<HttpResponse, AppError> {
|
||||
let status = service
|
||||
.repo
|
||||
.repo_create_commit_status(&session, &path.workspace_name, &path.repo_name, params.into_inner())
|
||||
.repo_create_commit_status(
|
||||
&session,
|
||||
&path.workspace_name,
|
||||
&path.repo_name,
|
||||
params.into_inner(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(HttpResponse::Created().json(ApiResponse::new(status)))
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::models::repos::RepoInvitation;
|
||||
use crate::service::repo::invitations::CreateRepoInvitationParams;
|
||||
use crate::service::AppService;
|
||||
use crate::service::repo::invitations::CreateRepoInvitationParams;
|
||||
use crate::session::Session;
|
||||
|
||||
#[derive(Debug, Deserialize, IntoParams)]
|
||||
@@ -21,16 +21,16 @@ pub struct PathParams {
|
||||
///
|
||||
/// Sends an invitation email to a user to join the repository with a specific role.
|
||||
/// Requires Admin role or higher in the repository.
|
||||
///
|
||||
///
|
||||
/// Parameters:
|
||||
/// - email: Email address of the invitee (must be a valid email)
|
||||
/// - role: Role to assign when invitation is accepted ("read", "write", "admin")
|
||||
///
|
||||
///
|
||||
/// Effects:
|
||||
/// - Invitation email is sent to the invitee
|
||||
/// - Invitation expires after 7 days
|
||||
/// - Invitee must have a verified email to accept
|
||||
///
|
||||
///
|
||||
/// Returns the created invitation with metadata including expiration date.
|
||||
#[utoipa::path(
|
||||
post,
|
||||
@@ -64,7 +64,12 @@ pub async fn create_invitation(
|
||||
) -> Result<HttpResponse, AppError> {
|
||||
let invitation = service
|
||||
.repo
|
||||
.repo_create_invitation(&session, &path.workspace_name, &path.repo_name, params.into_inner())
|
||||
.repo_create_invitation(
|
||||
&session,
|
||||
&path.workspace_name,
|
||||
&path.repo_name,
|
||||
params.into_inner(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(HttpResponse::Created().json(ApiResponse::new(invitation)))
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::models::repos::BranchProtectionRule;
|
||||
use crate::service::repo::protection::CreateProtectionRuleParams;
|
||||
use crate::service::AppService;
|
||||
use crate::service::repo::protection::CreateProtectionRuleParams;
|
||||
use crate::session::Session;
|
||||
|
||||
#[derive(Debug, Deserialize, IntoParams)]
|
||||
@@ -21,7 +21,7 @@ pub struct PathParams {
|
||||
///
|
||||
/// Creates a new branch protection rule that enforces policies on matching branches.
|
||||
/// Requires Admin role or higher in the repository.
|
||||
///
|
||||
///
|
||||
/// Parameters:
|
||||
/// - pattern: Branch name pattern (supports wildcards like "feature/*", "release/**")
|
||||
/// - required_approvals: Number of required approvals before merging (0-10)
|
||||
@@ -30,7 +30,7 @@ pub struct PathParams {
|
||||
/// - restrict_pushes: Restrict who can push to matching branches
|
||||
/// - allow_force_pushes: Allow force pushes (only if restrict_pushes is false)
|
||||
/// - allow_deletions: Allow branch deletion (only if restrict_pushes is false)
|
||||
///
|
||||
///
|
||||
/// Returns the created protection rule with full configuration.
|
||||
#[utoipa::path(
|
||||
post,
|
||||
@@ -64,7 +64,12 @@ pub async fn create_protection_rule(
|
||||
) -> Result<HttpResponse, AppError> {
|
||||
let rule = service
|
||||
.repo
|
||||
.repo_create_protection_rule(&session, &path.workspace_name, &path.repo_name, params.into_inner())
|
||||
.repo_create_protection_rule(
|
||||
&session,
|
||||
&path.workspace_name,
|
||||
&path.repo_name,
|
||||
params.into_inner(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(HttpResponse::Created().json(ApiResponse::new(rule)))
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::models::repos::RepoRelease;
|
||||
use crate::service::repo::releases::CreateReleaseParams;
|
||||
use crate::service::AppService;
|
||||
use crate::service::repo::releases::CreateReleaseParams;
|
||||
use crate::session::Session;
|
||||
|
||||
#[derive(Debug, Deserialize, IntoParams)]
|
||||
@@ -21,7 +21,7 @@ pub struct PathParams {
|
||||
///
|
||||
/// Creates a new release in the repository, optionally creating a tag if it doesn't exist.
|
||||
/// Requires Write role or higher in the repository.
|
||||
///
|
||||
///
|
||||
/// Parameters:
|
||||
/// - tag_name: Tag name for the release (will be created if it doesn't exist)
|
||||
/// - name: Release name/title (required)
|
||||
@@ -29,7 +29,7 @@ pub struct PathParams {
|
||||
/// - draft: Whether this is a draft release (default: false)
|
||||
/// - prerelease: Whether this is a prerelease (default: false)
|
||||
/// - target_commitish: Commit SHA or branch name to tag (defaults to default branch)
|
||||
///
|
||||
///
|
||||
/// Returns the created release with metadata including download URLs for assets.
|
||||
#[utoipa::path(
|
||||
post,
|
||||
@@ -63,7 +63,12 @@ pub async fn create_release(
|
||||
) -> Result<HttpResponse, AppError> {
|
||||
let release = service
|
||||
.repo
|
||||
.repo_create_release(&session, &path.workspace_name, &path.repo_name, params.into_inner())
|
||||
.repo_create_release(
|
||||
&session,
|
||||
&path.workspace_name,
|
||||
&path.repo_name,
|
||||
params.into_inner(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(HttpResponse::Created().json(ApiResponse::new(release)))
|
||||
|
||||
+11
-6
@@ -1,12 +1,12 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::models::repos::RepoTag;
|
||||
use crate::service::repo::tags::CreateTagParams;
|
||||
use crate::service::AppService;
|
||||
use crate::service::repo::tags::CreateTagParams;
|
||||
use crate::session::Session;
|
||||
|
||||
#[derive(Debug, Deserialize, IntoParams)]
|
||||
@@ -21,12 +21,12 @@ pub struct PathParams {
|
||||
///
|
||||
/// Creates a new tag in the repository pointing to a specific commit or branch.
|
||||
/// Requires Write role or higher in the repository.
|
||||
///
|
||||
///
|
||||
/// Parameters:
|
||||
/// - name: Tag name (1-100 characters, typically follows semantic versioning like v1.0.0)
|
||||
/// - target: Commit SHA or branch name to tag (defaults to HEAD of default branch)
|
||||
/// - message: Optional tag message for annotated tags
|
||||
///
|
||||
///
|
||||
/// Returns the created tag with metadata including the commit SHA.
|
||||
#[utoipa::path(
|
||||
post,
|
||||
@@ -60,7 +60,12 @@ pub async fn create_tag(
|
||||
) -> Result<HttpResponse, AppError> {
|
||||
let tag = service
|
||||
.repo
|
||||
.repo_create_tag(&session, &path.workspace_name, &path.repo_name, params.into_inner())
|
||||
.repo_create_tag(
|
||||
&session,
|
||||
&path.workspace_name,
|
||||
&path.repo_name,
|
||||
params.into_inner(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(HttpResponse::Created().json(ApiResponse::new(tag)))
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::models::repos::RepoWebhook;
|
||||
use crate::service::repo::webhooks::CreateWebhookParams;
|
||||
use crate::service::AppService;
|
||||
use crate::service::repo::webhooks::CreateWebhookParams;
|
||||
use crate::session::Session;
|
||||
|
||||
#[derive(Debug, Deserialize, IntoParams)]
|
||||
@@ -21,17 +21,17 @@ pub struct PathParams {
|
||||
///
|
||||
/// Creates a new webhook that receives HTTP POST notifications for repository events.
|
||||
/// Requires Admin role or higher in the repository.
|
||||
///
|
||||
///
|
||||
/// Parameters:
|
||||
/// - url: Webhook endpoint URL (must be HTTPS in production)
|
||||
/// - events: List of events to subscribe to (e.g., "push", "pull_request", "issue")
|
||||
/// - secret: Optional secret for webhook signature verification
|
||||
/// - active: Whether the webhook is active (default: true)
|
||||
///
|
||||
///
|
||||
/// Effects:
|
||||
/// - Webhook is created and starts receiving events
|
||||
/// - Webhook deliveries are logged and can be retried on failure
|
||||
///
|
||||
///
|
||||
/// Returns the created webhook with metadata including ID and configuration.
|
||||
#[utoipa::path(
|
||||
post,
|
||||
@@ -64,7 +64,12 @@ pub async fn create_webhook(
|
||||
) -> Result<HttpResponse, AppError> {
|
||||
let webhook = service
|
||||
.repo
|
||||
.repo_create_webhook(&session, &path.workspace_name, &path.repo_name, params.into_inner())
|
||||
.repo_create_webhook(
|
||||
&session,
|
||||
&path.workspace_name,
|
||||
&path.repo_name,
|
||||
params.into_inner(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(HttpResponse::Created().json(ApiResponse::new(webhook)))
|
||||
|
||||
+4
-4
@@ -1,8 +1,8 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::service::AppService;
|
||||
use crate::session::Session;
|
||||
@@ -23,9 +23,9 @@ pub struct PathParams {
|
||||
/// - Issues, pull requests, and comments
|
||||
/// - Webhooks, deploy keys, and protection rules
|
||||
/// - Stars, watches, and forks
|
||||
///
|
||||
///
|
||||
/// Requires Owner role in the repository. This action is irreversible.
|
||||
///
|
||||
///
|
||||
/// Returns success message on completion.
|
||||
#[utoipa::path(
|
||||
delete,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::service::AppService;
|
||||
use crate::session::Session;
|
||||
@@ -21,12 +21,12 @@ pub struct PathParams {
|
||||
///
|
||||
/// Permanently deletes a branch from the repository. The default branch cannot be deleted.
|
||||
/// Requires Write role or higher in the repository.
|
||||
///
|
||||
///
|
||||
/// Effects:
|
||||
/// - Branch is permanently removed from the repository
|
||||
/// - All commits exclusive to this branch remain accessible via their SHA
|
||||
/// - Open pull requests targeting this branch will be closed
|
||||
///
|
||||
///
|
||||
/// Returns success message on completion.
|
||||
#[utoipa::path(
|
||||
delete,
|
||||
@@ -53,7 +53,12 @@ pub async fn delete_branch(
|
||||
) -> Result<HttpResponse, AppError> {
|
||||
service
|
||||
.repo
|
||||
.repo_delete_branch(&session, &path.workspace_name, &path.repo_name, path.branch_id)
|
||||
.repo_delete_branch(
|
||||
&session,
|
||||
&path.workspace_name,
|
||||
&path.repo_name,
|
||||
path.branch_id,
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(HttpResponse::Ok().json(ApiResponse::new("Branch deleted successfully".to_string())))
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::service::AppService;
|
||||
use crate::session::Session;
|
||||
@@ -21,12 +21,12 @@ pub struct PathParams {
|
||||
///
|
||||
/// Removes an SSH deploy key from the repository, revoking its access.
|
||||
/// Requires Admin role or higher in the repository.
|
||||
///
|
||||
///
|
||||
/// Effects:
|
||||
/// - Deploy key is permanently removed from the repository
|
||||
/// - Key can no longer be used for Git operations
|
||||
/// - Automated systems using this key will lose access
|
||||
///
|
||||
///
|
||||
/// Returns success message on completion.
|
||||
#[utoipa::path(
|
||||
delete,
|
||||
@@ -55,5 +55,7 @@ pub async fn delete_deploy_key(
|
||||
.repo_delete_deploy_key(&session, &path.workspace_name, &path.repo_name, path.key_id)
|
||||
.await?;
|
||||
|
||||
Ok(HttpResponse::Ok().json(ApiResponse::new("Deploy key deleted successfully".to_string())))
|
||||
Ok(HttpResponse::Ok().json(ApiResponse::new(
|
||||
"Deploy key deleted successfully".to_string(),
|
||||
)))
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::service::AppService;
|
||||
use crate::session::Session;
|
||||
@@ -21,12 +21,12 @@ pub struct PathParams {
|
||||
///
|
||||
/// Permanently removes a branch protection rule from the repository.
|
||||
/// Requires Admin role or higher in the repository.
|
||||
///
|
||||
///
|
||||
/// Effects:
|
||||
/// - Protection rule is permanently removed
|
||||
/// - Branches matching the pattern are no longer protected by this rule
|
||||
/// - Pushes and merges to matching branches are no longer restricted
|
||||
///
|
||||
///
|
||||
/// Returns success message on completion.
|
||||
#[utoipa::path(
|
||||
delete,
|
||||
@@ -52,8 +52,15 @@ pub async fn delete_protection_rule(
|
||||
) -> Result<HttpResponse, AppError> {
|
||||
service
|
||||
.repo
|
||||
.repo_delete_protection_rule(&session, &path.workspace_name, &path.repo_name, path.rule_id)
|
||||
.repo_delete_protection_rule(
|
||||
&session,
|
||||
&path.workspace_name,
|
||||
&path.repo_name,
|
||||
path.rule_id,
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(HttpResponse::Ok().json(ApiResponse::new("Protection rule deleted successfully".to_string())))
|
||||
Ok(HttpResponse::Ok().json(ApiResponse::new(
|
||||
"Protection rule deleted successfully".to_string(),
|
||||
)))
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::service::AppService;
|
||||
use crate::session::Session;
|
||||
@@ -21,13 +21,13 @@ pub struct PathParams {
|
||||
///
|
||||
/// Permanently deletes a release from the repository. The associated tag and commits are not deleted.
|
||||
/// Requires Write role or higher in the repository.
|
||||
///
|
||||
///
|
||||
/// Effects:
|
||||
/// - Release metadata is permanently removed
|
||||
/// - Release assets are deleted
|
||||
/// - The associated tag remains in the repository
|
||||
/// - The tagged commits remain in the repository history
|
||||
///
|
||||
///
|
||||
/// Returns success message on completion.
|
||||
#[utoipa::path(
|
||||
delete,
|
||||
@@ -53,7 +53,12 @@ pub async fn delete_release(
|
||||
) -> Result<HttpResponse, AppError> {
|
||||
service
|
||||
.repo
|
||||
.repo_delete_release(&session, &path.workspace_name, &path.repo_name, path.release_id)
|
||||
.repo_delete_release(
|
||||
&session,
|
||||
&path.workspace_name,
|
||||
&path.repo_name,
|
||||
path.release_id,
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(HttpResponse::Ok().json(ApiResponse::new("Release deleted successfully".to_string())))
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::service::AppService;
|
||||
use crate::session::Session;
|
||||
@@ -21,12 +21,12 @@ pub struct PathParams {
|
||||
///
|
||||
/// Permanently deletes a tag from the repository. The tagged commit remains accessible via its SHA.
|
||||
/// Requires Write role or higher in the repository.
|
||||
///
|
||||
///
|
||||
/// Effects:
|
||||
/// - Tag is permanently removed from the repository
|
||||
/// - The tagged commit remains in the repository history
|
||||
/// - Releases associated with this tag are not automatically deleted
|
||||
///
|
||||
///
|
||||
/// Returns success message on completion.
|
||||
#[utoipa::path(
|
||||
delete,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::service::AppService;
|
||||
use crate::session::Session;
|
||||
@@ -21,12 +21,12 @@ pub struct PathParams {
|
||||
///
|
||||
/// Permanently removes a webhook from the repository, stopping all event notifications.
|
||||
/// Requires Admin role or higher in the repository.
|
||||
///
|
||||
///
|
||||
/// Effects:
|
||||
/// - Webhook is permanently removed from the repository
|
||||
/// - Webhook stops receiving event notifications immediately
|
||||
/// - Webhook delivery history is deleted
|
||||
///
|
||||
///
|
||||
/// Returns success message on completion.
|
||||
#[utoipa::path(
|
||||
delete,
|
||||
@@ -52,7 +52,12 @@ pub async fn delete_webhook(
|
||||
) -> Result<HttpResponse, AppError> {
|
||||
service
|
||||
.repo
|
||||
.repo_delete_webhook(&session, &path.workspace_name, &path.repo_name, path.webhook_id)
|
||||
.repo_delete_webhook(
|
||||
&session,
|
||||
&path.workspace_name,
|
||||
&path.repo_name,
|
||||
path.webhook_id,
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(HttpResponse::Ok().json(ApiResponse::new("Webhook deleted successfully".to_string())))
|
||||
|
||||
+10
-5
@@ -1,8 +1,8 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::models::repos::Repo;
|
||||
use crate::service::AppService;
|
||||
@@ -22,13 +22,13 @@ use crate::service::repo::fork::ForkRepoParams;
|
||||
///
|
||||
/// Creates a copy of the repository in the specified workspace or the current user's workspace.
|
||||
/// Requires read access to the source repository and write access to the target workspace.
|
||||
///
|
||||
///
|
||||
/// Effects:
|
||||
/// - Creates a new repository with all branches, tags, and commit history
|
||||
/// - Establishes a parent-child relationship between source and fork
|
||||
/// - Fork is initially set to private visibility
|
||||
/// - Current user becomes the owner of the fork
|
||||
///
|
||||
///
|
||||
/// Returns the created fork repository with full metadata.
|
||||
#[utoipa::path(
|
||||
post,
|
||||
@@ -62,7 +62,12 @@ pub async fn fork_repo(
|
||||
) -> Result<HttpResponse, AppError> {
|
||||
let repo = service
|
||||
.repo
|
||||
.repo_fork(&session, &path.workspace_name, &path.repo_name, params.into_inner())
|
||||
.repo_fork(
|
||||
&session,
|
||||
&path.workspace_name,
|
||||
&path.repo_name,
|
||||
params.into_inner(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(HttpResponse::Created().json(ApiResponse::new(repo)))
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::models::repos::Repo;
|
||||
use crate::service::AppService;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::models::repos::BranchProtectionRule;
|
||||
use crate::service::AppService;
|
||||
@@ -22,7 +22,7 @@ pub struct PathParams {
|
||||
///
|
||||
/// Returns detailed information about a specific branch protection rule.
|
||||
/// Requires read access to the repository.
|
||||
///
|
||||
///
|
||||
/// Returns the complete protection rule with all configuration details including:
|
||||
/// - Branch name pattern
|
||||
/// - Required approvals and status checks
|
||||
@@ -52,7 +52,12 @@ pub async fn get_protection_rule(
|
||||
) -> Result<HttpResponse, AppError> {
|
||||
let rule = service
|
||||
.repo
|
||||
.repo_get_protection_rule(&session, &path.workspace_name, &path.repo_name, path.rule_id)
|
||||
.repo_get_protection_rule(
|
||||
&session,
|
||||
&path.workspace_name,
|
||||
&path.repo_name,
|
||||
path.rule_id,
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(HttpResponse::Ok().json(ApiResponse::new(rule)))
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::models::repos::RepoStats;
|
||||
use crate::service::AppService;
|
||||
@@ -27,7 +27,7 @@ pub struct PathParams {
|
||||
/// - Open issues and pull requests count
|
||||
/// - Storage size and bandwidth usage
|
||||
/// - Last push timestamp
|
||||
///
|
||||
///
|
||||
/// Requires read access to the repository.
|
||||
#[utoipa::path(
|
||||
get,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::service::AppService;
|
||||
use crate::session::Session;
|
||||
@@ -19,14 +19,14 @@ pub struct PathParams {
|
||||
///
|
||||
/// Removes the current user's access to the repository.
|
||||
/// Requires the user to be a member of the repository.
|
||||
///
|
||||
///
|
||||
/// Restrictions:
|
||||
/// - Repository owner cannot leave (use transfer_owner instead)
|
||||
///
|
||||
///
|
||||
/// Effects:
|
||||
/// - User loses all access to the repository
|
||||
/// - User is removed from all repository activities
|
||||
///
|
||||
///
|
||||
/// Returns success message on completion.
|
||||
#[utoipa::path(
|
||||
post,
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::models::repos::Repo;
|
||||
use crate::service::AppService;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::models::repos::RepoBranch;
|
||||
use crate::service::AppService;
|
||||
@@ -32,7 +32,7 @@ pub struct QueryParams {
|
||||
/// - Protected status
|
||||
/// - Default branch flag
|
||||
/// - Last push information
|
||||
///
|
||||
///
|
||||
/// Requires read access to the repository.
|
||||
#[utoipa::path(
|
||||
get,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::models::repos::RepoCommitComment;
|
||||
use crate::service::AppService;
|
||||
@@ -35,7 +35,7 @@ pub struct QueryParams {
|
||||
/// - File path and line number (for inline comments)
|
||||
/// - Resolved status
|
||||
/// - Creation and update timestamps
|
||||
///
|
||||
///
|
||||
/// Requires read access to the repository.
|
||||
#[utoipa::path(
|
||||
get,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::models::repos::RepoCommitStatus;
|
||||
use crate::service::AppService;
|
||||
@@ -34,7 +34,7 @@ pub struct QueryParams {
|
||||
/// - Context name (e.g., "ci/build", "ci/test")
|
||||
/// - Description and target URL
|
||||
/// - Creator information
|
||||
///
|
||||
///
|
||||
/// Requires read access to the repository.
|
||||
#[utoipa::path(
|
||||
get,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::models::repos::RepoDeployKey;
|
||||
use crate::service::AppService;
|
||||
@@ -32,7 +32,7 @@ pub struct QueryParams {
|
||||
/// - Read-only status
|
||||
/// - Creator information
|
||||
/// - Creation date and last used date
|
||||
///
|
||||
///
|
||||
/// Requires Admin role or higher in the repository.
|
||||
#[utoipa::path(
|
||||
get,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::models::repos::RepoFork;
|
||||
use crate::service::AppService;
|
||||
@@ -31,7 +31,7 @@ pub struct QueryParams {
|
||||
/// - Fork repository information
|
||||
/// - Fork owner and workspace
|
||||
/// - Fork creation date
|
||||
///
|
||||
///
|
||||
/// Requires read access to the repository.
|
||||
#[utoipa::path(
|
||||
get,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::models::repos::RepoInvitation;
|
||||
use crate::service::AppService;
|
||||
@@ -33,7 +33,7 @@ pub struct QueryParams {
|
||||
/// - Inviter information
|
||||
/// - Expiration date
|
||||
/// - Creation date
|
||||
///
|
||||
///
|
||||
/// Requires Admin role or higher in the repository.
|
||||
#[utoipa::path(
|
||||
get,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::models::repos::RepoMember;
|
||||
use crate::service::AppService;
|
||||
@@ -31,7 +31,7 @@ pub struct QueryParams {
|
||||
/// - User information (ID, username, display name)
|
||||
/// - Role (owner, admin, write, read)
|
||||
/// - Join date and last activity
|
||||
///
|
||||
///
|
||||
/// Requires read access to the repository.
|
||||
#[utoipa::path(
|
||||
get,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::models::repos::BranchProtectionRule;
|
||||
use crate::service::AppService;
|
||||
@@ -33,7 +33,7 @@ pub struct QueryParams {
|
||||
/// - Required status checks
|
||||
/// - Restrictions on pushes and deletions
|
||||
/// - Creator information
|
||||
///
|
||||
///
|
||||
/// Requires read access to the repository.
|
||||
#[utoipa::path(
|
||||
get,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::models::repos::RepoRelease;
|
||||
use crate::service::AppService;
|
||||
@@ -33,7 +33,7 @@ pub struct QueryParams {
|
||||
/// - Author and creation date
|
||||
/// - Draft and prerelease status
|
||||
/// - Asset download URLs
|
||||
///
|
||||
///
|
||||
/// Requires read access to the repository.
|
||||
#[utoipa::path(
|
||||
get,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::models::repos::RepoStar;
|
||||
use crate::service::AppService;
|
||||
@@ -30,7 +30,7 @@ pub struct QueryParams {
|
||||
/// Includes stargazer metadata such as:
|
||||
/// - User information (ID, username, display name)
|
||||
/// - Star timestamp
|
||||
///
|
||||
///
|
||||
/// Requires read access to the repository.
|
||||
#[utoipa::path(
|
||||
get,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::models::repos::RepoTag;
|
||||
use crate::service::AppService;
|
||||
@@ -31,7 +31,7 @@ pub struct QueryParams {
|
||||
/// - Tag name and commit SHA
|
||||
/// - Tagger information and timestamp
|
||||
/// - Tag message (for annotated tags)
|
||||
///
|
||||
///
|
||||
/// Requires read access to the repository.
|
||||
#[utoipa::path(
|
||||
get,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::models::repos::RepoWatch;
|
||||
use crate::service::AppService;
|
||||
@@ -31,7 +31,7 @@ pub struct QueryParams {
|
||||
/// - User information (ID, username, display name)
|
||||
/// - Watch level (participating, watching, or ignoring)
|
||||
/// - Watch timestamp
|
||||
///
|
||||
///
|
||||
/// Requires read access to the repository.
|
||||
#[utoipa::path(
|
||||
get,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::models::repos::RepoWebhook;
|
||||
use crate::service::AppService;
|
||||
@@ -32,7 +32,7 @@ pub struct QueryParams {
|
||||
/// - Active status
|
||||
/// - Last delivery status and timestamp
|
||||
/// - Creator information
|
||||
///
|
||||
///
|
||||
/// Requires Admin role or higher in the repository.
|
||||
#[utoipa::path(
|
||||
get,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::models::repos::BranchProtectionRule;
|
||||
use crate::service::AppService;
|
||||
@@ -26,7 +26,7 @@ pub struct QueryParams {
|
||||
///
|
||||
/// Checks if a branch name matches any protection rule in the repository.
|
||||
/// Requires read access to the repository.
|
||||
///
|
||||
///
|
||||
/// Returns the matching protection rule if found, or null if no rules match.
|
||||
/// Useful for determining what protections apply to a specific branch before performing operations.
|
||||
#[utoipa::path(
|
||||
|
||||
+121
-70
@@ -1,64 +1,64 @@
|
||||
use actix_web::web;
|
||||
|
||||
pub mod list;
|
||||
pub mod get;
|
||||
pub mod create;
|
||||
pub mod update;
|
||||
pub mod archive;
|
||||
pub mod unarchive;
|
||||
pub mod delete;
|
||||
pub mod transfer_owner;
|
||||
pub mod list_branches;
|
||||
pub mod create_branch;
|
||||
pub mod set_default_branch;
|
||||
pub mod set_branch_protection;
|
||||
pub mod delete_branch;
|
||||
pub mod list_tags;
|
||||
pub mod create_tag;
|
||||
pub mod delete_tag;
|
||||
pub mod list_releases;
|
||||
pub mod create_release;
|
||||
pub mod update_release;
|
||||
pub mod delete_release;
|
||||
pub mod list_forks;
|
||||
pub mod fork_repo;
|
||||
pub mod sync_fork;
|
||||
pub mod star_repo;
|
||||
pub mod unstar_repo;
|
||||
pub mod list_stargazers;
|
||||
pub mod watch_repo;
|
||||
pub mod unwatch_repo;
|
||||
pub mod list_watchers;
|
||||
pub mod list_members;
|
||||
pub mod add_member;
|
||||
pub mod update_member_role;
|
||||
pub mod remove_member;
|
||||
pub mod leave_repo;
|
||||
pub mod list_invitations;
|
||||
pub mod create_invitation;
|
||||
pub mod revoke_invitation;
|
||||
pub mod accept_invitation;
|
||||
pub mod list_deploy_keys;
|
||||
pub mod add_deploy_key;
|
||||
pub mod delete_deploy_key;
|
||||
pub mod list_webhooks;
|
||||
pub mod create_webhook;
|
||||
pub mod update_webhook;
|
||||
pub mod delete_webhook;
|
||||
pub mod list_protection_rules;
|
||||
pub mod get_protection_rule;
|
||||
pub mod match_protection;
|
||||
pub mod create_protection_rule;
|
||||
pub mod update_protection_rule;
|
||||
pub mod delete_protection_rule;
|
||||
pub mod add_member;
|
||||
pub mod archive;
|
||||
pub mod check_branch_merge;
|
||||
pub mod list_commit_statuses;
|
||||
pub mod create_commit_status;
|
||||
pub mod list_commit_comments;
|
||||
pub mod create;
|
||||
pub mod create_branch;
|
||||
pub mod create_commit_comment;
|
||||
pub mod resolve_commit_comment;
|
||||
pub mod create_commit_status;
|
||||
pub mod create_invitation;
|
||||
pub mod create_protection_rule;
|
||||
pub mod create_release;
|
||||
pub mod create_tag;
|
||||
pub mod create_webhook;
|
||||
pub mod delete;
|
||||
pub mod delete_branch;
|
||||
pub mod delete_deploy_key;
|
||||
pub mod delete_protection_rule;
|
||||
pub mod delete_release;
|
||||
pub mod delete_tag;
|
||||
pub mod delete_webhook;
|
||||
pub mod fork_repo;
|
||||
pub mod get;
|
||||
pub mod get_protection_rule;
|
||||
pub mod get_stats;
|
||||
pub mod leave_repo;
|
||||
pub mod list;
|
||||
pub mod list_branches;
|
||||
pub mod list_commit_comments;
|
||||
pub mod list_commit_statuses;
|
||||
pub mod list_deploy_keys;
|
||||
pub mod list_forks;
|
||||
pub mod list_invitations;
|
||||
pub mod list_members;
|
||||
pub mod list_protection_rules;
|
||||
pub mod list_releases;
|
||||
pub mod list_stargazers;
|
||||
pub mod list_tags;
|
||||
pub mod list_watchers;
|
||||
pub mod list_webhooks;
|
||||
pub mod match_protection;
|
||||
pub mod refresh_stats;
|
||||
pub mod remove_member;
|
||||
pub mod resolve_commit_comment;
|
||||
pub mod revoke_invitation;
|
||||
pub mod set_branch_protection;
|
||||
pub mod set_default_branch;
|
||||
pub mod star_repo;
|
||||
pub mod sync_fork;
|
||||
pub mod transfer_owner;
|
||||
pub mod unarchive;
|
||||
pub mod unstar_repo;
|
||||
pub mod unwatch_repo;
|
||||
pub mod update;
|
||||
pub mod update_member_role;
|
||||
pub mod update_protection_rule;
|
||||
pub mod update_release;
|
||||
pub mod update_webhook;
|
||||
pub mod watch_repo;
|
||||
|
||||
pub fn configure(cfg: &mut web::ServiceConfig) {
|
||||
cfg.service(
|
||||
@@ -69,13 +69,22 @@ pub fn configure(cfg: &mut web::ServiceConfig) {
|
||||
.route("/{repo_name}", web::put().to(update::update))
|
||||
.route("/{repo_name}", web::delete().to(delete::delete))
|
||||
.route("/{repo_name}/archive", web::post().to(archive::archive))
|
||||
.route("/{repo_name}/unarchive", web::post().to(unarchive::unarchive))
|
||||
.route(
|
||||
"/{repo_name}/unarchive",
|
||||
web::post().to(unarchive::unarchive),
|
||||
)
|
||||
.route(
|
||||
"/{repo_name}/transfer-owner",
|
||||
web::post().to(transfer_owner::transfer_owner),
|
||||
)
|
||||
.route("/{repo_name}/branches", web::get().to(list_branches::list_branches))
|
||||
.route("/{repo_name}/branches", web::post().to(create_branch::create_branch))
|
||||
.route(
|
||||
"/{repo_name}/branches",
|
||||
web::get().to(list_branches::list_branches),
|
||||
)
|
||||
.route(
|
||||
"/{repo_name}/branches",
|
||||
web::post().to(create_branch::create_branch),
|
||||
)
|
||||
.route(
|
||||
"/{repo_name}/branches/{branch_id}/default",
|
||||
web::put().to(set_default_branch::set_default_branch),
|
||||
@@ -90,9 +99,18 @@ pub fn configure(cfg: &mut web::ServiceConfig) {
|
||||
)
|
||||
.route("/{repo_name}/tags", web::get().to(list_tags::list_tags))
|
||||
.route("/{repo_name}/tags", web::post().to(create_tag::create_tag))
|
||||
.route("/{repo_name}/tags/{tag_id}", web::delete().to(delete_tag::delete_tag))
|
||||
.route("/{repo_name}/releases", web::get().to(list_releases::list_releases))
|
||||
.route("/{repo_name}/releases", web::post().to(create_release::create_release))
|
||||
.route(
|
||||
"/{repo_name}/tags/{tag_id}",
|
||||
web::delete().to(delete_tag::delete_tag),
|
||||
)
|
||||
.route(
|
||||
"/{repo_name}/releases",
|
||||
web::get().to(list_releases::list_releases),
|
||||
)
|
||||
.route(
|
||||
"/{repo_name}/releases",
|
||||
web::post().to(create_release::create_release),
|
||||
)
|
||||
.route(
|
||||
"/{repo_name}/releases/{release_id}",
|
||||
web::put().to(update_release::update_release),
|
||||
@@ -105,13 +123,31 @@ pub fn configure(cfg: &mut web::ServiceConfig) {
|
||||
.route("/{repo_name}/fork", web::post().to(fork_repo::fork_repo))
|
||||
.route("/{repo_name}/sync", web::post().to(sync_fork::sync_fork))
|
||||
.route("/{repo_name}/star", web::post().to(star_repo::star_repo))
|
||||
.route("/{repo_name}/star", web::delete().to(unstar_repo::unstar_repo))
|
||||
.route("/{repo_name}/stargazers", web::get().to(list_stargazers::list_stargazers))
|
||||
.route(
|
||||
"/{repo_name}/star",
|
||||
web::delete().to(unstar_repo::unstar_repo),
|
||||
)
|
||||
.route(
|
||||
"/{repo_name}/stargazers",
|
||||
web::get().to(list_stargazers::list_stargazers),
|
||||
)
|
||||
.route("/{repo_name}/watch", web::post().to(watch_repo::watch_repo))
|
||||
.route("/{repo_name}/watch", web::delete().to(unwatch_repo::unwatch_repo))
|
||||
.route("/{repo_name}/watchers", web::get().to(list_watchers::list_watchers))
|
||||
.route("/{repo_name}/members", web::get().to(list_members::list_members))
|
||||
.route("/{repo_name}/members", web::post().to(add_member::add_member))
|
||||
.route(
|
||||
"/{repo_name}/watch",
|
||||
web::delete().to(unwatch_repo::unwatch_repo),
|
||||
)
|
||||
.route(
|
||||
"/{repo_name}/watchers",
|
||||
web::get().to(list_watchers::list_watchers),
|
||||
)
|
||||
.route(
|
||||
"/{repo_name}/members",
|
||||
web::get().to(list_members::list_members),
|
||||
)
|
||||
.route(
|
||||
"/{repo_name}/members",
|
||||
web::post().to(add_member::add_member),
|
||||
)
|
||||
.route(
|
||||
"/{repo_name}/members/{member_id}/role",
|
||||
web::put().to(update_member_role::update_member_role),
|
||||
@@ -121,7 +157,10 @@ pub fn configure(cfg: &mut web::ServiceConfig) {
|
||||
web::delete().to(remove_member::remove_member),
|
||||
)
|
||||
.route("/{repo_name}/leave", web::post().to(leave_repo::leave_repo))
|
||||
.route("/{repo_name}/invitations", web::get().to(list_invitations::list_invitations))
|
||||
.route(
|
||||
"/{repo_name}/invitations",
|
||||
web::get().to(list_invitations::list_invitations),
|
||||
)
|
||||
.route(
|
||||
"/{repo_name}/invitations",
|
||||
web::post().to(create_invitation::create_invitation),
|
||||
@@ -130,14 +169,26 @@ pub fn configure(cfg: &mut web::ServiceConfig) {
|
||||
"/{repo_name}/invitations/{invitation_id}",
|
||||
web::delete().to(revoke_invitation::revoke_invitation),
|
||||
)
|
||||
.route("/{repo_name}/deploy-keys", web::get().to(list_deploy_keys::list_deploy_keys))
|
||||
.route("/{repo_name}/deploy-keys", web::post().to(add_deploy_key::add_deploy_key))
|
||||
.route(
|
||||
"/{repo_name}/deploy-keys",
|
||||
web::get().to(list_deploy_keys::list_deploy_keys),
|
||||
)
|
||||
.route(
|
||||
"/{repo_name}/deploy-keys",
|
||||
web::post().to(add_deploy_key::add_deploy_key),
|
||||
)
|
||||
.route(
|
||||
"/{repo_name}/deploy-keys/{key_id}",
|
||||
web::delete().to(delete_deploy_key::delete_deploy_key),
|
||||
)
|
||||
.route("/{repo_name}/webhooks", web::get().to(list_webhooks::list_webhooks))
|
||||
.route("/{repo_name}/webhooks", web::post().to(create_webhook::create_webhook))
|
||||
.route(
|
||||
"/{repo_name}/webhooks",
|
||||
web::get().to(list_webhooks::list_webhooks),
|
||||
)
|
||||
.route(
|
||||
"/{repo_name}/webhooks",
|
||||
web::post().to(create_webhook::create_webhook),
|
||||
)
|
||||
.route(
|
||||
"/{repo_name}/webhooks/{webhook_id}",
|
||||
web::put().to(update_webhook::update_webhook),
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::models::repos::RepoStats;
|
||||
use crate::service::AppService;
|
||||
@@ -20,7 +20,7 @@ pub struct PathParams {
|
||||
///
|
||||
/// Recalculates and updates repository statistics from the current state of the repository.
|
||||
/// Requires Admin role or higher in the repository.
|
||||
///
|
||||
///
|
||||
/// Effects:
|
||||
/// - Recalculates star, watcher, and fork counts
|
||||
/// - Recalculates branch and tag counts
|
||||
@@ -29,7 +29,7 @@ pub struct PathParams {
|
||||
/// - Recalculates open issues and pull requests count
|
||||
/// - Updates storage size and bandwidth usage
|
||||
/// - Updates last push timestamp
|
||||
///
|
||||
///
|
||||
/// Returns the refreshed statistics with all updated values.
|
||||
#[utoipa::path(
|
||||
post,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::service::AppService;
|
||||
use crate::session::Session;
|
||||
@@ -21,15 +21,15 @@ pub struct PathParams {
|
||||
///
|
||||
/// Revokes a user's access to the repository.
|
||||
/// Requires Admin role or higher in the repository.
|
||||
///
|
||||
///
|
||||
/// Restrictions:
|
||||
/// - Cannot remove the repository owner (use transfer_owner instead)
|
||||
/// - Cannot remove members with equal or higher role than your own
|
||||
///
|
||||
///
|
||||
/// Effects:
|
||||
/// - Member loses all access to the repository
|
||||
/// - Member is removed from all repository activities
|
||||
///
|
||||
///
|
||||
/// Returns success message on completion.
|
||||
#[utoipa::path(
|
||||
delete,
|
||||
@@ -56,7 +56,12 @@ pub async fn remove_member(
|
||||
) -> Result<HttpResponse, AppError> {
|
||||
service
|
||||
.repo
|
||||
.repo_remove_member(&session, &path.workspace_name, &path.repo_name, path.member_id)
|
||||
.repo_remove_member(
|
||||
&session,
|
||||
&path.workspace_name,
|
||||
&path.repo_name,
|
||||
path.member_id,
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(HttpResponse::Ok().json(ApiResponse::new("Member removed successfully".to_string())))
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::service::AppService;
|
||||
use crate::session::Session;
|
||||
@@ -21,12 +21,12 @@ pub struct PathParams {
|
||||
///
|
||||
/// Marks a commit comment as resolved, indicating the issue has been addressed.
|
||||
/// Requires Write role or higher in the repository.
|
||||
///
|
||||
///
|
||||
/// Effects:
|
||||
/// - Comment is marked as resolved
|
||||
/// - Resolved comments are visually distinguished in code review interfaces
|
||||
/// - Resolution is recorded with the resolver's user ID and timestamp
|
||||
///
|
||||
///
|
||||
/// Returns success message on completion.
|
||||
#[utoipa::path(
|
||||
post,
|
||||
@@ -53,8 +53,15 @@ pub async fn resolve_commit_comment(
|
||||
) -> Result<HttpResponse, AppError> {
|
||||
service
|
||||
.repo
|
||||
.repo_resolve_commit_comment(&session, &path.workspace_name, &path.repo_name, path.comment_id)
|
||||
.repo_resolve_commit_comment(
|
||||
&session,
|
||||
&path.workspace_name,
|
||||
&path.repo_name,
|
||||
path.comment_id,
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(HttpResponse::Ok().json(ApiResponse::new("Commit comment resolved successfully".to_string())))
|
||||
Ok(HttpResponse::Ok().json(ApiResponse::new(
|
||||
"Commit comment resolved successfully".to_string(),
|
||||
)))
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::service::AppService;
|
||||
use crate::session::Session;
|
||||
@@ -21,12 +21,12 @@ pub struct PathParams {
|
||||
///
|
||||
/// Cancels a pending invitation, preventing the invitee from accepting it.
|
||||
/// Requires Admin role or higher in the repository.
|
||||
///
|
||||
///
|
||||
/// Effects:
|
||||
/// - Invitation is marked as revoked
|
||||
/// - Invitee can no longer accept the invitation
|
||||
/// - Invitation email link becomes invalid
|
||||
///
|
||||
///
|
||||
/// Returns success message on completion.
|
||||
#[utoipa::path(
|
||||
delete,
|
||||
@@ -52,8 +52,15 @@ pub async fn revoke_invitation(
|
||||
) -> Result<HttpResponse, AppError> {
|
||||
service
|
||||
.repo
|
||||
.repo_revoke_invitation(&session, &path.workspace_name, &path.repo_name, path.invitation_id)
|
||||
.repo_revoke_invitation(
|
||||
&session,
|
||||
&path.workspace_name,
|
||||
&path.repo_name,
|
||||
path.invitation_id,
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(HttpResponse::Ok().json(ApiResponse::new("Invitation revoked successfully".to_string())))
|
||||
Ok(HttpResponse::Ok().json(ApiResponse::new(
|
||||
"Invitation revoked successfully".to_string(),
|
||||
)))
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::{IntoParams, ToSchema};
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::service::AppService;
|
||||
use crate::session::Session;
|
||||
@@ -73,5 +73,7 @@ pub async fn set_branch_protection(
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(HttpResponse::Ok().json(ApiResponse::new("Branch protection rules set successfully".to_string())))
|
||||
Ok(HttpResponse::Ok().json(ApiResponse::new(
|
||||
"Branch protection rules set successfully".to_string(),
|
||||
)))
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::service::AppService;
|
||||
use crate::session::Session;
|
||||
@@ -23,9 +23,9 @@ pub struct PathParams {
|
||||
/// - New pull requests base branch
|
||||
/// - Repository cloning
|
||||
/// - New branch creation base
|
||||
///
|
||||
///
|
||||
/// Requires Admin role or higher in the repository.
|
||||
///
|
||||
///
|
||||
/// Returns success message on completion.
|
||||
#[utoipa::path(
|
||||
put,
|
||||
@@ -51,8 +51,15 @@ pub async fn set_default_branch(
|
||||
) -> Result<HttpResponse, AppError> {
|
||||
service
|
||||
.repo
|
||||
.repo_set_default_branch(&session, &path.workspace_name, &path.repo_name, path.branch_id)
|
||||
.repo_set_default_branch(
|
||||
&session,
|
||||
&path.workspace_name,
|
||||
&path.repo_name,
|
||||
path.branch_id,
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(HttpResponse::Ok().json(ApiResponse::new("Default branch set successfully".to_string())))
|
||||
Ok(HttpResponse::Ok().json(ApiResponse::new(
|
||||
"Default branch set successfully".to_string(),
|
||||
)))
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::service::AppService;
|
||||
use crate::session::Session;
|
||||
@@ -19,12 +19,12 @@ pub struct PathParams {
|
||||
///
|
||||
/// Adds the current user to the repository's stargazers list.
|
||||
/// Requires read access to the repository.
|
||||
///
|
||||
///
|
||||
/// Effects:
|
||||
/// - User is added to the repository's stargazers
|
||||
/// - Repository star count is incremented
|
||||
/// - User can unstar later to remove themselves
|
||||
///
|
||||
///
|
||||
/// Returns success message on completion. Idempotent operation (starring an already starred repository is a no-op).
|
||||
#[utoipa::path(
|
||||
post,
|
||||
@@ -53,5 +53,7 @@ pub async fn star_repo(
|
||||
.repo_star(&session, &path.workspace_name, &path.repo_name)
|
||||
.await?;
|
||||
|
||||
Ok(HttpResponse::Ok().json(ApiResponse::new("Repository starred successfully".to_string())))
|
||||
Ok(HttpResponse::Ok().json(ApiResponse::new(
|
||||
"Repository starred successfully".to_string(),
|
||||
)))
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::service::AppService;
|
||||
use crate::session::Session;
|
||||
@@ -19,12 +19,12 @@ pub struct PathParams {
|
||||
///
|
||||
/// Synchronizes a forked repository with the latest changes from the parent repository.
|
||||
/// Requires Write role or higher in the fork repository.
|
||||
///
|
||||
///
|
||||
/// Effects:
|
||||
/// - Merges changes from the parent repository's default branch into the fork
|
||||
/// - Creates a merge commit if there are conflicts
|
||||
/// - Updates the fork's commit history
|
||||
///
|
||||
///
|
||||
/// Only works on repositories that are forks (have a parent repository).
|
||||
/// Returns success message on completion.
|
||||
#[utoipa::path(
|
||||
@@ -56,5 +56,7 @@ pub async fn sync_fork(
|
||||
.repo_sync_fork(&session, &path.workspace_name, &path.repo_name)
|
||||
.await?;
|
||||
|
||||
Ok(HttpResponse::Ok().json(ApiResponse::new("Fork synchronized successfully".to_string())))
|
||||
Ok(HttpResponse::Ok().json(ApiResponse::new(
|
||||
"Fork synchronized successfully".to_string(),
|
||||
)))
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::{IntoParams, ToSchema};
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::models::repos::Repo;
|
||||
use crate::service::AppService;
|
||||
@@ -26,13 +26,13 @@ pub struct TransferOwnerParams {
|
||||
///
|
||||
/// Transfers ownership of a repository to another user. The new owner must be an existing repository member.
|
||||
/// Requires Owner role in the repository.
|
||||
///
|
||||
///
|
||||
/// Effects:
|
||||
/// - Current owner becomes an Admin
|
||||
/// - New owner gains full Owner permissions
|
||||
/// - Repository URL remains unchanged
|
||||
/// - All forks and stars are preserved
|
||||
///
|
||||
///
|
||||
/// Returns the updated repository with new owner information.
|
||||
#[utoipa::path(
|
||||
post,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::service::AppService;
|
||||
use crate::session::Session;
|
||||
@@ -19,12 +19,12 @@ pub struct PathParams {
|
||||
///
|
||||
/// Restores an archived repository to active status, re-enabling all write operations.
|
||||
/// Requires Owner role in the repository.
|
||||
///
|
||||
///
|
||||
/// Effects:
|
||||
/// - Repository status changes from "archived" to "active"
|
||||
/// - All write operations are re-enabled
|
||||
/// - Previous visibility and settings are preserved
|
||||
///
|
||||
///
|
||||
/// Returns success message on completion.
|
||||
#[utoipa::path(
|
||||
post,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::service::AppService;
|
||||
use crate::session::Session;
|
||||
@@ -19,11 +19,11 @@ pub struct PathParams {
|
||||
///
|
||||
/// Removes the current user from the repository's stargazers list.
|
||||
/// Requires read access to the repository.
|
||||
///
|
||||
///
|
||||
/// Effects:
|
||||
/// - User is removed from the repository's stargazers
|
||||
/// - Repository star count is decremented
|
||||
///
|
||||
///
|
||||
/// Returns success message on completion. Idempotent operation (unstarring an unstarred repository is a no-op).
|
||||
#[utoipa::path(
|
||||
delete,
|
||||
@@ -52,5 +52,7 @@ pub async fn unstar_repo(
|
||||
.repo_unstar(&session, &path.workspace_name, &path.repo_name)
|
||||
.await?;
|
||||
|
||||
Ok(HttpResponse::Ok().json(ApiResponse::new("Repository unstarred successfully".to_string())))
|
||||
Ok(HttpResponse::Ok().json(ApiResponse::new(
|
||||
"Repository unstarred successfully".to_string(),
|
||||
)))
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::service::AppService;
|
||||
use crate::session::Session;
|
||||
@@ -19,11 +19,11 @@ pub struct PathParams {
|
||||
///
|
||||
/// Removes the current user's watch subscription from the repository.
|
||||
/// Requires read access to the repository.
|
||||
///
|
||||
///
|
||||
/// Effects:
|
||||
/// - User is removed from the repository's watchers
|
||||
/// - User will no longer receive notifications for repository activities
|
||||
///
|
||||
///
|
||||
/// Returns success message on completion. Idempotent operation (unwatching an unwatched repository is a no-op).
|
||||
#[utoipa::path(
|
||||
delete,
|
||||
@@ -52,5 +52,7 @@ pub async fn unwatch_repo(
|
||||
.repo_unwatch(&session, &path.workspace_name, &path.repo_name)
|
||||
.await?;
|
||||
|
||||
Ok(HttpResponse::Ok().json(ApiResponse::new("Repository watch subscription removed successfully".to_string())))
|
||||
Ok(HttpResponse::Ok().json(ApiResponse::new(
|
||||
"Repository watch subscription removed successfully".to_string(),
|
||||
)))
|
||||
}
|
||||
|
||||
+5
-5
@@ -1,12 +1,12 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::models::repos::Repo;
|
||||
use crate::service::repo::core::UpdateRepoParams;
|
||||
use crate::service::AppService;
|
||||
use crate::service::repo::core::UpdateRepoParams;
|
||||
use crate::session::Session;
|
||||
|
||||
#[derive(Debug, Deserialize, IntoParams)]
|
||||
@@ -21,13 +21,13 @@ pub struct PathParams {
|
||||
///
|
||||
/// Updates repository metadata such as name, description, visibility, and default branch.
|
||||
/// Requires Admin role or higher in the repository.
|
||||
///
|
||||
///
|
||||
/// Update rules:
|
||||
/// - name: Must be unique within workspace if changed (1-100 characters)
|
||||
/// - description: Max 500 characters
|
||||
/// - visibility: "public", "private", or "internal" (workspace owners can restrict public repos)
|
||||
/// - default_branch: Must be an existing branch name
|
||||
///
|
||||
///
|
||||
/// All fields are optional; only provided fields are updated.
|
||||
/// Returns the updated repository with full metadata.
|
||||
#[utoipa::path(
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::models::repos::RepoMember;
|
||||
use crate::service::repo::members::UpdateRepoMemberRoleParams;
|
||||
use crate::service::AppService;
|
||||
use crate::service::repo::members::UpdateRepoMemberRoleParams;
|
||||
use crate::session::Session;
|
||||
|
||||
#[derive(Debug, Deserialize, IntoParams)]
|
||||
@@ -23,13 +23,13 @@ pub struct PathParams {
|
||||
///
|
||||
/// Changes the access level of an existing repository member.
|
||||
/// Requires Admin role or higher in the repository.
|
||||
///
|
||||
///
|
||||
/// Role restrictions:
|
||||
/// - Cannot change the owner's role (use transfer_owner instead)
|
||||
/// - Cannot assign "owner" role (use transfer_owner instead)
|
||||
/// - Can only assign roles equal to or lower than your own
|
||||
/// - Valid roles: "read", "write", "admin"
|
||||
///
|
||||
///
|
||||
/// Returns the updated member record with new role information.
|
||||
#[utoipa::path(
|
||||
put,
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::models::repos::BranchProtectionRule;
|
||||
use crate::service::repo::protection::UpdateProtectionRuleParams;
|
||||
use crate::service::AppService;
|
||||
use crate::service::repo::protection::UpdateProtectionRuleParams;
|
||||
use crate::session::Session;
|
||||
|
||||
#[derive(Debug, Deserialize, IntoParams)]
|
||||
@@ -23,7 +23,7 @@ pub struct PathParams {
|
||||
///
|
||||
/// Updates an existing branch protection rule's configuration.
|
||||
/// Requires Admin role or higher in the repository.
|
||||
///
|
||||
///
|
||||
/// Updatable fields:
|
||||
/// - required_approvals: Number of required approvals before merging (0-10)
|
||||
/// - require_status_checks: Whether status checks must pass
|
||||
@@ -31,7 +31,7 @@ pub struct PathParams {
|
||||
/// - restrict_pushes: Restrict who can push to matching branches
|
||||
/// - allow_force_pushes: Allow force pushes (only if restrict_pushes is false)
|
||||
/// - allow_deletions: Allow branch deletion (only if restrict_pushes is false)
|
||||
///
|
||||
///
|
||||
/// All fields are optional; only provided fields are updated.
|
||||
/// Returns the updated protection rule with full configuration.
|
||||
#[utoipa::path(
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::models::repos::RepoRelease;
|
||||
use crate::service::repo::releases::UpdateReleaseParams;
|
||||
use crate::service::AppService;
|
||||
use crate::service::repo::releases::UpdateReleaseParams;
|
||||
use crate::session::Session;
|
||||
|
||||
#[derive(Debug, Deserialize, IntoParams)]
|
||||
@@ -23,13 +23,13 @@ pub struct PathParams {
|
||||
///
|
||||
/// Updates release metadata such as name, description, draft status, and prerelease flag.
|
||||
/// Requires Write role or higher in the repository.
|
||||
///
|
||||
///
|
||||
/// Updatable fields:
|
||||
/// - name: Release name/title (max 255 characters)
|
||||
/// - body: Release notes in markdown format (max 10000 characters)
|
||||
/// - draft: Whether this is a draft release
|
||||
/// - prerelease: Whether this is a prerelease
|
||||
///
|
||||
///
|
||||
/// All fields are optional; only provided fields are updated.
|
||||
/// Returns the updated release with full metadata.
|
||||
#[utoipa::path(
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::models::repos::RepoWebhook;
|
||||
use crate::service::repo::webhooks::UpdateWebhookParams;
|
||||
use crate::service::AppService;
|
||||
use crate::service::repo::webhooks::UpdateWebhookParams;
|
||||
use crate::session::Session;
|
||||
|
||||
#[derive(Debug, Deserialize, IntoParams)]
|
||||
@@ -23,13 +23,13 @@ pub struct PathParams {
|
||||
///
|
||||
/// Updates webhook configuration such as URL, events, secret, and active status.
|
||||
/// Requires Admin role or higher in the repository.
|
||||
///
|
||||
///
|
||||
/// Updatable fields:
|
||||
/// - url: Webhook endpoint URL (must be HTTPS in production)
|
||||
/// - events: List of events to subscribe to
|
||||
/// - secret: Secret for webhook signature verification
|
||||
/// - active: Whether the webhook is active
|
||||
///
|
||||
///
|
||||
/// All fields are optional; only provided fields are updated.
|
||||
/// Returns the updated webhook with full metadata.
|
||||
#[utoipa::path(
|
||||
|
||||
+14
-7
@@ -1,12 +1,12 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use actix_web::{HttpResponse, web};
|
||||
use serde::Deserialize;
|
||||
use utoipa::IntoParams;
|
||||
|
||||
use crate::api::response::{ApiResponse, ApiErrorResponse};
|
||||
use crate::api::response::{ApiErrorResponse, ApiResponse};
|
||||
use crate::error::AppError;
|
||||
use crate::service::AppService;
|
||||
use crate::session::Session;
|
||||
use crate::service::repo::watches::WatchParams;
|
||||
use crate::session::Session;
|
||||
|
||||
#[derive(Debug, Deserialize, IntoParams)]
|
||||
pub struct PathParams {
|
||||
@@ -20,12 +20,12 @@ pub struct PathParams {
|
||||
///
|
||||
/// Subscribes the current user to notifications for repository activities.
|
||||
/// Requires read access to the repository.
|
||||
///
|
||||
///
|
||||
/// Watch levels:
|
||||
/// - "participating": Notifications for issues/PRs you're involved in
|
||||
/// - "watching": All repository notifications (default)
|
||||
/// - "ignoring": No notifications
|
||||
///
|
||||
///
|
||||
/// Returns success message on completion. Idempotent operation.
|
||||
#[utoipa::path(
|
||||
post,
|
||||
@@ -58,8 +58,15 @@ pub async fn watch_repo(
|
||||
) -> Result<HttpResponse, AppError> {
|
||||
service
|
||||
.repo
|
||||
.repo_watch(&session, &path.workspace_name, &path.repo_name, params.into_inner())
|
||||
.repo_watch(
|
||||
&session,
|
||||
&path.workspace_name,
|
||||
&path.repo_name,
|
||||
params.into_inner(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(HttpResponse::Ok().json(ApiResponse::new("Repository watch subscription updated successfully".to_string())))
|
||||
Ok(HttpResponse::Ok().json(ApiResponse::new(
|
||||
"Repository watch subscription updated successfully".to_string(),
|
||||
)))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user