Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix swagger paths #991

Merged
merged 17 commits into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ defmodule CadetWeb.AdminAchievementsController do
end

swagger_path :update do
put("/admin/achievements/{uuid}")
put("/courses/{course_id}/admin/achievements/{uuid}")

summary("Inserts or updates an achievement")

Expand All @@ -87,7 +87,7 @@ defmodule CadetWeb.AdminAchievementsController do
end

swagger_path :bulk_update do
put("/admin/achievements")
put("/courses/{course_id}/admin/achievements")

summary("Inserts or updates achievements")

Expand All @@ -108,7 +108,7 @@ defmodule CadetWeb.AdminAchievementsController do
end

swagger_path :delete do
PhoenixSwagger.Path.delete("/admin/achievements/{uuid}")
PhoenixSwagger.Path.delete("/courses/{course_id}/admin/achievements/{uuid}")

summary("Deletes an achievement")
security([%{JWT: []}])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ defmodule CadetWeb.AdminAssessmentsController do
end

swagger_path :index do
get("/admin/users/{courseRegId}/assessments")
get("/courses/{course_id}/admin/users/{courseRegId}/assessments")

summary("Fetches assessment overviews of a user")

Expand All @@ -143,7 +143,7 @@ defmodule CadetWeb.AdminAssessmentsController do
end

swagger_path :create do
post("/admin/assessments")
post("/courses/{course_id}/admin/assessments")

summary("Creates a new assessment or updates an existing assessment")

Expand All @@ -162,7 +162,7 @@ defmodule CadetWeb.AdminAssessmentsController do
end

swagger_path :delete do
PhoenixSwagger.Path.delete("/admin/assessments/{assessmentId}")
PhoenixSwagger.Path.delete("/courses/{course_id}/admin/assessments/{assessmentId}")

summary("Deletes an assessment")

Expand All @@ -177,7 +177,7 @@ defmodule CadetWeb.AdminAssessmentsController do
end

swagger_path :update do
post("/admin/assessments/{assessmentId}")
post("/courses/{course_id}/admin/assessments/{assessmentId}")

summary("Updates an assessment")

Expand Down
6 changes: 3 additions & 3 deletions lib/cadet_web/admin_controllers/admin_assets_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ defmodule CadetWeb.AdminAssetsController do
end

swagger_path :index do
get("/admin/assets/{folderName}")
get("/courses/{course_id}/admin/assets/{folderName}")

summary("Get a list of all assets in a folder")

Expand All @@ -89,7 +89,7 @@ defmodule CadetWeb.AdminAssetsController do
end

swagger_path :delete do
PhoenixSwagger.Path.delete("/admin/assets/{folderName}/{fileName}")
PhoenixSwagger.Path.delete("/courses/{course_id}/admin/assets/{folderName}/{fileName}")

summary("Delete a file from an asset folder")

Expand All @@ -108,7 +108,7 @@ defmodule CadetWeb.AdminAssetsController do
end

swagger_path :upload do
post("/admin/assets/{folderName}/{fileName}")
post("/courses/{course_id}/admin/assets/{folderName}/{fileName}")

summary("Upload a file to an asset folder")

Expand Down
4 changes: 2 additions & 2 deletions lib/cadet_web/admin_controllers/admin_courses_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ defmodule CadetWeb.AdminCoursesController do
end

swagger_path :update_course_config do
put("/v2/courses/{course_id}/admin/config")
put("/courses/{course_id}/admin/config")

summary("Updates the course configuration for the specified course")

Expand All @@ -117,7 +117,7 @@ defmodule CadetWeb.AdminCoursesController do
end

swagger_path :update_assessment_configs do
put("/v2/courses/{course_id}/admin/config/assessment_configs")
put("/courses/{course_id}/admin/config/assessment_configs")

summary("Updates the assessment configuration for the specified course")

Expand Down
14 changes: 7 additions & 7 deletions lib/cadet_web/admin_controllers/admin_grading_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ defmodule CadetWeb.AdminGradingController do
end

swagger_path :index do
get("/admin/grading")
get("/courses/{course_id}/admin/grading")

summary("Get a list of all submissions with current user as the grader")

Expand All @@ -141,7 +141,7 @@ defmodule CadetWeb.AdminGradingController do
end

