Refactor API endpoints for consistency and clarity

- Updated route paths for hackathon submissions, notifications, registrations, and teams to include more descriptive actions (e.g., "update", "create", "delete").
- Removed deprecated routes and adjusted corresponding test cases to reflect new endpoint structures.
- Enhanced test scripts to ensure compatibility with updated API routes and improved error handling for OTP resend functionality.
- Adjusted server startup script for better Windows compatibility and streamlined process management.
This commit is contained in:
MythEclipse
2025-10-29 14:27:07 +07:00
parent 98c46611fb
commit 97c2fce7be
19 changed files with 361 additions and 155 deletions
@@ -15,7 +15,7 @@ use imphnen_utils::extract_email;
#[utoipa::path(
post,
path = "/v1/mentors/register",
path = "/v1/mentors/create",
request_body = MentorUserRegisterRequestDto,
responses(
(status = 200, description = "[PUBLIC] Mentor registered successfully", body = MentorRegisterResponseDto),
@@ -205,7 +205,7 @@ pub async fn get_mentor_me(
#[utoipa::path(
put,
path = "/v1/mentors/update/me",
path = "/v1/mentors/me/update",
request_body = MentorUpdateRequestDto,
responses(
(status = 200, description = "[MENTOR] Mentor profile updated successfully", body = MentorDetailResponseDto),
@@ -255,7 +255,7 @@ pub async fn put_update_mentor_no_id() -> Response {
#[utoipa::path(
get,
path = "/v1/mentors/status",
path = "/v1/mentors/me/status",
responses(
(status = 200, description = "[MENTOR] Mentor application status", body = String),
(status = 401, description = "[MENTOR] Unauthorized - invalid token"),
+3 -3
View File
@@ -49,10 +49,10 @@ pub use mentors_schema::MentorSchema;
pub fn mentors_router() -> Router {
Router::new()
.route("/", get(get_mentor_list))
.route("/register", post(post_register_mentor))
.route("/create", post(post_register_mentor))
.route("/me", get(get_mentor_me))
.route("/update/me", put(put_update_mentor_me))
.route("/status", get(get_mentor_status))
.route("/me/update", put(put_update_mentor_me))
.route("/me/status", get(get_mentor_status))
.route("/detail/{id}", get(get_mentor_by_id))
.route("/update/{id}", put(put_update_mentor))
.route("/update", put(put_update_mentor_no_id))
@@ -49,7 +49,7 @@ pub struct SessionsApiDoc;
#[utoipa::path(
post,
path = "/v1/mentors/{id}/sessions/book",
path = "/v1/mentors/{id}/sessions/create",
tag = "sessions",
summary = "Book a mentoring session",
description = "Book a mentoring session with a specific mentor. Requires authentication.",
@@ -161,7 +161,7 @@ pub async fn get_mentor_availability(
#[utoipa::path(
put,
path = "/v1/sessions/{id}/status",
path = "/v1/sessions/update/{id}/status",
tag = "sessions",
summary = "Update session status",
description = "Update the status of a session (confirm, complete, cancel). Only accessible by the mentor.",
@@ -203,7 +203,7 @@ pub async fn put_update_session_status(
#[utoipa::path(
post,
path = "/v1/sessions/{id}/feedback",
path = "/v1/sessions/{id}/feedback/create",
tag = "sessions",
summary = "Submit session feedback",
description = "Submit feedback and rating for a completed session. Only accessible by the mentee.",
@@ -283,15 +283,15 @@ pub async fn get_my_sessions(
pub fn sessions_router() -> Router {
Router::new()
// Book session (under mentors path)
.route("/mentors/{id}/sessions/book", post(post_book_session))
.route("/mentors/{id}/sessions/create", post(post_book_session))
// Get mentor's sessions
.route("/mentors/{id}/sessions", get(get_mentor_sessions))
// Get mentor availability (public - no auth)
.route("/mentors/{id}/availability", get(get_mentor_availability))
// Update session status
.route("/sessions/{id}/status", put(put_update_session_status))
.route("/sessions/update/{id}/status", put(put_update_session_status))
// Submit feedback
.route("/sessions/{id}/feedback", post(post_submit_feedback))
.route("/sessions/{id}/feedback/create", post(post_submit_feedback))
// Get my sessions
.route("/users/me/sessions", get(get_my_sessions))
}