Add client-side code to ask for feedback when uninstalling

This commit is contained in:
David Dworken
2022-11-16 21:54:05 -08:00
parent 48c77d88f7
commit d4efc62df1
4 changed files with 27 additions and 10 deletions

View File

@ -42,12 +42,6 @@ type UsageData struct {
Version string `json:"version"`
}
type Feedback struct {
UserId string `json:"user_id" gorm:"not null"`
Date time.Time `json:"date" gorm:"not null"`
Feedback string `json:"feedback"`
}
func getRequiredQueryParam(r *http.Request, queryParam string) string {
val := r.URL.Query().Get(queryParam)
if val == "" {
@ -404,7 +398,7 @@ func OpenDB() (*gorm.DB, error) {
db.AutoMigrate(&UsageData{})
db.AutoMigrate(&shared.DumpRequest{})
db.AutoMigrate(&shared.DeletionRequest{})
db.AutoMigrate(&Feedback{})
db.AutoMigrate(&shared.Feedback{})
db.Exec("PRAGMA journal_mode = WAL")
return db, nil
}
@ -620,7 +614,7 @@ func feedbackHandler(w http.ResponseWriter, r *http.Request) {
if err != nil {
panic(err)
}
var feedback Feedback
var feedback shared.Feedback
err = json.Unmarshal(data, &feedback)
if err != nil {
panic(fmt.Sprintf("feedbackHandler: body=%#v, err=%v", data, err))