user and database administration
This commit is contained in:
parent
9bdcc1f7db
commit
6660c1e3b3
3
admin.go
3
admin.go
|
@ -25,6 +25,7 @@ func CreateUserHandler(w http.ResponseWriter, r *http.Request) {
|
|||
http.Error(w, "Invalid request body", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
fmt.Println("creating user" + user.Username)
|
||||
db.Create(&user)
|
||||
json.NewEncoder(w).Encode(user)
|
||||
}
|
||||
|
@ -105,7 +106,7 @@ func RestoreDatabaseHandler(w http.ResponseWriter, r *http.Request) {
|
|||
http.Error(w, "Failed to switch to new database", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println("Database restored successfully")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
json.NewEncoder(w).Encode(map[string]string{"message": "Database restored successfully"})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue