user and database administration

This commit is contained in:
Steve White 2024-10-17 00:08:28 -05:00
parent 9bdcc1f7db
commit 6660c1e3b3
2 changed files with 2 additions and 1 deletions

View File

@ -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"})
}

BIN
test.db

Binary file not shown.