feat: Add public routes for hackathons and enhance permissions checks to support both names and IDs

This commit is contained in:
MythEclipse
2025-10-05 20:23:34 +07:00
parent b27e4a4404
commit 7749f6fdec
6 changed files with 74 additions and 10 deletions
@@ -504,11 +504,9 @@ pub async fn delete_hackathon_submission(
pub fn hackathon_routes() -> Router {
Router::new()
// Hackathon routes
.route("/", post(create_hackathon))
.route("/", get(list_hackathons))
.route("/{id}", get(get_hackathon))
.route("/{id}", put(update_hackathon))
// Hackathon routes
.route("/", post(create_hackathon))
.route("/{id}", put(update_hackathon))
.route("/{id}", delete(delete_hackathon))
// Hackathon Events routes
+10
View File
@@ -8,4 +8,14 @@ pub use hackathon::hackathon_router;
// Main route constructor
pub fn hackathon_protected_routes() -> Router {
Router::new().nest("/hackathons", hackathon_router())
}
// Public routes for hackathons (only listing and retrieving)
pub fn hackathon_public_routes() -> Router {
use hackathon::hackathon_controller::{list_hackathons, get_hackathon};
Router::new()
.nest("/hackathons", Router::new()
.route("/", axum::routing::get(list_hackathons))
.route("/{id}", axum::routing::get(get_hackathon))
)
}