add user be handlers

This commit is contained in:
vinchent 2024-08-23 14:13:06 +02:00
parent d16793c01c
commit f39c000e5d
2 changed files with 11 additions and 0 deletions

View File

@ -702,3 +702,13 @@ func (app *application) CancelSubscription(w http.ResponseWriter, r *http.Reques
app.writeJSON(w, http.StatusOK, resp)
}
func (app *application) AllUsers(w http.ResponseWriter, r *http.Request) {
allUsers, err := app.DB.GetAllUsers()
if err != nil {
app.errorLog.Println(err)
app.badRequest(w, r, err)
return
}
app.writeJSON(w, http.StatusOK, allUsers)
}

View File

@ -37,6 +37,7 @@ func (app *application) routes() http.Handler {
mux.Post("/get-sale/{id}", app.GetSale)
mux.Post("/refund", app.RefundCharge)
mux.Post("/cancel-subscription", app.CancelSubscription)
mux.Post("/all-users", app.AllUsers)
})
mux.Post("/api/forgot-password", app.SendPasswordResetEmail)
mux.Post("/api/reset-password", app.ResetPassword)