You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Follow-up to PR #47 (resolves #31). Refactor the applications enabled toggle to use a middleware pattern, consistent with how AdminScheduleEditPermissionMiddleware gates schedule mutations.
Context
PR #47 introduced GET /v1/applications/enabled and POST /v1/superadmin/settings/applications-enabled to allow superadmins to toggle whether hackers can submit applications. Currently, the toggle exists but is not enforced on hacker mutation routes.
Tasks
Move handlers to settings.go — getApplicationsEnabled and setApplicationsEnabled are settings operations, not application CRUD. Move them to cmd/api/settings.go for consistency with other setting toggles (getReviewAssignmentToggle, getAdminScheduleEditToggle, getHackathonDateRange).
Create ApplicationsEnabledMiddleware in cmd/api/middlewares.go — Following the AdminScheduleEditPermissionMiddleware pattern:
Summary
Follow-up to PR #47 (resolves #31). Refactor the applications enabled toggle to use a middleware pattern, consistent with how
AdminScheduleEditPermissionMiddlewaregates schedule mutations.Context
PR #47 introduced
GET /v1/applications/enabledandPOST /v1/superadmin/settings/applications-enabledto allow superadmins to toggle whether hackers can submit applications. Currently, the toggle exists but is not enforced on hacker mutation routes.Tasks
Move handlers to
settings.go—getApplicationsEnabledandsetApplicationsEnabledare settings operations, not application CRUD. Move them tocmd/api/settings.gofor consistency with other setting toggles (getReviewAssignmentToggle,getAdminScheduleEditToggle,getHackathonDateRange).Create
ApplicationsEnabledMiddlewareincmd/api/middlewares.go— Following theAdminScheduleEditPermissionMiddlewarepattern:app.store.Application.GetApplicationsEnabled(ctx)403 Forbidden— "applications are currently closed"next.ServeHTTP(w, r)Apply middleware to hacker mutation routes in
cmd/api/api.go:Add tests for the middleware (see
cmd/api/schedule_test.gofor reference)Update Swagger docs if any response codes change
Blocked by
This issue should only be started after PR #47 is merged with any requested fixes.
Labels
enhancement, refactor