swagger_path :unsubmit do
post("/admin/grading/{submissionId}/unsubmit")
post("/courses/{course_id}/admin/grading/{submissionId}/unsubmit")
summary("Unsubmit submission. Can only be done by the Avenger of a student")
security([%{JWT: []}])

Expand All @@ -156,7 +156,7 @@ defmodule CadetWeb.AdminGradingController do
end

swagger_path :autograde_submission do
post("/admin/grading/{submissionId}/autograde")
post("/courses/{course_id}/admin/grading/{submissionId}/autograde")
summary("Force re-autograding of an entire submission")
security([%{JWT: []}])

Expand All @@ -171,7 +171,7 @@ defmodule CadetWeb.AdminGradingController do
end

swagger_path :autograde_answer do
post("/admin/grading/{submissionId}/{questionId}/autograde")
post("/courses/{course_id}/admin/grading/{submissionId}/{questionId}/autograde")
summary("Force re-autograding of a question in a submission")
security([%{JWT: []}])

Expand All @@ -187,7 +187,7 @@ defmodule CadetWeb.AdminGradingController do
end

swagger_path :show do
get("/admin/grading/{submissionId}")
get("/courses/{course_id}/admin/grading/{submissionId}")

summary("Get information about a specific submission to be graded")

Expand All @@ -206,7 +206,7 @@ defmodule CadetWeb.AdminGradingController do
end

swagger_path :update do
post("/admin/grading/{submissionId}/{questionId}")
post("/courses/{course_id}/admin/grading/{submissionId}/{questionId}")

summary("Update marks given to the answer of a particular question in a submission")

Expand All @@ -228,7 +228,7 @@ defmodule CadetWeb.AdminGradingController do
end

swagger_path :grading_summary do
get("/admin/grading/summary")
get("/courses/{course_id}/admin/grading/summary")

summary("Receives a summary of grading items done by this grader")

Expand Down
6 changes: 3 additions & 3 deletions lib/cadet_web/admin_controllers/admin_stories_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ defmodule CadetWeb.AdminStoriesController do
end

swagger_path :create do
post("/v2{course_id}/stories")
post("/courses/{course_id}/admin/stories")

summary("Creates a new story")

Expand All @@ -65,7 +65,7 @@ defmodule CadetWeb.AdminStoriesController do
end

swagger_path :delete do
PhoenixSwagger.Path.delete("/v2/courses/{course_id}/stories/{storyId}")
PhoenixSwagger.Path.delete("/courses/{course_id}/admin/stories/{storyId}")

summary("Delete a story from database by id")

Expand All @@ -81,7 +81,7 @@ defmodule CadetWeb.AdminStoriesController do
end

swagger_path :update do
post("/v2/courses/{course_id}/stories/{storyId}")
post("/courses/{course_id}/admin/stories/{storyId}")

summary("Update details regarding a story")

Expand Down
12 changes: 6 additions & 6 deletions lib/cadet_web/admin_controllers/admin_user_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ defmodule CadetWeb.AdminUserController do
end

swagger_path :index do
get("/v2/courses/{course_id}/admin/users")
get("/courses/{course_id}/admin/users")

summary("Returns a list of users in the course owned by the admin")

Expand All @@ -190,7 +190,7 @@ defmodule CadetWeb.AdminUserController do
end

swagger_path :combined_total_xp do
get("/v2/courses/{course_id}/admin/users/{course_reg_id}/total_xp")
get("/courses/{course_id}/admin/users/{course_reg_id}/total_xp")

summary("Get the specified user's total XP from achievements and assessments")

Expand All @@ -206,8 +206,8 @@ defmodule CadetWeb.AdminUserController do
response(401, "Unauthorised")
end

swagger_path :add_users do
put("/v2/courses/{course_id}/admin/users")
swagger_path :upsert_users_and_groups do
put("/courses/{course_id}/admin/users")

summary("Adds the list of usernames and roles to the course")
security([%{JWT: []}])
Expand All @@ -228,7 +228,7 @@ defmodule CadetWeb.AdminUserController do
end

swagger_path :update_role do
put("/v2/courses/{course_id}/admin/users/role")
put("/courses/{course_id}/admin/users/{course_reg_id}/role")

summary("Updates the role of the given user in the the course")
security([%{JWT: []}])
Expand Down Expand Up @@ -257,7 +257,7 @@ defmodule CadetWeb.AdminUserController do
end

