41 lines
733 B
Go
Raw Normal View History

package main
2017-07-12 18:37:34 +00:00
import (
"github.com/animenotifier/arn"
"github.com/fatih/color"
)
func main() {
2017-07-12 18:37:34 +00:00
color.Yellow("Deleting private user data")
2017-11-01 19:11:05 +00:00
defer arn.Node.Close()
2017-07-12 18:37:34 +00:00
2017-11-01 19:11:05 +00:00
arn.DB.Clear("EmailToUser")
2017-07-12 18:37:34 +00:00
// Iterate over the stream
count := 0
2017-11-01 19:11:05 +00:00
for user := range arn.StreamUsers() {
2017-07-12 18:37:34 +00:00
count++
println(count, user.Nick)
// Delete private data
user.Email = ""
user.Gender = ""
user.FirstName = ""
user.LastName = ""
user.IP = ""
user.Accounts.Facebook.ID = ""
user.Accounts.Google.ID = ""
user.AgeRange = arn.UserAgeRange{}
user.Location = arn.UserLocation{}
2017-11-05 15:50:32 +00:00
user.PushSubscriptions().Items = []*arn.PushSubscription{}
user.PushSubscriptions().Save()
2017-07-12 18:37:34 +00:00
// Save in DB
user.Save()
}
color.Green("Finished.")
}