Skip to content

Commit c98bc5f

Browse files
committed
lint: misc
1 parent 980324a commit c98bc5f

File tree

6 files changed

+27
-25
lines changed

6 files changed

+27
-25
lines changed

lib/src/config/environment_config.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import 'dart:io';
2-
import 'package:logging/logging.dart';
31
import 'package:dotenv/dotenv.dart';
2+
import 'package:logging/logging.dart';
43

54
/// {@template environment_config}
65
/// A utility class for accessing environment variables.

lib/src/services/auth_service.dart

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -531,22 +531,20 @@ class AuthService {
531531
}
532532

533533
// 3. Clear any pending sign-in codes for the user's email (if they had one).
534-
if (userToDelete.email != null) {
535-
try {
536-
await _verificationCodeStorageService.clearSignInCode(
537-
userToDelete.email!,
538-
);
539-
_log.info(
540-
'Cleared sign-in code for email ${userToDelete.email}.',
541-
);
542-
} catch (e) {
543-
// Log but don't fail deletion if clearing codes fails
544-
_log.warning(
545-
'Warning: Failed to clear sign-in code for email ${userToDelete.email}: $e',
546-
);
547-
}
534+
try {
535+
await _verificationCodeStorageService.clearSignInCode(
536+
userToDelete.email,
537+
);
538+
_log.info(
539+
'Cleared sign-in code for email ${userToDelete.email}.',
540+
);
541+
} catch (e) {
542+
// Log but don't fail deletion if clearing codes fails
543+
_log.warning(
544+
'Warning: Failed to clear sign-in code for email ${userToDelete.email}: $e',
545+
);
548546
}
549-
547+
550548
// TODO(fulleni): Add logic here to delete or anonymize other
551549
// user-related data (e.g., settings, content) from other repositories
552550
// once those features are implemented.

lib/src/services/database_seeding_service.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ class DatabaseSeedingService {
224224
// `headquarters_country_id` column and then remove the original
225225
// nested object from the parameters to avoid a "superfluous
226226
// variable" error.
227-
params['headquarters_country_id'] = source.headquarters?.id;
227+
params['headquarters_country_id'] = source.headquarters.id;
228228
params.remove('headquarters');
229229

230230
// Ensure optional fields exist for the postgres driver.

lib/src/services/default_user_preference_limit_service.dart

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'package:ht_api/src/services/user_preference_limit_service.dart';
22
import 'package:ht_data_repository/ht_data_repository.dart';
33
import 'package:ht_shared/ht_shared.dart';
4+
import 'package:logging/logging.dart';
45

56
/// {@template default_user_preference_limit_service}
67
/// Default implementation of [UserPreferenceLimitService] that enforces limits
@@ -10,9 +11,12 @@ class DefaultUserPreferenceLimitService implements UserPreferenceLimitService {
1011
/// {@macro default_user_preference_limit_service}
1112
const DefaultUserPreferenceLimitService({
1213
required HtDataRepository<RemoteConfig> remoteConfigRepository,
13-
}) : _remoteConfigRepository = remoteConfigRepository;
14+
required Logger log,
15+
}) : _remoteConfigRepository = remoteConfigRepository,
16+
_log = log;
1417

1518
final HtDataRepository<RemoteConfig> _remoteConfigRepository;
19+
final Logger _log;
1620

1721
// Assuming a fixed ID for the RemoteConfig document
1822
static const String _remoteConfigId = 'remote_config';
@@ -67,7 +71,9 @@ class DefaultUserPreferenceLimitService implements UserPreferenceLimitService {
6771
rethrow;
6872
} catch (e) {
6973
// Catch unexpected errors
70-
print('Error checking limit for user ${user.id}, itemType $itemType: $e');
74+
_log.severe(
75+
'Error checking limit for user ${user.id}, itemType $itemType: $e',
76+
);
7177
throw const OperationFailedException(
7278
'Failed to check user preference limits.',
7379
);
@@ -139,7 +145,7 @@ class DefaultUserPreferenceLimitService implements UserPreferenceLimitService {
139145
rethrow;
140146
} catch (e) {
141147
// Catch unexpected errors
142-
print('Error checking update limits for user ${user.id}: $e');
148+
_log.severe('Error checking update limits for user ${user.id}: $e');
143149
throw const OperationFailedException(
144150
'Failed to check user preference update limits.',
145151
);

lib/src/services/token_blacklist_service.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import 'dart:async';
22

33
import 'package:ht_shared/ht_shared.dart';
4-
import 'package:meta/meta.dart';
54
import 'package:logging/logging.dart';
5+
import 'package:meta/meta.dart';
66

77
/// {@template token_blacklist_service}
88
/// Defines the interface for a service that manages a blacklist of
@@ -51,8 +51,7 @@ class InMemoryTokenBlacklistService implements TokenBlacklistService {
5151
/// - [cleanupInterval]: How often the service checks for and removes
5252
/// expired token IDs. Defaults to 1 hour.
5353
InMemoryTokenBlacklistService({
54-
Duration cleanupInterval = const Duration(hours: 1),
55-
required Logger log,
54+
required Logger log, Duration cleanupInterval = const Duration(hours: 1),
5655
}) : _log = log {
5756
_cleanupTimer = Timer.periodic(cleanupInterval, (_) async {
5857
try {

routes/api/v1/data/index.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import '../../../_middleware.dart'; // Assuming RequestId is here
1212
String _camelToSnake(String input) {
1313
return input
1414
.replaceAllMapped(
15-
RegExp(r'(?<!^)(?=[A-Z])'),
15+
RegExp('(?<!^)(?=[A-Z])'),
1616
(match) => '_${match.group(0)}',
1717
)
1818
.toLowerCase();

0 commit comments

Comments
 (0)