Skip to content

Commit

Permalink
Find-replace galore
Browse files Browse the repository at this point in the history
  • Loading branch information
josh1248 committed Sep 8, 2024
1 parent 18dc689 commit e77aa05
Show file tree
Hide file tree
Showing 19 changed files with 89 additions and 83 deletions.
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("/courses/{course_id}/admin/achievements/{uuid}")
put("/courses/{course_id}/staff/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("/courses/{course_id}/admin/achievements")
put("/courses/{course_id}/staff/achievements")

summary("Inserts or updates achievements")

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

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

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

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

summary("Fetches assessment overviews of a user")

Expand Down Expand Up @@ -270,7 +270,7 @@ defmodule CadetWeb.AdminAssessmentsController do
end

swagger_path :get_popular_leaderboard do
get("/courses/{course_id}/admin/assessments/:assessmentid/popularVoteLeaderboard")
get("/courses/{course_id}/staff/assessments/:assessmentid/popularVoteLeaderboard")

summary("get the top 10 contest entries based on popularity")

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

swagger_path :get_score_leaderboard do
get("/courses/{course_id}/admin/assessments/:assessmentid/scoreLeaderboard")
get("/courses/{course_id}/staff/assessments/:assessmentid/scoreLeaderboard")

summary("get the top 10 contest entries based on score")

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

case Assets.delete_object(Courses.assets_prefix(course_reg.course), foldername, filename) do
{:error, {status, message}} -> conn |> put_status(status) |> text(message)
_ -> conn |> put_status(204) |> text('')
_ -> conn |> put_status(204) |> text(~c"")
end
end

Expand Down Expand Up @@ -71,7 +71,7 @@ defmodule CadetWeb.AdminAssetsController do
end

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

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

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

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

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

parameters do
folderName(:path, :string, "Folder name", required: true)

fileName(:path, :string, "File path in folder, which may contain subfolders", required: true)
fileName(:path, :string, "File path in folder, which may contain subfolders",
required: true
)
end

security([%{JWT: []}])
Expand All @@ -108,14 +110,16 @@ defmodule CadetWeb.AdminAssetsController do
end

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

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

parameters do
folderName(:path, :string, "Folder name", required: true)

fileName(:path, :string, "File path in folder, which may contain subfolders", required: true)
fileName(:path, :string, "File path in folder, which may contain subfolders",
required: true
)
end

security([%{JWT: []}])
Expand Down
12 changes: 6 additions & 6 deletions lib/cadet_web/admin_controllers/admin_goals_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ defmodule CadetWeb.AdminGoalsController do
end

swagger_path :index do
get("/admin/goals")
get("/staff/goals")

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

swagger_path :index_goals_with_progress do
get("/admin/goals/{courseRegId}")
get("/staff/goals/{courseRegId}")

summary("Gets goals and goal progress of a user")
security([%{JWT: []}])
Expand All @@ -113,7 +113,7 @@ defmodule CadetWeb.AdminGoalsController do
end

swagger_path :update do
put("/admin/goals/{uuid}")
put("/staff/goals/{uuid}")

summary("Inserts or updates a goal")

Expand All @@ -136,7 +136,7 @@ defmodule CadetWeb.AdminGoalsController do
end

swagger_path :bulk_update do
put("/admin/goals")
put("/staff/goals")

summary("Inserts or updates goals")

Expand All @@ -157,7 +157,7 @@ defmodule CadetWeb.AdminGoalsController do
end

swagger_path :update_progress do
post("/admin/users/{courseRegId}/goals/{uuid}/progress")
post("/staff/users/{courseRegId}/goals/{uuid}/progress")

summary("Inserts or updates own goal progress of specifed goal")
security([%{JWT: []}])
Expand All @@ -180,7 +180,7 @@ defmodule CadetWeb.AdminGoalsController do
end

swagger_path :delete do
PhoenixSwagger.Path.delete("/admin/goals/{uuid}")
PhoenixSwagger.Path.delete("/staff/goals/{uuid}")

summary("Deletes a goal")
security([%{JWT: []}])
Expand Down
18 changes: 10 additions & 8 deletions lib/cadet_web/admin_controllers/admin_grading_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ defmodule CadetWeb.AdminGradingController do
end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Expand Down Expand Up @@ -330,7 +330,9 @@ defmodule CadetWeb.AdminGradingController do
required: true
)

student(Schema.ref(:StudentInfo), "Student who created the submission", required: true)
student(Schema.ref(:StudentInfo), "Student who created the submission",
required: true
)

unsubmittedBy(Schema.ref(:GraderInfo))
unsubmittedAt(:string, "Last unsubmitted at", format: "date-time", required: false)
Expand Down
12 changes: 6 additions & 6 deletions lib/cadet_web/admin_controllers/admin_stories_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ defmodule CadetWeb.AdminStoriesController do

case result do
{:ok, _story} ->
conn |> put_status(200) |> text('')
conn |> put_status(200) |> text(~c"")

{:error, {status, message}} ->
conn
Expand All @@ -29,7 +29,7 @@ defmodule CadetWeb.AdminStoriesController do

case result do
{:ok, _story} ->
conn |> put_status(200) |> text('')
conn |> put_status(200) |> text(~c"")

{:error, {status, message}} ->
conn
Expand All @@ -43,7 +43,7 @@ defmodule CadetWeb.AdminStoriesController do

case result do
{:ok, _nil} ->
conn |> put_status(204) |> text('')
conn |> put_status(204) |> text(~c"")

{:error, {status, message}} ->
conn
Expand All @@ -53,7 +53,7 @@ defmodule CadetWeb.AdminStoriesController do
end

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

summary("Creates a new story")

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

swagger_path :delete do
PhoenixSwagger.Path.delete("/courses/{course_id}/admin/stories/{storyId}")
PhoenixSwagger.Path.delete("/courses/{course_id}/staff/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("/courses/{course_id}/admin/stories/{storyId}")
post("/courses/{course_id}/staff/stories/{storyId}")

summary("Update details regarding a story")

Expand Down
8 changes: 4 additions & 4 deletions lib/cadet_web/admin_controllers/admin_teams_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ defmodule CadetWeb.AdminTeamsController do
end

swagger_path :index do
get("/admin/teams")
get("/staff/teams")

summary("Fetches every team in the course")

Expand All @@ -110,7 +110,7 @@ defmodule CadetWeb.AdminTeamsController do
end

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

summary("Creates a new team")

Expand All @@ -130,7 +130,7 @@ defmodule CadetWeb.AdminTeamsController do
end

swagger_path :update do
post("/courses/{course_id}/admin/teams/{teamId}")
post("/courses/{course_id}/staff/teams/{teamId}")

summary("Updates an existing team")

Expand All @@ -152,7 +152,7 @@ defmodule CadetWeb.AdminTeamsController do
end

swagger_path :delete do
PhoenixSwagger.Path.delete("/courses/{course_id}/admin/teams/{teamId}")
PhoenixSwagger.Path.delete("/courses/{course_id}/staff/teams/{teamId}")

summary("Deletes an existing team")

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

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

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

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

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

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

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

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

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

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

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

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

summary("Deletes a user from a course")
consumes("application/json")
Expand Down
2 changes: 1 addition & 1 deletion lib/cadet_web/controllers/team_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ defmodule CadetWeb.TeamController do
end

swagger_path :index do
get("/admin/teams")
get("/staff/teams")

summary("Fetches team formation overview based on assessment ID")

Expand Down
Loading

0 comments on commit e77aa05

Please sign in to comment.