f0a1552
ZhenYi
feat(chat): add chat module with room management, message handling, and session revocation
f0a1552
use axum::extract::{Path, State};
use export::rest::AppResponseData;
use session::Session;
use crate::errors::{ApiError, GitApiError};
use crate::handler::ensure_read_access;
use crate::service::GitService;
use crate::service::pipelines::PipelineRunDto;
use crate::share::errors::GitError;
#[utoipa::path(
get,
path = "/repos/{space_name}/{repo_name}/pipelines/{job_id}",
tag = "pipelines",
description = "读取指定流水线运行详情;其他仓库的任务按不存在处理。",
params(
("space_name" = String, Path),
("repo_name" = String, Path),
("job_id" = String, Path, description = "pipeline run id")
),
responses(
(status = 200, description = "pipeline run detail", body = AppResponseData<PipelineRunDto>),
(status = 404, description = "not found", body = AppResponseData<export::rest::NoData>)
)
)]
pub async fn get_run(
State(service): State<GitService>,
session: Session,
Path((space_name, repo_name, job_id)): Path<(String, String, String)>,
) -> Result<AppResponseData<PipelineRunDto>, ApiError> {
let ctx = service
.context(space_name.clone(), repo_name.clone())
.await
.map_err(GitApiError::from)?;
ensure_read_access(&service, &session, &ctx).await?;
let run = service
.get_pipeline_run(job_id)
.await
.map_err(GitApiError::from)?;
if run.repo_id != ctx.model.id {
return Err(GitApiError::from(GitError::NotFound).into());
}
Ok(AppResponseData::ok(run))
}