47 lines
941 B
Go
Raw Normal View History

package main
2017-07-12 18:37:34 +00:00
import (
2019-04-23 05:45:17 +00:00
"github.com/akyoto/color"
2019-06-03 09:32:43 +00:00
"github.com/animenotifier/notify.moe/arn"
2017-07-12 18:37:34 +00:00
)
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-17 00:07:54 +00:00
emailToUser := arn.DB.Collection("EmailToUser")
testRecord, _ := emailToUser.Get("e.urbach@gmail.com")
emailToUser.Clear()
emailToUser.Set("e.urbach@gmail.com", testRecord)
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 = ""
2019-03-30 08:04:21 +00:00
user.Accounts.Twitter.ID = ""
user.Accounts.Twitter.Nick = ""
2018-04-08 10:59:36 +00:00
user.Location = &arn.Location{}
2018-11-06 09:28:50 +00:00
user.BirthDay = ""
2017-07-12 18:37:34 +00:00
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.")
}