fix(v0.12.6.1): update in-memory UserRepositoryImpl to accept context.Context

Aligns the in-memory implementation with the updated services.UserRepository
interface for consistency (HIGH-003 context propagation).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
senke 2026-03-12 05:47:47 +01:00
parent 24b29d229d
commit 01378a06a5

View file

@ -1,6 +1,7 @@
package repository
import (
"context"
"errors"
"sync"
@ -27,7 +28,7 @@ func NewUserRepository() *UserRepositoryImpl {
}
// GetByID récupère un utilisateur par son ID
func (r *UserRepositoryImpl) GetByID(id string) (*models.User, error) {
func (r *UserRepositoryImpl) GetByID(_ context.Context, id string) (*models.User, error) {
r.mutex.RLock()
defer r.mutex.RUnlock()
@ -42,7 +43,7 @@ func (r *UserRepositoryImpl) GetByID(id string) (*models.User, error) {
}
// GetByEmail récupère un utilisateur par son email
func (r *UserRepositoryImpl) GetByEmail(email string) (*models.User, error) {
func (r *UserRepositoryImpl) GetByEmail(_ context.Context, email string) (*models.User, error) {
r.mutex.RLock()
defer r.mutex.RUnlock()
@ -62,7 +63,7 @@ func (r *UserRepositoryImpl) GetByEmail(email string) (*models.User, error) {
}
// GetByUsername récupère un utilisateur par son username
func (r *UserRepositoryImpl) GetByUsername(username string) (*models.User, error) {
func (r *UserRepositoryImpl) GetByUsername(_ context.Context, username string) (*models.User, error) {
r.mutex.RLock()
defer r.mutex.RUnlock()
@ -82,7 +83,7 @@ func (r *UserRepositoryImpl) GetByUsername(username string) (*models.User, error
}
// Create crée un nouvel utilisateur
func (r *UserRepositoryImpl) Create(user *models.User) error {
func (r *UserRepositoryImpl) Create(_ context.Context, user *models.User) error {
r.mutex.Lock()
defer r.mutex.Unlock()
@ -116,7 +117,7 @@ func (r *UserRepositoryImpl) Create(user *models.User) error {
}
// Update met à jour un utilisateur existant
func (r *UserRepositoryImpl) Update(user *models.User) error {
func (r *UserRepositoryImpl) Update(_ context.Context, user *models.User) error {
r.mutex.Lock()
defer r.mutex.Unlock()
@ -158,7 +159,7 @@ func (r *UserRepositoryImpl) Update(user *models.User) error {
}
// Delete supprime un utilisateur
func (r *UserRepositoryImpl) Delete(id string) error {
func (r *UserRepositoryImpl) Delete(_ context.Context, id string) error {
r.mutex.Lock()
defer r.mutex.Unlock()