add user be handlers
This commit is contained in:
		@ -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)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -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)
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user