Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions mono/src/api/mr/mr_router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ pub fn routers() -> OpenApiRouter<MonoApiServiceState> {
.routes(routes!(fetch_mr_list))
.routes(routes!(mr_detail))
.routes(routes!(merge))
.routes(routes!(merge_no_auth))
.routes(routes!(close_mr))
.routes(routes!(reopen_mr))
.routes(routes!(mr_files_changed))
Expand Down Expand Up @@ -170,6 +171,42 @@ async fn merge(
Ok(Json(CommonResult::success(None)))
}

/// Merge Request without authentication
/// It's for local testing purposes.
#[utoipa::path(
post,
params(
("link", description = "MR link"),
),
path = "/{link}/merge-no-auth",
responses(
(status = 200, body = CommonResult<String>, content_type = "application/json")
),
tag = MR_TAG
)]
async fn merge_no_auth(
Path(link): Path<String>,
state: State<MonoApiServiceState>,
) -> Result<Json<CommonResult<String>>, ApiError> {
let res = state.mr_stg().get_mr(&link).await?;
let model = res.ok_or(MegaError::with_message("MR Not Found"))?;

if model.status != MergeStatusEnum::Open {
return Err(ApiError::from(MegaError::with_message(format!(
"MR is not in Open status, current status: {:?}",
model.status
))));
}

// No authentication required - using default system user
let default_username = "system";
state.monorepo().merge_mr(default_username, model).await?;

Ok(Json(CommonResult::success(Some(
"Merge completed successfully".to_string(),
))))
}

/// Fetch MR list
#[utoipa::path(
post,
Expand Down
4 changes: 2 additions & 2 deletions orion-server/.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
BUILD_LOG_DIR="/tmp/buck2ctl"
BUILD_LOG_DIR="/tmp/megadir/buck2ctl"
DATABASE_URL="postgres://postgres:postgres@localhost/orion"
PORT=8004
PORT=80
1 change: 1 addition & 0 deletions orion-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ dashmap = { workspace = true }
utoipa-axum.workspace = true
utoipa.workspace = true
utoipa-swagger-ui = { workspace = true, features = ["axum"] }
chrono = { version = "0.4", features = ["serde"] }
Loading
Loading