fix(api): register skill routes inside project scope to fix 404
In actix-web, separate web::scope() trees don't merge. The /projects
scope was intercepting /api/projects/{name}/skills before the separate
skill scope could match, causing 404 on all skill endpoints.
Move skill routes into init_project_routes as /{project_name}/skills/*
and remove the standalone configure(skill::init_skill_routes) call.
This commit is contained in:
parent
108dd714d3
commit
5351df773b
@ -281,6 +281,31 @@ pub fn init_project_routes(cfg: &mut web::ServiceConfig) {
|
||||
.route(
|
||||
"/{project_name}/cards/{card_id}",
|
||||
web::delete().to(board::card_delete),
|
||||
)
|
||||
// Skills
|
||||
.route(
|
||||
"/{project_name}/skills",
|
||||
web::get().to(crate::skill::skill_list),
|
||||
)
|
||||
.route(
|
||||
"/{project_name}/skills",
|
||||
web::post().to(crate::skill::skill_create),
|
||||
)
|
||||
.route(
|
||||
"/{project_name}/skills/scan",
|
||||
web::post().to(crate::skill::skill_scan),
|
||||
)
|
||||
.route(
|
||||
"/{project_name}/skills/{slug}",
|
||||
web::get().to(crate::skill::skill_get),
|
||||
)
|
||||
.route(
|
||||
"/{project_name}/skills/{slug}",
|
||||
web::patch().to(crate::skill::skill_update),
|
||||
)
|
||||
.route(
|
||||
"/{project_name}/skills/{slug}",
|
||||
web::delete().to(crate::skill::skill_delete),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@ -23,8 +23,7 @@ pub fn init_routes(cfg: &mut web::ServiceConfig) {
|
||||
.configure(crate::agent::init_agent_routes)
|
||||
.configure(crate::workspace::init_workspace_routes)
|
||||
.configure(crate::search::init_search_routes)
|
||||
.configure(crate::room::init_room_routes)
|
||||
.configure(crate::skill::init_skill_routes),
|
||||
.configure(crate::room::init_room_routes),
|
||||
);
|
||||
|
||||
// SPA fallback — must be registered last so /api/* takes precedence
|
||||
|
||||
@ -231,14 +231,3 @@ pub struct ScanResponse {
|
||||
pub removed: i64,
|
||||
}
|
||||
|
||||
pub fn init_skill_routes(cfg: &mut web::ServiceConfig) {
|
||||
cfg.service(
|
||||
web::scope("/projects/{project_name}/skills")
|
||||
.route("", web::get().to(skill_list))
|
||||
.route("", web::post().to(skill_create))
|
||||
.route("/scan", web::post().to(skill_scan))
|
||||
.route("/{slug}", web::get().to(skill_get))
|
||||
.route("/{slug}", web::patch().to(skill_update))
|
||||
.route("/{slug}", web::delete().to(skill_delete)),
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user