-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Summary
Add a POST /v1/superadmin/reset-hackathon endpoint (super_admin only) that performs a complete database reset while preserving users. This is needed for resetting the system after a hackathon ends or after QA testing before a new event.
Requirements
Backend API Endpoint
POST /v1/superadmin/reset-hackathon— under the existing superadmin route group withRequireRoleMiddleware(RoleSuperAdmin)- Register the route in
cmd/api/api.gowithin the/v1/superadmin/router group - Accepts a JSON body with granular reset options (checklist):
reset_applications(bool) — truncatesapplicationstable (CASCADE deletesapplication_reviews)reset_scans(bool) — truncatesscanstablereset_schedule(bool) — truncatesscheduletablereset_settings(bool) — resetsscan_statsto{}andreview_assignment_toggleto[]
- All operations run in a single transaction
- Log who triggered the reset and what was reset (audit trail)
- If
reset_applicationsis true, also handle cleanup of uploaded resume files from storage (S3/local) - Return success/failure response with details of what was reset
Frontend (Admin Dashboard)
- Add a "Reset Hackathon" button in the super_admin settings/dashboard area
- Show a confirmation dialog that:
- Lists exactly what will be deleted with checkboxes for granular control
- Requires typing a confirmation phrase (e.g., "RESET HACKATHON") to prevent accidental resets
- Shows warning about irreversibility
- Display success/error toast after the operation
Database Considerations
applicationsCASCADE deletesapplication_reviewsautomaticallyuserstable is never touchedsettingstable is selectively reset (stats/toggles only), not truncatedshort_answer_questionsandscan_typessettings should be preserved (default: preserve)
Testing
- Add handler tests for the reset endpoint
- Test transaction rollback on partial failure
- Test authorization (only super_admin can access)
Implementation Notes
- Route file:
cmd/api/api.go— add to the existingr.Route("/v1/superadmin", ...)group - Middleware:
AuthRequiredMiddleware→RequireRoleMiddleware(RoleSuperAdmin)(already applied to superadmin group) - Follow existing patterns for handler, store method, and request/response types
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request