Skip to content
Clone

refactor: update database write logic and normalize API paths for improved clarity and consistency

ZhenYi committed
parent 07f791d commit 58775d4 Browse files

3 files changed

+13 −1

This change is very large, so some diffs are not shown. Clone the repository to see the full change.

File tree 3
Modified lib/pulls/src/services/service.rs View lib/pulls/src/services/service.rs
@@ -46,7 +46,7 @@
4646 .filter(pull_requests::Column::RepoId.eq(repo_id))
4747 .filter(pull_requests::Column::HasMerged.eq(false))
4848 .filter(pull_requests::Column::ClosedAt.is_null())
49 .count(self.db_read())
49 .count(self.db_write())
5050 .await?;
5151 let repo = repos::ActiveModel {
5252 id: Set(repo_id),
Modified lib/webapi/src/openapi.rs View lib/webapi/src/openapi.rs
@@ -110,6 +110,18 @@
110110 m!("git", git::openapi::GitApiDoc::openapi());
111111 m!("pulls", pulls::openapi::PullsApiDoc::openapi());
112112 m!("cleanup", crate::cleanup::CleanupApiDoc::openapi());
113 let paths = std::mem::take(&mut doc.paths.paths);
114 doc.paths.paths = paths
115 .into_iter()
116 .map(|(path, item)| {
117 let normalized = path
118 .strip_prefix("/api/v1")
119 .filter(|rest| rest.starts_with('/'))
120 .map(str::to_string)
121 .unwrap_or(path);
122 (normalized, item)
123 })
124 .collect();
113125 doc.servers = Some(vec![utoipa::openapi::Server::new("/api/v1")]);
114126 doc.info.description = Some(CONVENTIONS.to_string());
115127 doc.info.license = None;
Modified openapi.json View openapi.json

Diff too large to display.