account working

This commit is contained in:
José Salazar
2026-01-26 13:57:04 -05:00
parent 42a11590f1
commit 1934d4caab
13 changed files with 19419 additions and 19282 deletions

View File

@@ -95,6 +95,8 @@ class AuthRepositoryImpl implements AuthRepositoryInterface {
).execute();
final GetUserByIdUser? user = response.data.user;
GetStaffByUserIdStaffs? staffRecord;
if (mode == AuthMode.signup) {
if (user == null) {
await dataConnect
@@ -140,6 +142,7 @@ class AuthRepositoryImpl implements AuthRepositoryInterface {
'Your account is not registered yet. Please register first.',
);
}
staffRecord = staffResponse.data.staffs.first;
}
final String email = user?.email ?? '';
@@ -152,8 +155,21 @@ class AuthRepositoryImpl implements AuthRepositoryInterface {
phone: firebaseUser.phoneNumber,
role: user?.role.stringValue ?? 'USER',
);
final domain.Staff? domainStaff = staffRecord == null
? null
: domain.Staff(
id: staffRecord.id,
authProviderId: staffRecord.userId,
name: staffRecord.fullName,
email: staffRecord.email ?? '',
phone: staffRecord.phone,
status: domain.StaffStatus.completedProfile,
address: staffRecord.addres,
avatar: staffRecord.photoUrl,
livePhoto: null,
);
StaffSessionStore.instance.setSession(
StaffSession(user: domainUser, staff: null),
StaffSession(user: domainUser, staff: domainStaff),
);
return domainUser;
}