Merge branch 'dev' of https://github.com/Oloodi/krow-workforce into feature/session-persistence-new

This commit is contained in:
2026-03-03 11:07:15 +05:30
39 changed files with 930 additions and 613 deletions

View File

@@ -96,10 +96,8 @@ class AuthRepositoryImpl implements AuthRepositoryInterface {
/// Signs out the current user.
@override
Future<void> signOut() {
StaffSessionStore.instance.clear();
_service.clearCache();
return _service.auth.signOut();
Future<void> signOut() async {
return await _service.signOut();
}
/// Verifies an OTP code and returns the authenticated user.
@@ -163,7 +161,7 @@ class AuthRepositoryImpl implements AuthRepositoryInterface {
if (staffResponse.data.staffs.isNotEmpty) {
// If profile exists, they should use Login mode.
await _service.auth.signOut();
await _service.signOut();
throw const domain.AccountExistsException(
technicalMessage:
'This user already has a staff profile. Please log in.',
@@ -185,14 +183,14 @@ class AuthRepositoryImpl implements AuthRepositoryInterface {
}
} else {
if (user == null) {
await _service.auth.signOut();
await _service.signOut();
throw const domain.UserNotFoundException(
technicalMessage: 'Authenticated user profile not found in database.',
);
}
// Allow STAFF or BOTH roles to log in to the Staff App
if (user.userRole != 'STAFF' && user.userRole != 'BOTH') {
await _service.auth.signOut();
await _service.signOut();
throw const domain.UnauthorizedAppException(
technicalMessage: 'User is not authorized for this app.',
);
@@ -206,7 +204,7 @@ class AuthRepositoryImpl implements AuthRepositoryInterface {
requiresAuthentication: false,
);
if (staffResponse.data.staffs.isEmpty) {
await _service.auth.signOut();
await _service.signOut();
throw const domain.UserNotFoundException(
technicalMessage:
'Your account is not registered yet. Please register first.',