35 lines
915 B
Go
35 lines
915 B
Go
package entity
|
|
|
|
import "time"
|
|
|
|
// Deleted is a snapshot of a canceled account, persisted in user_delete.
|
|
type Deleted struct {
|
|
ID int64
|
|
SparkID string
|
|
Nickname string
|
|
Avatar string
|
|
QRCode string
|
|
Birthday time.Time
|
|
Gender Gender
|
|
Status Status
|
|
Email string
|
|
LastLoginAt time.Time
|
|
LastActiveAt time.Time
|
|
CreatedAt time.Time
|
|
UpdatedAt time.Time
|
|
DeletedAt time.Time
|
|
}
|
|
|
|
// SnapshotDeleted copies a live account into an archive row.
|
|
func SnapshotDeleted(u *User, email string, at time.Time) *Deleted {
|
|
if u == nil {
|
|
return nil
|
|
}
|
|
return &Deleted{
|
|
ID: u.ID, SparkID: u.SparkID, Nickname: u.Nickname, Avatar: u.Avatar, QRCode: u.QRCode,
|
|
Birthday: u.Birthday, Gender: u.Gender, Status: u.Status, Email: email,
|
|
LastLoginAt: u.LastLoginAt, LastActiveAt: u.LastActiveAt,
|
|
CreatedAt: u.CreatedAt, UpdatedAt: u.UpdatedAt, DeletedAt: at,
|
|
}
|
|
}
|