Feat: Add development bootstrap reset
This commit is contained in:
@@ -166,6 +166,28 @@ func (routes apiRoutes) handleAppShellState(w http.ResponseWriter, r *http.Reque
|
||||
})
|
||||
}
|
||||
|
||||
func (routes apiRoutes) handleDevelopmentBootstrapReset(w http.ResponseWriter, r *http.Request) {
|
||||
if !routes.cfg.Config.IsDevelopment() {
|
||||
WriteError(w, http.StatusNotFound, RequestIDFromContext(r.Context()), "not_found", "The requested endpoint does not exist.")
|
||||
return
|
||||
}
|
||||
|
||||
if err := routes.bootstrapService().ResetDevelopmentState(r.Context()); err != nil {
|
||||
routes.writeBootstrapPersistenceError(w, r, err)
|
||||
return
|
||||
}
|
||||
|
||||
WriteJSON(w, http.StatusOK, map[string]any{
|
||||
"data": map[string]any{
|
||||
"reset": true,
|
||||
},
|
||||
"meta": map[string]any{
|
||||
"resource": "development-bootstrap-reset",
|
||||
"developmentOnly": true,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func (routes apiRoutes) handleBootstrapInstanceStep(w http.ResponseWriter, r *http.Request) {
|
||||
payload, ok := decodeBootstrapRequest[bootstrapInstanceStepRequest](w, r)
|
||||
if !ok {
|
||||
|
||||
@@ -33,6 +33,10 @@ func (routes apiRoutes) Register(router chi.Router) {
|
||||
apiRouter.Get("/app-shell", routes.handleAppShellState)
|
||||
apiRouter.Get("/organizations", routes.handleOrganizations)
|
||||
apiRouter.Get("/workspaces", routes.handleWorkspaces)
|
||||
|
||||
if routes.cfg.Config.IsDevelopment() {
|
||||
apiRouter.Post("/dev/bootstrap/reset", routes.handleDevelopmentBootstrapReset)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user