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:
zhenyi
2026-06-07 19:41:33 +08:00
parent 7368ba676c
commit 4028f0d943
149 changed files with 4962 additions and 369 deletions
+121 -70
View File
@@ -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),