swagger_path :delete_user do
delete("/v2/courses/{course_id}/admin/users")
delete("/courses/{course_id}/admin/users/{course_reg_id}")

summary("Deletes a user from a course")
consumes("application/json")
Expand Down
8 changes: 4 additions & 4 deletions lib/cadet_web/controllers/assessments_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ defmodule CadetWeb.AssessmentsController do
end

swagger_path :submit do
post("/assessments/{assessmentId}/submit")
post("/courses/{course_id}/assessments/{assessmentId}/submit")
summary("Finalise submission for an assessment")
security([%{JWT: []}])

Expand All @@ -84,7 +84,7 @@ defmodule CadetWeb.AssessmentsController do
end

swagger_path :index do
get("/assessments")
get("/courses/{course_id}/assessments")

summary("Get a list of all assessments")

Expand All @@ -97,7 +97,7 @@ defmodule CadetWeb.AssessmentsController do
end

swagger_path :show do
get("/assessments/{assessmentId}")
get("/courses/{course_id}/assessments/{assessmentId}")

summary("Get information about one particular assessment")

Expand All @@ -116,7 +116,7 @@ defmodule CadetWeb.AssessmentsController do
end

swagger_path :unlock do
post("/assessments/{assessmentId}/unlock")
post("/courses/{course_id}/assessments/{assessmentId}/unlock")

summary("Unlocks a password-protected assessment and returns its information")

Expand Down
6 changes: 3 additions & 3 deletions lib/cadet_web/controllers/courses_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ defmodule CadetWeb.CoursesController do
end

swagger_path :create do
post("/v2/config/create")
post("/config/create")

summary("Creates a new course")

Expand All @@ -65,8 +65,8 @@ defmodule CadetWeb.CoursesController do
end
end

swagger_path :get_course_config do
get("/v2/courses/{course_id}/config")
swagger_path :index do
get("/courses/{course_id}/config")

summary("Retrieves the course configuration of the specified course")

Expand Down
6 changes: 3 additions & 3 deletions lib/cadet_web/controllers/incentives_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ defmodule CadetWeb.IncentivesController do
end

swagger_path :index_achievements do
get("/achievements")
get("/courses/{course_id}/achievements")

summary("Gets achievements")
security([%{JWT: []}])
Expand All @@ -49,7 +49,7 @@ defmodule CadetWeb.IncentivesController do
end

swagger_path :index_goals do
get("/self/goals")
get("/courses/{course_id}/self/goals")

summary("Gets goals, including user's progress")
security([%{JWT: []}])
Expand All @@ -59,7 +59,7 @@ defmodule CadetWeb.IncentivesController do
end

swagger_path :update_progress do
post("/self/goals/{uuid}/progress")
post("/courses/{course_id}/self/goals/{uuid}/progress")

summary("Inserts or updates own goal progress of specifed goal")
security([%{JWT: []}])
Expand Down
4 changes: 2 additions & 2 deletions lib/cadet_web/controllers/notifications_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ defmodule CadetWeb.NotificationsController do
end

swagger_path :index do
get("/v2/courses/{course_id}/notifications")
get("/courses/{course_id}/notifications")

summary("Get the unread notifications belonging to a user")

Expand All @@ -52,7 +52,7 @@ defmodule CadetWeb.NotificationsController do
end

swagger_path :acknowledge do
post("/v2/courses/{course_id}/notifications/acknowledge")
post("/courses/{course_id}/notifications/acknowledge")
summary("Acknowledge notification(s)")
security([%{JWT: []}])

Expand Down
2 changes: 1 addition & 1 deletion lib/cadet_web/controllers/sourcecast_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ defmodule CadetWeb.SourcecastController do
# end

swagger_path :index do
get("/sourcecast")
get("/courses/{course_id}/sourcecast")
description("Lists all sourcecasts")
summary("Show all sourcecasts")
produces("application/json")
Expand Down
2 changes: 1 addition & 1 deletion lib/cadet_web/controllers/stories_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ defmodule CadetWeb.StoriesController do
end

swagger_path :index do
get("/v2/courses/{course_id}/stories")
get("/courses/{course_id}/stories")

summary("Get a list of all stories")

Expand Down
Loading
Loading