tsk-34: Update last login of user (#37)

Closes #34

Reviewed-on: phoenix/textsender-auth#37
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
This commit is contained in:
phoenix
2025-12-31 23:13:02 +00:00
committed by phoenix
parent d34cad033d
commit de171b790d
10 changed files with 101 additions and 12 deletions
+21
View File
@@ -136,3 +136,24 @@ func (m *MockUserStore) UpdatePassword(ctx context.Context, id uuid.UUID, passwo
return 1, nil
}
func (m *MockUserStore) UpdateLastLogin(ctx context.Context, id uuid.UUID, lastLogin time.Time) (int64, error) {
m.mu.Lock()
defer m.mu.Unlock()
if m.Error != nil {
return 0, m.Error
}
user, exists := m.Users[id]
if !exists {
return 0, errors.New("User not found")
}
user.LastLogin = &lastLogin
m.Users[id] = user
m.UsersByUsername[user.Username] = user
return 1, nil
}