Skip to content

Feat/applications enabled#47

Open
anishalle wants to merge 8 commits intomainfrom
feat/applications_enabled
Open

Feat/applications enabled#47
anishalle wants to merge 8 commits intomainfrom
feat/applications_enabled

Conversation

@anishalle
Copy link
Collaborator

NEW PR alert.

GET request for hackers.
POST request for superadmins

@anishalle anishalle linked an issue Mar 5, 2026 that may be closed by this pull request
}

if err = app.jsonResponse(w, http.StatusOK, response); err != nil {
app.internalServerError(w, r, err)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a return


enabled, err = app.store.Application.SetApplicationsEnabled(r.Context(), enabled)
if err != nil {
app.internalServerError(w, r, err)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a return

}

if err = app.jsonResponse(w, http.StatusOK, response); err != nil {
app.internalServerError(w, r, err)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another return here

}
}
},
"/superadmin/settings/hackathon-date-range": {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like some endpoints were deleted make sure to generate the docs before PR

Count int `json:"count"`
}

type ApplicationsEnabledResponse struct {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get and set response are the same struct just keep them as one ApplicationsEnabledResponse

// @Success 200 {object} UserResponse
// @Failure 401 {object} object{error=string}
// @Router /auth/me [get]
// @Summary Get current user
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ugh this is an issue were consistently having I'll standardize it to be tabs in the future. This is good tho

// @Failure 500 {object} object{error=string}
// @Security CookieAuth
// @Router /applications/enabled [get]
func (app *application) getApplicationsEnabled(w http.ResponseWriter, r *http.Request) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move these handlers to settings.go

@@ -0,0 +1,2 @@
INSERT INTO settings (key, value) VALUES ('applications_enabled', 'true'::jsonb)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure migrations are numbered correctly. There shouldn't be 4 up down migrations for 17. 1 up and 1 down per migration

r.Get("/me", app.getOrCreateApplicationHandler)
r.Patch("/me", app.updateApplicationHandler)
r.Post("/me/submit", app.submitApplicationHandler)
r.Get("/enabled", app.getApplicationsEnabled)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this to admin routes. gonna change implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

API: Applications open and close (GET /v1/applications/enabled)

2 participants