Skip to content

Commit

Permalink
set last_login_date of the current date
Browse files Browse the repository at this point in the history
  • Loading branch information
deinelieblings committed Sep 11, 2024
1 parent 19b89ff commit b2ec171
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions dao/updates.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ func UpdateDatabase() {
UpdateProfileBirthdate(ctx)
InsertUpdate(ctx, "birthdate_1")
}
if !CheckUpdated(ctx, "last_login_date_1") {
UpdateSetLastLoginDate(ctx)
InsertUpdate(ctx, "last_login_date_1")
}
}

func UpdateCrewMaibox(ctx context.Context) {
Expand Down Expand Up @@ -209,3 +213,10 @@ func UpdateProfileBirthdate(ctx context.Context) {
}
}
}

func UpdateSetLastLoginDate(ctx context.Context) {
update := bson.D{{Key: "last_login_date", Value: time.Now().Unix()}}
if err := UserCollection.UpdateMany(ctx, bson.D{{}}, vmdb.UpdateSet(update)); err != nil {
log.Print(err)
}
}

0 comments on commit b2ec171

Please sign in to comment.