feat(profile): implement protected skin upload endpoint
This commit is contained in:
@@ -157,3 +157,22 @@ func (r *UserRepository) ValidateAccessToken(ctx context.Context, token string,
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// UpdateSkinHash обновляет хеш скина для пользователя.
|
||||
func (r *UserRepository) UpdateSkinHash(ctx context.Context, userID int, skinHash string) error {
|
||||
query := "UPDATE profiles SET skin_hash = $1, updated_at = NOW() WHERE user_id = $2"
|
||||
result, err := r.DB.ExecContext(ctx, query, skinHash, userID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
rowsAffected, err := result.RowsAffected()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if rowsAffected == 0 {
|
||||
return ErrUserNotFound // Если профиль для user_id не найден
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user