Skip to content

Commit

Permalink
Less computations needed
Browse files Browse the repository at this point in the history
  • Loading branch information
COMTOP1 committed Aug 10, 2024
1 parent 8fcec55 commit f5d6e60
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions user/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,13 +328,15 @@ func (s *Store) SetUserLoggedIn(ctx context.Context, u User) error {
// DeleteUser will soft delete a user
func (s *Store) DeleteUser(ctx context.Context, u User, userID int) error {
now := null.TimeFrom(time.Now())
id := null.IntFrom(int64(userID))
blank := null.NewString("", true)

u.Enabled = false
u.Password = null.NewString("", true)
u.Salt = null.NewString("", true)
u.UpdatedBy = null.IntFrom(int64(userID))
u.Password = blank
u.Salt = blank
u.UpdatedBy = id
u.UpdatedAt = now
u.DeletedBy = null.IntFrom(int64(userID))
u.DeletedBy = id
u.DeletedAt = now

return s.editUser(ctx, u)
Expand Down

0 comments on commit f5d6e60

Please sign in to comment.