1
+ import 'package:ht_api/src/services/auth_token_service.dart' ;
2
+ import 'package:ht_api/src/services/verification_code_storage_service.dart' ;
1
3
import 'package:ht_data_repository/ht_data_repository.dart' ;
2
4
import 'package:ht_email_repository/ht_email_repository.dart' ;
3
5
import 'package:ht_shared/ht_shared.dart' ;
4
6
import 'package:uuid/uuid.dart' ;
5
7
6
- import 'package:ht_api/src/services/auth_token_service.dart' ;
7
- import 'package:ht_api/src/services/verification_code_storage_service.dart' ;
8
-
9
8
/// {@template auth_service}
10
9
/// Service responsible for orchestrating authentication logic on the backend.
11
10
///
@@ -82,7 +81,8 @@ class AuthService {
82
81
// Consider distinguishing between expired and simply incorrect codes
83
82
// For now, treat both as invalid input.
84
83
throw const InvalidInputException (
85
- 'Invalid or expired verification code.' ,);
84
+ 'Invalid or expired verification code.' ,
85
+ );
86
86
}
87
87
88
88
// 2. Find or create the user
@@ -112,7 +112,8 @@ class AuthService {
112
112
} on HtHttpException catch (e) {
113
113
print ('Error finding/creating user for $email : $e ' );
114
114
throw const OperationFailedException (
115
- 'Failed to find or create user account.' ,);
115
+ 'Failed to find or create user account.' ,
116
+ );
116
117
} catch (e) {
117
118
print ('Unexpected error during user lookup/creation for $email : $e ' );
118
119
throw const OperationFailedException ('Failed to process user account.' );
@@ -126,7 +127,8 @@ class AuthService {
126
127
} catch (e) {
127
128
print ('Error generating token for user ${user .id }: $e ' );
128
129
throw const OperationFailedException (
129
- 'Failed to generate authentication token.' ,);
130
+ 'Failed to generate authentication token.' ,
131
+ );
130
132
}
131
133
}
132
134
@@ -152,7 +154,8 @@ class AuthService {
152
154
} catch (e) {
153
155
print ('Unexpected error during anonymous user creation: $e ' );
154
156
throw const OperationFailedException (
155
- 'Failed to process anonymous sign-in.' ,);
157
+ 'Failed to process anonymous sign-in.' ,
158
+ );
156
159
}
157
160
158
161
// 2. Generate token
@@ -163,7 +166,8 @@ class AuthService {
163
166
} catch (e) {
164
167
print ('Error generating token for anonymous user ${user .id }: $e ' );
165
168
throw const OperationFailedException (
166
- 'Failed to generate authentication token.' ,);
169
+ 'Failed to generate authentication token.' ,
170
+ );
167
171
}
168
172
}
169
173
0 commit comments