Skip to content

Commit

Permalink
Start redoing routes
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobWrenn committed Oct 19, 2024
1 parent 986aadd commit 2100eef
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 222 deletions.
2 changes: 2 additions & 0 deletions server/src/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { qrCodesApp } from "./qr-codes"
import { teamsApp } from "./teams"
import { userApp } from "./user"
import { usersApp } from "./users"
import { questsApp } from "./quests"

export const apiApp = new App<Request, Response>()

Expand Down Expand Up @@ -126,5 +127,6 @@ apiApp.use("/teams", teamsApp)
apiApp.use("/users", usersApp)
apiApp.use("/user", userApp)
apiApp.use("/discord", discordApp)
apiApp.use("/quests", questsApp)

apiApp.use(routeFallthroughHandler)
34 changes: 10 additions & 24 deletions server/src/routes/qr-codes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,44 +12,30 @@ qrCodesApp
.all(methodNotAllowed(["GET", "POST"]))
.get(qrCodesHandlers.getQRCodeList(), handleFailedAuthentication)
.post(qrCodesHandlers.createQRCode(), handleFailedAuthentication)

qrCodesApp
.route("/presets")
.all(methodNotAllowed(["GET", "POST"]))
.get(qrCodesHandlers.getPresetsList(), handleFailedAuthentication)
.post(qrCodesHandlers.createPreset(), handleFailedAuthentication)

qrCodesApp
.route("/presets/:preset_id")
.all(methodNotAllowed(["GET", "POST", "DELETE"]))
.get(qrCodesHandlers.getPresetDetails(), handleFailedAuthentication)
.post(qrCodesHandlers.usePreset(), handleFailedAuthentication)
.delete(qrCodesHandlers.deletePreset(), handleFailedAuthentication)


qrCodesApp
.route("/redeem")
.all(methodNotAllowed(["POST"]))
.post(qrCodesHandlers.redeemQR())

qrCodesApp
.route("/challenges/reorder")
.all(methodNotAllowed(["POST"]))
.post(qrCodesHandlers.reorderChallengeList(), handleFailedAuthentication)


qrCodesApp
.route("/challenges")
.all(methodNotAllowed(["GET", "POST"]))
.get(
qrCodesHandlers.getChallengeListAdmin(),
qrCodesHandlers.getChallengeListAsAnonymous(),
qrCodesHandlers.getChallengeList(),
handleFailedAuthentication,
)
.post(qrCodesHandlers.createChallenge(), handleFailedAuthentication)

qrCodesApp
.route("/challenges/:challenge_id")
.all(methodNotAllowed(["POST"]))
.all(parseRouteId("challenge_id"))
.post(qrCodesHandlers.useChallenge(), handleFailedAuthentication)

qrCodesApp
.route("/:qr_code_id")
.all(methodNotAllowed(["GET", "PATCH", "DELETE"]))
.all(parseRouteId("qr_code_id"))
.get(qrCodesHandlers.getQRCodeDetails(), handleFailedAuthentication)
.patch(qrCodesHandlers.patchQRCodeDetails(), handleFailedAuthentication)
.delete(qrCodesHandlers.deleteQRCode(), handleFailedAuthentication)

Loading

0 comments on commit 2100eef

Please sign in to comment.