Merge pull request #292 from Oloodi/staff_validations

Staff validations
This commit is contained in:
Achintha Isuru
2026-01-26 14:01:59 -05:00
committed by GitHub
35 changed files with 19918 additions and 19603 deletions

View File

@@ -24,3 +24,4 @@ export 'src/session/client_session_store.dart';
// Export the generated Data Connect SDK // Export the generated Data Connect SDK
export 'src/dataconnect_generated/generated.dart'; export 'src/dataconnect_generated/generated.dart';
export 'src/session/staff_session_store.dart';

View File

@@ -1,16 +1,16 @@
# Basic Usage # Basic Usage
```dart ```dart
ExampleConnector.instance.createTeamMember(createTeamMemberVariables).execute(); ExampleConnector.instance.createWorkforce(createWorkforceVariables).execute();
ExampleConnector.instance.updateTeamMember(updateTeamMemberVariables).execute(); ExampleConnector.instance.updateWorkforce(updateWorkforceVariables).execute();
ExampleConnector.instance.updateTeamMemberInviteStatus(updateTeamMemberInviteStatusVariables).execute(); ExampleConnector.instance.deactivateWorkforce(deactivateWorkforceVariables).execute();
ExampleConnector.instance.acceptInviteByCode(acceptInviteByCodeVariables).execute(); ExampleConnector.instance.listInvoices(listInvoicesVariables).execute();
ExampleConnector.instance.cancelInviteByCode(cancelInviteByCodeVariables).execute(); ExampleConnector.instance.getInvoiceById(getInvoiceByIdVariables).execute();
ExampleConnector.instance.deleteTeamMember(deleteTeamMemberVariables).execute(); ExampleConnector.instance.listInvoicesByVendorId(listInvoicesByVendorIdVariables).execute();
ExampleConnector.instance.listActivityLogs(listActivityLogsVariables).execute(); ExampleConnector.instance.listInvoicesByBusinessId(listInvoicesByBusinessIdVariables).execute();
ExampleConnector.instance.getActivityLogById(getActivityLogByIdVariables).execute(); ExampleConnector.instance.listInvoicesByOrderId(listInvoicesByOrderIdVariables).execute();
ExampleConnector.instance.listActivityLogsByUserId(listActivityLogsByUserIdVariables).execute(); ExampleConnector.instance.listInvoicesByStatus(listInvoicesByStatusVariables).execute();
ExampleConnector.instance.listUnreadActivityLogsByUserId(listUnreadActivityLogsByUserIdVariables).execute(); ExampleConnector.instance.filterInvoices(filterInvoicesVariables).execute();
``` ```
@@ -23,8 +23,8 @@ Optional fields can be discovered based on classes that have `Optional` object t
This is an example of a mutation with an optional field: This is an example of a mutation with an optional field:
```dart ```dart
await ExampleConnector.instance.getRapidOrders({ ... }) await ExampleConnector.instance.updateVendor({ ... })
.offset(...) .companyName(...)
.execute(); .execute();
``` ```

View File

@@ -6,11 +6,21 @@ class CreateAccountVariablesBuilder {
String last4; String last4;
Optional<bool> _isPrimary = Optional.optional(nativeFromJson, nativeToJson); Optional<bool> _isPrimary = Optional.optional(nativeFromJson, nativeToJson);
String ownerId; String ownerId;
Optional<String> _accountNumber = Optional.optional(nativeFromJson, nativeToJson);
Optional<String> _routeNumber = Optional.optional(nativeFromJson, nativeToJson);
final FirebaseDataConnect _dataConnect; CreateAccountVariablesBuilder isPrimary(bool? t) { final FirebaseDataConnect _dataConnect; CreateAccountVariablesBuilder isPrimary(bool? t) {
_isPrimary.value = t; _isPrimary.value = t;
return this; return this;
} }
CreateAccountVariablesBuilder accountNumber(String? t) {
_accountNumber.value = t;
return this;
}
CreateAccountVariablesBuilder routeNumber(String? t) {
_routeNumber.value = t;
return this;
}
CreateAccountVariablesBuilder(this._dataConnect, {required this.bank,required this.type,required this.last4,required this.ownerId,}); CreateAccountVariablesBuilder(this._dataConnect, {required this.bank,required this.type,required this.last4,required this.ownerId,});
Deserializer<CreateAccountData> dataDeserializer = (dynamic json) => CreateAccountData.fromJson(jsonDecode(json)); Deserializer<CreateAccountData> dataDeserializer = (dynamic json) => CreateAccountData.fromJson(jsonDecode(json));
@@ -20,7 +30,7 @@ class CreateAccountVariablesBuilder {
} }
MutationRef<CreateAccountData, CreateAccountVariables> ref() { MutationRef<CreateAccountData, CreateAccountVariables> ref() {
CreateAccountVariables vars= CreateAccountVariables(bank: bank,type: type,last4: last4,isPrimary: _isPrimary,ownerId: ownerId,); CreateAccountVariables vars= CreateAccountVariables(bank: bank,type: type,last4: last4,isPrimary: _isPrimary,ownerId: ownerId,accountNumber: _accountNumber,routeNumber: _routeNumber,);
return _dataConnect.mutation("createAccount", dataDeserializer, varsSerializer, vars); return _dataConnect.mutation("createAccount", dataDeserializer, varsSerializer, vars);
} }
} }
@@ -100,6 +110,8 @@ class CreateAccountVariables {
final String last4; final String last4;
late final Optional<bool>isPrimary; late final Optional<bool>isPrimary;
final String ownerId; final String ownerId;
late final Optional<String>accountNumber;
late final Optional<String>routeNumber;
@Deprecated('fromJson is deprecated for Variable classes as they are no longer required for deserialization.') @Deprecated('fromJson is deprecated for Variable classes as they are no longer required for deserialization.')
CreateAccountVariables.fromJson(Map<String, dynamic> json): CreateAccountVariables.fromJson(Map<String, dynamic> json):
@@ -116,6 +128,14 @@ class CreateAccountVariables {
isPrimary.value = json['isPrimary'] == null ? null : nativeFromJson<bool>(json['isPrimary']); isPrimary.value = json['isPrimary'] == null ? null : nativeFromJson<bool>(json['isPrimary']);
accountNumber = Optional.optional(nativeFromJson, nativeToJson);
accountNumber.value = json['accountNumber'] == null ? null : nativeFromJson<String>(json['accountNumber']);
routeNumber = Optional.optional(nativeFromJson, nativeToJson);
routeNumber.value = json['routeNumber'] == null ? null : nativeFromJson<String>(json['routeNumber']);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
@@ -131,11 +151,13 @@ class CreateAccountVariables {
type == otherTyped.type && type == otherTyped.type &&
last4 == otherTyped.last4 && last4 == otherTyped.last4 &&
isPrimary == otherTyped.isPrimary && isPrimary == otherTyped.isPrimary &&
ownerId == otherTyped.ownerId; ownerId == otherTyped.ownerId &&
accountNumber == otherTyped.accountNumber &&
routeNumber == otherTyped.routeNumber;
} }
@override @override
int get hashCode => Object.hashAll([bank.hashCode, type.hashCode, last4.hashCode, isPrimary.hashCode, ownerId.hashCode]); int get hashCode => Object.hashAll([bank.hashCode, type.hashCode, last4.hashCode, isPrimary.hashCode, ownerId.hashCode, accountNumber.hashCode, routeNumber.hashCode]);
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@@ -149,6 +171,12 @@ class CreateAccountVariables {
json['isPrimary'] = isPrimary.toJson(); json['isPrimary'] = isPrimary.toJson();
} }
json['ownerId'] = nativeToJson<String>(ownerId); json['ownerId'] = nativeToJson<String>(ownerId);
if(accountNumber.state == OptionalState.set) {
json['accountNumber'] = accountNumber.toJson();
}
if(routeNumber.state == OptionalState.set) {
json['routeNumber'] = routeNumber.toJson();
}
return json; return json;
} }
@@ -158,6 +186,8 @@ class CreateAccountVariables {
required this.last4, required this.last4,
required this.isPrimary, required this.isPrimary,
required this.ownerId, required this.ownerId,
required this.accountNumber,
required this.routeNumber,
}); });
} }

View File

@@ -15,6 +15,7 @@ class CreateStaffVariablesBuilder {
Optional<int> _cancellationCount = Optional.optional(nativeFromJson, nativeToJson); Optional<int> _cancellationCount = Optional.optional(nativeFromJson, nativeToJson);
Optional<int> _reliabilityScore = Optional.optional(nativeFromJson, nativeToJson); Optional<int> _reliabilityScore = Optional.optional(nativeFromJson, nativeToJson);
Optional<String> _bio = Optional.optional(nativeFromJson, nativeToJson); Optional<String> _bio = Optional.optional(nativeFromJson, nativeToJson);
Optional<AnyValue> _skills = Optional.optional(AnyValue.fromJson, defaultSerializer);
Optional<AnyValue> _industries = Optional.optional(AnyValue.fromJson, defaultSerializer); Optional<AnyValue> _industries = Optional.optional(AnyValue.fromJson, defaultSerializer);
Optional<AnyValue> _preferredLocations = Optional.optional(AnyValue.fromJson, defaultSerializer); Optional<AnyValue> _preferredLocations = Optional.optional(AnyValue.fromJson, defaultSerializer);
Optional<int> _maxDistanceMiles = Optional.optional(nativeFromJson, nativeToJson); Optional<int> _maxDistanceMiles = Optional.optional(nativeFromJson, nativeToJson);
@@ -83,6 +84,10 @@ class CreateStaffVariablesBuilder {
_bio.value = t; _bio.value = t;
return this; return this;
} }
CreateStaffVariablesBuilder skills(AnyValue? t) {
_skills.value = t;
return this;
}
CreateStaffVariablesBuilder industries(AnyValue? t) { CreateStaffVariablesBuilder industries(AnyValue? t) {
_industries.value = t; _industries.value = t;
return this; return this;
@@ -168,7 +173,7 @@ class CreateStaffVariablesBuilder {
} }
MutationRef<CreateStaffData, CreateStaffVariables> ref() { MutationRef<CreateStaffData, CreateStaffVariables> ref() {
CreateStaffVariables vars= CreateStaffVariables(userId: userId,fullName: fullName,level: _level,role: _role,phone: _phone,email: _email,photoUrl: _photoUrl,totalShifts: _totalShifts,averageRating: _averageRating,onTimeRate: _onTimeRate,noShowCount: _noShowCount,cancellationCount: _cancellationCount,reliabilityScore: _reliabilityScore,bio: _bio,industries: _industries,preferredLocations: _preferredLocations,maxDistanceMiles: _maxDistanceMiles,languages: _languages,itemsAttire: _itemsAttire,xp: _xp,badges: _badges,isRecommended: _isRecommended,ownerId: _ownerId,department: _department,hubId: _hubId,manager: _manager,english: _english,backgroundCheckStatus: _backgroundCheckStatus,employmentType: _employmentType,initial: _initial,englishRequired: _englishRequired,city: _city,addres: _addres,); CreateStaffVariables vars= CreateStaffVariables(userId: userId,fullName: fullName,level: _level,role: _role,phone: _phone,email: _email,photoUrl: _photoUrl,totalShifts: _totalShifts,averageRating: _averageRating,onTimeRate: _onTimeRate,noShowCount: _noShowCount,cancellationCount: _cancellationCount,reliabilityScore: _reliabilityScore,bio: _bio,skills: _skills,industries: _industries,preferredLocations: _preferredLocations,maxDistanceMiles: _maxDistanceMiles,languages: _languages,itemsAttire: _itemsAttire,xp: _xp,badges: _badges,isRecommended: _isRecommended,ownerId: _ownerId,department: _department,hubId: _hubId,manager: _manager,english: _english,backgroundCheckStatus: _backgroundCheckStatus,employmentType: _employmentType,initial: _initial,englishRequired: _englishRequired,city: _city,addres: _addres,);
return _dataConnect.mutation("CreateStaff", dataDeserializer, varsSerializer, vars); return _dataConnect.mutation("CreateStaff", dataDeserializer, varsSerializer, vars);
} }
} }
@@ -257,6 +262,7 @@ class CreateStaffVariables {
late final Optional<int>cancellationCount; late final Optional<int>cancellationCount;
late final Optional<int>reliabilityScore; late final Optional<int>reliabilityScore;
late final Optional<String>bio; late final Optional<String>bio;
late final Optional<AnyValue>skills;
late final Optional<AnyValue>industries; late final Optional<AnyValue>industries;
late final Optional<AnyValue>preferredLocations; late final Optional<AnyValue>preferredLocations;
late final Optional<int>maxDistanceMiles; late final Optional<int>maxDistanceMiles;
@@ -333,6 +339,10 @@ class CreateStaffVariables {
bio.value = json['bio'] == null ? null : nativeFromJson<String>(json['bio']); bio.value = json['bio'] == null ? null : nativeFromJson<String>(json['bio']);
skills = Optional.optional(AnyValue.fromJson, defaultSerializer);
skills.value = json['skills'] == null ? null : AnyValue.fromJson(json['skills']);
industries = Optional.optional(AnyValue.fromJson, defaultSerializer); industries = Optional.optional(AnyValue.fromJson, defaultSerializer);
industries.value = json['industries'] == null ? null : AnyValue.fromJson(json['industries']); industries.value = json['industries'] == null ? null : AnyValue.fromJson(json['industries']);
@@ -433,6 +443,7 @@ class CreateStaffVariables {
cancellationCount == otherTyped.cancellationCount && cancellationCount == otherTyped.cancellationCount &&
reliabilityScore == otherTyped.reliabilityScore && reliabilityScore == otherTyped.reliabilityScore &&
bio == otherTyped.bio && bio == otherTyped.bio &&
skills == otherTyped.skills &&
industries == otherTyped.industries && industries == otherTyped.industries &&
preferredLocations == otherTyped.preferredLocations && preferredLocations == otherTyped.preferredLocations &&
maxDistanceMiles == otherTyped.maxDistanceMiles && maxDistanceMiles == otherTyped.maxDistanceMiles &&
@@ -455,7 +466,7 @@ class CreateStaffVariables {
} }
@override @override
int get hashCode => Object.hashAll([userId.hashCode, fullName.hashCode, level.hashCode, role.hashCode, phone.hashCode, email.hashCode, photoUrl.hashCode, totalShifts.hashCode, averageRating.hashCode, onTimeRate.hashCode, noShowCount.hashCode, cancellationCount.hashCode, reliabilityScore.hashCode, bio.hashCode, industries.hashCode, preferredLocations.hashCode, maxDistanceMiles.hashCode, languages.hashCode, itemsAttire.hashCode, xp.hashCode, badges.hashCode, isRecommended.hashCode, ownerId.hashCode, department.hashCode, hubId.hashCode, manager.hashCode, english.hashCode, backgroundCheckStatus.hashCode, employmentType.hashCode, initial.hashCode, englishRequired.hashCode, city.hashCode, addres.hashCode]); int get hashCode => Object.hashAll([userId.hashCode, fullName.hashCode, level.hashCode, role.hashCode, phone.hashCode, email.hashCode, photoUrl.hashCode, totalShifts.hashCode, averageRating.hashCode, onTimeRate.hashCode, noShowCount.hashCode, cancellationCount.hashCode, reliabilityScore.hashCode, bio.hashCode, skills.hashCode, industries.hashCode, preferredLocations.hashCode, maxDistanceMiles.hashCode, languages.hashCode, itemsAttire.hashCode, xp.hashCode, badges.hashCode, isRecommended.hashCode, ownerId.hashCode, department.hashCode, hubId.hashCode, manager.hashCode, english.hashCode, backgroundCheckStatus.hashCode, employmentType.hashCode, initial.hashCode, englishRequired.hashCode, city.hashCode, addres.hashCode]);
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@@ -498,6 +509,9 @@ class CreateStaffVariables {
if(bio.state == OptionalState.set) { if(bio.state == OptionalState.set) {
json['bio'] = bio.toJson(); json['bio'] = bio.toJson();
} }
if(skills.state == OptionalState.set) {
json['skills'] = skills.toJson();
}
if(industries.state == OptionalState.set) { if(industries.state == OptionalState.set) {
json['industries'] = industries.toJson(); json['industries'] = industries.toJson();
} }
@@ -573,6 +587,7 @@ class CreateStaffVariables {
required this.cancellationCount, required this.cancellationCount,
required this.reliabilityScore, required this.reliabilityScore,
required this.bio, required this.bio,
required this.skills,
required this.industries, required this.industries,
required this.preferredLocations, required this.preferredLocations,
required this.maxDistanceMiles, required this.maxDistanceMiles,

View File

@@ -45,6 +45,8 @@ class FilterAccountsAccounts {
final String last4; final String last4;
final bool? isPrimary; final bool? isPrimary;
final String ownerId; final String ownerId;
final String? accountNumber;
final String? routeNumber;
FilterAccountsAccounts.fromJson(dynamic json): FilterAccountsAccounts.fromJson(dynamic json):
id = nativeFromJson<String>(json['id']), id = nativeFromJson<String>(json['id']),
@@ -52,7 +54,9 @@ class FilterAccountsAccounts {
type = accountTypeDeserializer(json['type']), type = accountTypeDeserializer(json['type']),
last4 = nativeFromJson<String>(json['last4']), last4 = nativeFromJson<String>(json['last4']),
isPrimary = json['isPrimary'] == null ? null : nativeFromJson<bool>(json['isPrimary']), isPrimary = json['isPrimary'] == null ? null : nativeFromJson<bool>(json['isPrimary']),
ownerId = nativeFromJson<String>(json['ownerId']); ownerId = nativeFromJson<String>(json['ownerId']),
accountNumber = json['accountNumber'] == null ? null : nativeFromJson<String>(json['accountNumber']),
routeNumber = json['routeNumber'] == null ? null : nativeFromJson<String>(json['routeNumber']);
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
if(identical(this, other)) { if(identical(this, other)) {
@@ -68,11 +72,13 @@ class FilterAccountsAccounts {
type == otherTyped.type && type == otherTyped.type &&
last4 == otherTyped.last4 && last4 == otherTyped.last4 &&
isPrimary == otherTyped.isPrimary && isPrimary == otherTyped.isPrimary &&
ownerId == otherTyped.ownerId; ownerId == otherTyped.ownerId &&
accountNumber == otherTyped.accountNumber &&
routeNumber == otherTyped.routeNumber;
} }
@override @override
int get hashCode => Object.hashAll([id.hashCode, bank.hashCode, type.hashCode, last4.hashCode, isPrimary.hashCode, ownerId.hashCode]); int get hashCode => Object.hashAll([id.hashCode, bank.hashCode, type.hashCode, last4.hashCode, isPrimary.hashCode, ownerId.hashCode, accountNumber.hashCode, routeNumber.hashCode]);
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@@ -87,6 +93,12 @@ class FilterAccountsAccounts {
json['isPrimary'] = nativeToJson<bool?>(isPrimary); json['isPrimary'] = nativeToJson<bool?>(isPrimary);
} }
json['ownerId'] = nativeToJson<String>(ownerId); json['ownerId'] = nativeToJson<String>(ownerId);
if (accountNumber != null) {
json['accountNumber'] = nativeToJson<String?>(accountNumber);
}
if (routeNumber != null) {
json['routeNumber'] = nativeToJson<String?>(routeNumber);
}
return json; return json;
} }
@@ -97,6 +109,8 @@ class FilterAccountsAccounts {
required this.last4, required this.last4,
this.isPrimary, this.isPrimary,
required this.ownerId, required this.ownerId,
this.accountNumber,
this.routeNumber,
}); });
} }

View File

@@ -51,6 +51,7 @@ class FilterStaffStaffs {
final int? totalShifts; final int? totalShifts;
final String? ownerId; final String? ownerId;
final bool? isRecommended; final bool? isRecommended;
final AnyValue? skills;
final EnumValue<BackgroundCheckStatus>? backgroundCheckStatus; final EnumValue<BackgroundCheckStatus>? backgroundCheckStatus;
final EnumValue<EmploymentType>? employmentType; final EnumValue<EmploymentType>? employmentType;
final String? initial; final String? initial;
@@ -71,6 +72,7 @@ class FilterStaffStaffs {
totalShifts = json['totalShifts'] == null ? null : nativeFromJson<int>(json['totalShifts']), totalShifts = json['totalShifts'] == null ? null : nativeFromJson<int>(json['totalShifts']),
ownerId = json['ownerId'] == null ? null : nativeFromJson<String>(json['ownerId']), ownerId = json['ownerId'] == null ? null : nativeFromJson<String>(json['ownerId']),
isRecommended = json['isRecommended'] == null ? null : nativeFromJson<bool>(json['isRecommended']), isRecommended = json['isRecommended'] == null ? null : nativeFromJson<bool>(json['isRecommended']),
skills = json['skills'] == null ? null : AnyValue.fromJson(json['skills']),
backgroundCheckStatus = json['backgroundCheckStatus'] == null ? null : backgroundCheckStatusDeserializer(json['backgroundCheckStatus']), backgroundCheckStatus = json['backgroundCheckStatus'] == null ? null : backgroundCheckStatusDeserializer(json['backgroundCheckStatus']),
employmentType = json['employmentType'] == null ? null : employmentTypeDeserializer(json['employmentType']), employmentType = json['employmentType'] == null ? null : employmentTypeDeserializer(json['employmentType']),
initial = json['initial'] == null ? null : nativeFromJson<String>(json['initial']), initial = json['initial'] == null ? null : nativeFromJson<String>(json['initial']),
@@ -99,6 +101,7 @@ class FilterStaffStaffs {
totalShifts == otherTyped.totalShifts && totalShifts == otherTyped.totalShifts &&
ownerId == otherTyped.ownerId && ownerId == otherTyped.ownerId &&
isRecommended == otherTyped.isRecommended && isRecommended == otherTyped.isRecommended &&
skills == otherTyped.skills &&
backgroundCheckStatus == otherTyped.backgroundCheckStatus && backgroundCheckStatus == otherTyped.backgroundCheckStatus &&
employmentType == otherTyped.employmentType && employmentType == otherTyped.employmentType &&
initial == otherTyped.initial && initial == otherTyped.initial &&
@@ -108,7 +111,7 @@ class FilterStaffStaffs {
} }
@override @override
int get hashCode => Object.hashAll([id.hashCode, userId.hashCode, fullName.hashCode, level.hashCode, phone.hashCode, email.hashCode, photoUrl.hashCode, averageRating.hashCode, reliabilityScore.hashCode, totalShifts.hashCode, ownerId.hashCode, isRecommended.hashCode, backgroundCheckStatus.hashCode, employmentType.hashCode, initial.hashCode, englishRequired.hashCode, city.hashCode, addres.hashCode]); int get hashCode => Object.hashAll([id.hashCode, userId.hashCode, fullName.hashCode, level.hashCode, phone.hashCode, email.hashCode, photoUrl.hashCode, averageRating.hashCode, reliabilityScore.hashCode, totalShifts.hashCode, ownerId.hashCode, isRecommended.hashCode, skills.hashCode, backgroundCheckStatus.hashCode, employmentType.hashCode, initial.hashCode, englishRequired.hashCode, city.hashCode, addres.hashCode]);
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@@ -143,6 +146,9 @@ class FilterStaffStaffs {
if (isRecommended != null) { if (isRecommended != null) {
json['isRecommended'] = nativeToJson<bool?>(isRecommended); json['isRecommended'] = nativeToJson<bool?>(isRecommended);
} }
if (skills != null) {
json['skills'] = skills!.toJson();
}
if (backgroundCheckStatus != null) { if (backgroundCheckStatus != null) {
json['backgroundCheckStatus'] = json['backgroundCheckStatus'] =
backgroundCheckStatusSerializer(backgroundCheckStatus!) backgroundCheckStatusSerializer(backgroundCheckStatus!)
@@ -181,6 +187,7 @@ class FilterStaffStaffs {
this.totalShifts, this.totalShifts,
this.ownerId, this.ownerId,
this.isRecommended, this.isRecommended,
this.skills,
this.backgroundCheckStatus, this.backgroundCheckStatus,
this.employmentType, this.employmentType,
this.initial, this.initial,

View File

@@ -25,9 +25,9 @@ class GetAccountByIdAccount {
final String last4; final String last4;
final bool? isPrimary; final bool? isPrimary;
final String ownerId; final String ownerId;
final String? accountNumber;
final String? routeNumber;
final Timestamp? createdAt; final Timestamp? createdAt;
final Timestamp? updatedAt;
final String? createdBy;
GetAccountByIdAccount.fromJson(dynamic json): GetAccountByIdAccount.fromJson(dynamic json):
id = nativeFromJson<String>(json['id']), id = nativeFromJson<String>(json['id']),
@@ -36,9 +36,9 @@ class GetAccountByIdAccount {
last4 = nativeFromJson<String>(json['last4']), last4 = nativeFromJson<String>(json['last4']),
isPrimary = json['isPrimary'] == null ? null : nativeFromJson<bool>(json['isPrimary']), isPrimary = json['isPrimary'] == null ? null : nativeFromJson<bool>(json['isPrimary']),
ownerId = nativeFromJson<String>(json['ownerId']), ownerId = nativeFromJson<String>(json['ownerId']),
createdAt = json['createdAt'] == null ? null : Timestamp.fromJson(json['createdAt']), accountNumber = json['accountNumber'] == null ? null : nativeFromJson<String>(json['accountNumber']),
updatedAt = json['updatedAt'] == null ? null : Timestamp.fromJson(json['updatedAt']), routeNumber = json['routeNumber'] == null ? null : nativeFromJson<String>(json['routeNumber']),
createdBy = json['createdBy'] == null ? null : nativeFromJson<String>(json['createdBy']); createdAt = json['createdAt'] == null ? null : Timestamp.fromJson(json['createdAt']);
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
if(identical(this, other)) { if(identical(this, other)) {
@@ -55,13 +55,13 @@ class GetAccountByIdAccount {
last4 == otherTyped.last4 && last4 == otherTyped.last4 &&
isPrimary == otherTyped.isPrimary && isPrimary == otherTyped.isPrimary &&
ownerId == otherTyped.ownerId && ownerId == otherTyped.ownerId &&
createdAt == otherTyped.createdAt && accountNumber == otherTyped.accountNumber &&
updatedAt == otherTyped.updatedAt && routeNumber == otherTyped.routeNumber &&
createdBy == otherTyped.createdBy; createdAt == otherTyped.createdAt;
} }
@override @override
int get hashCode => Object.hashAll([id.hashCode, bank.hashCode, type.hashCode, last4.hashCode, isPrimary.hashCode, ownerId.hashCode, createdAt.hashCode, updatedAt.hashCode, createdBy.hashCode]); int get hashCode => Object.hashAll([id.hashCode, bank.hashCode, type.hashCode, last4.hashCode, isPrimary.hashCode, ownerId.hashCode, accountNumber.hashCode, routeNumber.hashCode, createdAt.hashCode]);
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@@ -76,15 +76,15 @@ class GetAccountByIdAccount {
json['isPrimary'] = nativeToJson<bool?>(isPrimary); json['isPrimary'] = nativeToJson<bool?>(isPrimary);
} }
json['ownerId'] = nativeToJson<String>(ownerId); json['ownerId'] = nativeToJson<String>(ownerId);
if (accountNumber != null) {
json['accountNumber'] = nativeToJson<String?>(accountNumber);
}
if (routeNumber != null) {
json['routeNumber'] = nativeToJson<String?>(routeNumber);
}
if (createdAt != null) { if (createdAt != null) {
json['createdAt'] = createdAt!.toJson(); json['createdAt'] = createdAt!.toJson();
} }
if (updatedAt != null) {
json['updatedAt'] = updatedAt!.toJson();
}
if (createdBy != null) {
json['createdBy'] = nativeToJson<String?>(createdBy);
}
return json; return json;
} }
@@ -95,9 +95,9 @@ class GetAccountByIdAccount {
required this.last4, required this.last4,
this.isPrimary, this.isPrimary,
required this.ownerId, required this.ownerId,
this.accountNumber,
this.routeNumber,
this.createdAt, this.createdAt,
this.updatedAt,
this.createdBy,
}); });
} }

View File

@@ -25,9 +25,9 @@ class GetAccountsByOwnerIdAccounts {
final String last4; final String last4;
final bool? isPrimary; final bool? isPrimary;
final String ownerId; final String ownerId;
final String? accountNumber;
final String? routeNumber;
final Timestamp? createdAt; final Timestamp? createdAt;
final Timestamp? updatedAt;
final String? createdBy;
GetAccountsByOwnerIdAccounts.fromJson(dynamic json): GetAccountsByOwnerIdAccounts.fromJson(dynamic json):
id = nativeFromJson<String>(json['id']), id = nativeFromJson<String>(json['id']),
@@ -36,9 +36,9 @@ class GetAccountsByOwnerIdAccounts {
last4 = nativeFromJson<String>(json['last4']), last4 = nativeFromJson<String>(json['last4']),
isPrimary = json['isPrimary'] == null ? null : nativeFromJson<bool>(json['isPrimary']), isPrimary = json['isPrimary'] == null ? null : nativeFromJson<bool>(json['isPrimary']),
ownerId = nativeFromJson<String>(json['ownerId']), ownerId = nativeFromJson<String>(json['ownerId']),
createdAt = json['createdAt'] == null ? null : Timestamp.fromJson(json['createdAt']), accountNumber = json['accountNumber'] == null ? null : nativeFromJson<String>(json['accountNumber']),
updatedAt = json['updatedAt'] == null ? null : Timestamp.fromJson(json['updatedAt']), routeNumber = json['routeNumber'] == null ? null : nativeFromJson<String>(json['routeNumber']),
createdBy = json['createdBy'] == null ? null : nativeFromJson<String>(json['createdBy']); createdAt = json['createdAt'] == null ? null : Timestamp.fromJson(json['createdAt']);
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
if(identical(this, other)) { if(identical(this, other)) {
@@ -55,13 +55,13 @@ class GetAccountsByOwnerIdAccounts {
last4 == otherTyped.last4 && last4 == otherTyped.last4 &&
isPrimary == otherTyped.isPrimary && isPrimary == otherTyped.isPrimary &&
ownerId == otherTyped.ownerId && ownerId == otherTyped.ownerId &&
createdAt == otherTyped.createdAt && accountNumber == otherTyped.accountNumber &&
updatedAt == otherTyped.updatedAt && routeNumber == otherTyped.routeNumber &&
createdBy == otherTyped.createdBy; createdAt == otherTyped.createdAt;
} }
@override @override
int get hashCode => Object.hashAll([id.hashCode, bank.hashCode, type.hashCode, last4.hashCode, isPrimary.hashCode, ownerId.hashCode, createdAt.hashCode, updatedAt.hashCode, createdBy.hashCode]); int get hashCode => Object.hashAll([id.hashCode, bank.hashCode, type.hashCode, last4.hashCode, isPrimary.hashCode, ownerId.hashCode, accountNumber.hashCode, routeNumber.hashCode, createdAt.hashCode]);
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@@ -76,15 +76,15 @@ class GetAccountsByOwnerIdAccounts {
json['isPrimary'] = nativeToJson<bool?>(isPrimary); json['isPrimary'] = nativeToJson<bool?>(isPrimary);
} }
json['ownerId'] = nativeToJson<String>(ownerId); json['ownerId'] = nativeToJson<String>(ownerId);
if (accountNumber != null) {
json['accountNumber'] = nativeToJson<String?>(accountNumber);
}
if (routeNumber != null) {
json['routeNumber'] = nativeToJson<String?>(routeNumber);
}
if (createdAt != null) { if (createdAt != null) {
json['createdAt'] = createdAt!.toJson(); json['createdAt'] = createdAt!.toJson();
} }
if (updatedAt != null) {
json['updatedAt'] = updatedAt!.toJson();
}
if (createdBy != null) {
json['createdBy'] = nativeToJson<String?>(createdBy);
}
return json; return json;
} }
@@ -95,9 +95,9 @@ class GetAccountsByOwnerIdAccounts {
required this.last4, required this.last4,
this.isPrimary, this.isPrimary,
required this.ownerId, required this.ownerId,
this.accountNumber,
this.routeNumber,
this.createdAt, this.createdAt,
this.updatedAt,
this.createdBy,
}); });
} }

View File

@@ -37,6 +37,7 @@ class GetStaffByIdStaff {
final AnyValue? badges; final AnyValue? badges;
final bool? isRecommended; final bool? isRecommended;
final String? bio; final String? bio;
final AnyValue? skills;
final AnyValue? industries; final AnyValue? industries;
final AnyValue? preferredLocations; final AnyValue? preferredLocations;
final int? maxDistanceMiles; final int? maxDistanceMiles;
@@ -76,6 +77,7 @@ class GetStaffByIdStaff {
badges = json['badges'] == null ? null : AnyValue.fromJson(json['badges']), badges = json['badges'] == null ? null : AnyValue.fromJson(json['badges']),
isRecommended = json['isRecommended'] == null ? null : nativeFromJson<bool>(json['isRecommended']), isRecommended = json['isRecommended'] == null ? null : nativeFromJson<bool>(json['isRecommended']),
bio = json['bio'] == null ? null : nativeFromJson<String>(json['bio']), bio = json['bio'] == null ? null : nativeFromJson<String>(json['bio']),
skills = json['skills'] == null ? null : AnyValue.fromJson(json['skills']),
industries = json['industries'] == null ? null : AnyValue.fromJson(json['industries']), industries = json['industries'] == null ? null : AnyValue.fromJson(json['industries']),
preferredLocations = json['preferredLocations'] == null ? null : AnyValue.fromJson(json['preferredLocations']), preferredLocations = json['preferredLocations'] == null ? null : AnyValue.fromJson(json['preferredLocations']),
maxDistanceMiles = json['maxDistanceMiles'] == null ? null : nativeFromJson<int>(json['maxDistanceMiles']), maxDistanceMiles = json['maxDistanceMiles'] == null ? null : nativeFromJson<int>(json['maxDistanceMiles']),
@@ -123,6 +125,7 @@ class GetStaffByIdStaff {
badges == otherTyped.badges && badges == otherTyped.badges &&
isRecommended == otherTyped.isRecommended && isRecommended == otherTyped.isRecommended &&
bio == otherTyped.bio && bio == otherTyped.bio &&
skills == otherTyped.skills &&
industries == otherTyped.industries && industries == otherTyped.industries &&
preferredLocations == otherTyped.preferredLocations && preferredLocations == otherTyped.preferredLocations &&
maxDistanceMiles == otherTyped.maxDistanceMiles && maxDistanceMiles == otherTyped.maxDistanceMiles &&
@@ -145,7 +148,7 @@ class GetStaffByIdStaff {
} }
@override @override
int get hashCode => Object.hashAll([id.hashCode, userId.hashCode, fullName.hashCode, role.hashCode, level.hashCode, phone.hashCode, email.hashCode, photoUrl.hashCode, totalShifts.hashCode, averageRating.hashCode, onTimeRate.hashCode, noShowCount.hashCode, cancellationCount.hashCode, reliabilityScore.hashCode, xp.hashCode, badges.hashCode, isRecommended.hashCode, bio.hashCode, industries.hashCode, preferredLocations.hashCode, maxDistanceMiles.hashCode, languages.hashCode, itemsAttire.hashCode, ownerId.hashCode, createdAt.hashCode, updatedAt.hashCode, createdBy.hashCode, department.hashCode, hubId.hashCode, manager.hashCode, english.hashCode, backgroundCheckStatus.hashCode, employmentType.hashCode, initial.hashCode, englishRequired.hashCode, city.hashCode, addres.hashCode]); int get hashCode => Object.hashAll([id.hashCode, userId.hashCode, fullName.hashCode, role.hashCode, level.hashCode, phone.hashCode, email.hashCode, photoUrl.hashCode, totalShifts.hashCode, averageRating.hashCode, onTimeRate.hashCode, noShowCount.hashCode, cancellationCount.hashCode, reliabilityScore.hashCode, xp.hashCode, badges.hashCode, isRecommended.hashCode, bio.hashCode, skills.hashCode, industries.hashCode, preferredLocations.hashCode, maxDistanceMiles.hashCode, languages.hashCode, itemsAttire.hashCode, ownerId.hashCode, createdAt.hashCode, updatedAt.hashCode, createdBy.hashCode, department.hashCode, hubId.hashCode, manager.hashCode, english.hashCode, backgroundCheckStatus.hashCode, employmentType.hashCode, initial.hashCode, englishRequired.hashCode, city.hashCode, addres.hashCode]);
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@@ -198,6 +201,9 @@ class GetStaffByIdStaff {
if (bio != null) { if (bio != null) {
json['bio'] = nativeToJson<String?>(bio); json['bio'] = nativeToJson<String?>(bio);
} }
if (skills != null) {
json['skills'] = skills!.toJson();
}
if (industries != null) { if (industries != null) {
json['industries'] = industries!.toJson(); json['industries'] = industries!.toJson();
} }
@@ -285,6 +291,7 @@ class GetStaffByIdStaff {
this.badges, this.badges,
this.isRecommended, this.isRecommended,
this.bio, this.bio,
this.skills,
this.industries, this.industries,
this.preferredLocations, this.preferredLocations,
this.maxDistanceMiles, this.maxDistanceMiles,

View File

@@ -36,6 +36,7 @@ class GetStaffByUserIdStaffs {
final AnyValue? badges; final AnyValue? badges;
final bool? isRecommended; final bool? isRecommended;
final String? bio; final String? bio;
final AnyValue? skills;
final AnyValue? industries; final AnyValue? industries;
final AnyValue? preferredLocations; final AnyValue? preferredLocations;
final int? maxDistanceMiles; final int? maxDistanceMiles;
@@ -74,6 +75,7 @@ class GetStaffByUserIdStaffs {
badges = json['badges'] == null ? null : AnyValue.fromJson(json['badges']), badges = json['badges'] == null ? null : AnyValue.fromJson(json['badges']),
isRecommended = json['isRecommended'] == null ? null : nativeFromJson<bool>(json['isRecommended']), isRecommended = json['isRecommended'] == null ? null : nativeFromJson<bool>(json['isRecommended']),
bio = json['bio'] == null ? null : nativeFromJson<String>(json['bio']), bio = json['bio'] == null ? null : nativeFromJson<String>(json['bio']),
skills = json['skills'] == null ? null : AnyValue.fromJson(json['skills']),
industries = json['industries'] == null ? null : AnyValue.fromJson(json['industries']), industries = json['industries'] == null ? null : AnyValue.fromJson(json['industries']),
preferredLocations = json['preferredLocations'] == null ? null : AnyValue.fromJson(json['preferredLocations']), preferredLocations = json['preferredLocations'] == null ? null : AnyValue.fromJson(json['preferredLocations']),
maxDistanceMiles = json['maxDistanceMiles'] == null ? null : nativeFromJson<int>(json['maxDistanceMiles']), maxDistanceMiles = json['maxDistanceMiles'] == null ? null : nativeFromJson<int>(json['maxDistanceMiles']),
@@ -120,6 +122,7 @@ class GetStaffByUserIdStaffs {
badges == otherTyped.badges && badges == otherTyped.badges &&
isRecommended == otherTyped.isRecommended && isRecommended == otherTyped.isRecommended &&
bio == otherTyped.bio && bio == otherTyped.bio &&
skills == otherTyped.skills &&
industries == otherTyped.industries && industries == otherTyped.industries &&
preferredLocations == otherTyped.preferredLocations && preferredLocations == otherTyped.preferredLocations &&
maxDistanceMiles == otherTyped.maxDistanceMiles && maxDistanceMiles == otherTyped.maxDistanceMiles &&
@@ -142,7 +145,7 @@ class GetStaffByUserIdStaffs {
} }
@override @override
int get hashCode => Object.hashAll([id.hashCode, userId.hashCode, fullName.hashCode, level.hashCode, phone.hashCode, email.hashCode, photoUrl.hashCode, totalShifts.hashCode, averageRating.hashCode, onTimeRate.hashCode, noShowCount.hashCode, cancellationCount.hashCode, reliabilityScore.hashCode, xp.hashCode, badges.hashCode, isRecommended.hashCode, bio.hashCode, industries.hashCode, preferredLocations.hashCode, maxDistanceMiles.hashCode, languages.hashCode, itemsAttire.hashCode, ownerId.hashCode, createdAt.hashCode, updatedAt.hashCode, createdBy.hashCode, department.hashCode, hubId.hashCode, manager.hashCode, english.hashCode, backgroundCheckStatus.hashCode, employmentType.hashCode, initial.hashCode, englishRequired.hashCode, city.hashCode, addres.hashCode]); int get hashCode => Object.hashAll([id.hashCode, userId.hashCode, fullName.hashCode, level.hashCode, phone.hashCode, email.hashCode, photoUrl.hashCode, totalShifts.hashCode, averageRating.hashCode, onTimeRate.hashCode, noShowCount.hashCode, cancellationCount.hashCode, reliabilityScore.hashCode, xp.hashCode, badges.hashCode, isRecommended.hashCode, bio.hashCode, skills.hashCode, industries.hashCode, preferredLocations.hashCode, maxDistanceMiles.hashCode, languages.hashCode, itemsAttire.hashCode, ownerId.hashCode, createdAt.hashCode, updatedAt.hashCode, createdBy.hashCode, department.hashCode, hubId.hashCode, manager.hashCode, english.hashCode, backgroundCheckStatus.hashCode, employmentType.hashCode, initial.hashCode, englishRequired.hashCode, city.hashCode, addres.hashCode]);
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@@ -192,6 +195,9 @@ class GetStaffByUserIdStaffs {
if (bio != null) { if (bio != null) {
json['bio'] = nativeToJson<String?>(bio); json['bio'] = nativeToJson<String?>(bio);
} }
if (skills != null) {
json['skills'] = skills!.toJson();
}
if (industries != null) { if (industries != null) {
json['industries'] = industries!.toJson(); json['industries'] = industries!.toJson();
} }
@@ -278,6 +284,7 @@ class GetStaffByUserIdStaffs {
this.badges, this.badges,
this.isRecommended, this.isRecommended,
this.bio, this.bio,
this.skills,
this.industries, this.industries,
this.preferredLocations, this.preferredLocations,
this.maxDistanceMiles, this.maxDistanceMiles,

View File

@@ -24,9 +24,9 @@ class ListAccountsAccounts {
final String last4; final String last4;
final bool? isPrimary; final bool? isPrimary;
final String ownerId; final String ownerId;
final String? accountNumber;
final String? routeNumber;
final Timestamp? createdAt; final Timestamp? createdAt;
final Timestamp? updatedAt;
final String? createdBy;
ListAccountsAccounts.fromJson(dynamic json): ListAccountsAccounts.fromJson(dynamic json):
id = nativeFromJson<String>(json['id']), id = nativeFromJson<String>(json['id']),
@@ -35,9 +35,9 @@ class ListAccountsAccounts {
last4 = nativeFromJson<String>(json['last4']), last4 = nativeFromJson<String>(json['last4']),
isPrimary = json['isPrimary'] == null ? null : nativeFromJson<bool>(json['isPrimary']), isPrimary = json['isPrimary'] == null ? null : nativeFromJson<bool>(json['isPrimary']),
ownerId = nativeFromJson<String>(json['ownerId']), ownerId = nativeFromJson<String>(json['ownerId']),
createdAt = json['createdAt'] == null ? null : Timestamp.fromJson(json['createdAt']), accountNumber = json['accountNumber'] == null ? null : nativeFromJson<String>(json['accountNumber']),
updatedAt = json['updatedAt'] == null ? null : Timestamp.fromJson(json['updatedAt']), routeNumber = json['routeNumber'] == null ? null : nativeFromJson<String>(json['routeNumber']),
createdBy = json['createdBy'] == null ? null : nativeFromJson<String>(json['createdBy']); createdAt = json['createdAt'] == null ? null : Timestamp.fromJson(json['createdAt']);
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
if(identical(this, other)) { if(identical(this, other)) {
@@ -54,13 +54,13 @@ class ListAccountsAccounts {
last4 == otherTyped.last4 && last4 == otherTyped.last4 &&
isPrimary == otherTyped.isPrimary && isPrimary == otherTyped.isPrimary &&
ownerId == otherTyped.ownerId && ownerId == otherTyped.ownerId &&
createdAt == otherTyped.createdAt && accountNumber == otherTyped.accountNumber &&
updatedAt == otherTyped.updatedAt && routeNumber == otherTyped.routeNumber &&
createdBy == otherTyped.createdBy; createdAt == otherTyped.createdAt;
} }
@override @override
int get hashCode => Object.hashAll([id.hashCode, bank.hashCode, type.hashCode, last4.hashCode, isPrimary.hashCode, ownerId.hashCode, createdAt.hashCode, updatedAt.hashCode, createdBy.hashCode]); int get hashCode => Object.hashAll([id.hashCode, bank.hashCode, type.hashCode, last4.hashCode, isPrimary.hashCode, ownerId.hashCode, accountNumber.hashCode, routeNumber.hashCode, createdAt.hashCode]);
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@@ -75,15 +75,15 @@ class ListAccountsAccounts {
json['isPrimary'] = nativeToJson<bool?>(isPrimary); json['isPrimary'] = nativeToJson<bool?>(isPrimary);
} }
json['ownerId'] = nativeToJson<String>(ownerId); json['ownerId'] = nativeToJson<String>(ownerId);
if (accountNumber != null) {
json['accountNumber'] = nativeToJson<String?>(accountNumber);
}
if (routeNumber != null) {
json['routeNumber'] = nativeToJson<String?>(routeNumber);
}
if (createdAt != null) { if (createdAt != null) {
json['createdAt'] = createdAt!.toJson(); json['createdAt'] = createdAt!.toJson();
} }
if (updatedAt != null) {
json['updatedAt'] = updatedAt!.toJson();
}
if (createdBy != null) {
json['createdBy'] = nativeToJson<String?>(createdBy);
}
return json; return json;
} }
@@ -94,9 +94,9 @@ class ListAccountsAccounts {
required this.last4, required this.last4,
this.isPrimary, this.isPrimary,
required this.ownerId, required this.ownerId,
this.accountNumber,
this.routeNumber,
this.createdAt, this.createdAt,
this.updatedAt,
this.createdBy,
}); });
} }

View File

@@ -36,6 +36,7 @@ class ListStaffStaffs {
final AnyValue? badges; final AnyValue? badges;
final bool? isRecommended; final bool? isRecommended;
final String? bio; final String? bio;
final AnyValue? skills;
final AnyValue? industries; final AnyValue? industries;
final AnyValue? preferredLocations; final AnyValue? preferredLocations;
final int? maxDistanceMiles; final int? maxDistanceMiles;
@@ -73,6 +74,7 @@ class ListStaffStaffs {
badges = json['badges'] == null ? null : AnyValue.fromJson(json['badges']), badges = json['badges'] == null ? null : AnyValue.fromJson(json['badges']),
isRecommended = json['isRecommended'] == null ? null : nativeFromJson<bool>(json['isRecommended']), isRecommended = json['isRecommended'] == null ? null : nativeFromJson<bool>(json['isRecommended']),
bio = json['bio'] == null ? null : nativeFromJson<String>(json['bio']), bio = json['bio'] == null ? null : nativeFromJson<String>(json['bio']),
skills = json['skills'] == null ? null : AnyValue.fromJson(json['skills']),
industries = json['industries'] == null ? null : AnyValue.fromJson(json['industries']), industries = json['industries'] == null ? null : AnyValue.fromJson(json['industries']),
preferredLocations = json['preferredLocations'] == null ? null : AnyValue.fromJson(json['preferredLocations']), preferredLocations = json['preferredLocations'] == null ? null : AnyValue.fromJson(json['preferredLocations']),
maxDistanceMiles = json['maxDistanceMiles'] == null ? null : nativeFromJson<int>(json['maxDistanceMiles']), maxDistanceMiles = json['maxDistanceMiles'] == null ? null : nativeFromJson<int>(json['maxDistanceMiles']),
@@ -118,6 +120,7 @@ class ListStaffStaffs {
badges == otherTyped.badges && badges == otherTyped.badges &&
isRecommended == otherTyped.isRecommended && isRecommended == otherTyped.isRecommended &&
bio == otherTyped.bio && bio == otherTyped.bio &&
skills == otherTyped.skills &&
industries == otherTyped.industries && industries == otherTyped.industries &&
preferredLocations == otherTyped.preferredLocations && preferredLocations == otherTyped.preferredLocations &&
maxDistanceMiles == otherTyped.maxDistanceMiles && maxDistanceMiles == otherTyped.maxDistanceMiles &&
@@ -138,7 +141,7 @@ class ListStaffStaffs {
} }
@override @override
int get hashCode => Object.hashAll([id.hashCode, userId.hashCode, fullName.hashCode, level.hashCode, role.hashCode, phone.hashCode, email.hashCode, photoUrl.hashCode, totalShifts.hashCode, averageRating.hashCode, onTimeRate.hashCode, noShowCount.hashCode, cancellationCount.hashCode, reliabilityScore.hashCode, xp.hashCode, badges.hashCode, isRecommended.hashCode, bio.hashCode, industries.hashCode, preferredLocations.hashCode, maxDistanceMiles.hashCode, languages.hashCode, itemsAttire.hashCode, ownerId.hashCode, createdAt.hashCode, department.hashCode, hubId.hashCode, manager.hashCode, english.hashCode, backgroundCheckStatus.hashCode, employmentType.hashCode, initial.hashCode, englishRequired.hashCode, city.hashCode, addres.hashCode]); int get hashCode => Object.hashAll([id.hashCode, userId.hashCode, fullName.hashCode, level.hashCode, role.hashCode, phone.hashCode, email.hashCode, photoUrl.hashCode, totalShifts.hashCode, averageRating.hashCode, onTimeRate.hashCode, noShowCount.hashCode, cancellationCount.hashCode, reliabilityScore.hashCode, xp.hashCode, badges.hashCode, isRecommended.hashCode, bio.hashCode, skills.hashCode, industries.hashCode, preferredLocations.hashCode, maxDistanceMiles.hashCode, languages.hashCode, itemsAttire.hashCode, ownerId.hashCode, createdAt.hashCode, department.hashCode, hubId.hashCode, manager.hashCode, english.hashCode, backgroundCheckStatus.hashCode, employmentType.hashCode, initial.hashCode, englishRequired.hashCode, city.hashCode, addres.hashCode]);
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@@ -191,6 +194,9 @@ class ListStaffStaffs {
if (bio != null) { if (bio != null) {
json['bio'] = nativeToJson<String?>(bio); json['bio'] = nativeToJson<String?>(bio);
} }
if (skills != null) {
json['skills'] = skills!.toJson();
}
if (industries != null) { if (industries != null) {
json['industries'] = industries!.toJson(); json['industries'] = industries!.toJson();
} }
@@ -272,6 +278,7 @@ class ListStaffStaffs {
this.badges, this.badges,
this.isRecommended, this.isRecommended,
this.bio, this.bio,
this.skills,
this.industries, this.industries,
this.preferredLocations, this.preferredLocations,
this.maxDistanceMiles, this.maxDistanceMiles,

View File

@@ -6,6 +6,8 @@ class UpdateAccountVariablesBuilder {
Optional<AccountType> _type = Optional.optional((data) => AccountType.values.byName(data), enumSerializer); Optional<AccountType> _type = Optional.optional((data) => AccountType.values.byName(data), enumSerializer);
Optional<String> _last4 = Optional.optional(nativeFromJson, nativeToJson); Optional<String> _last4 = Optional.optional(nativeFromJson, nativeToJson);
Optional<bool> _isPrimary = Optional.optional(nativeFromJson, nativeToJson); Optional<bool> _isPrimary = Optional.optional(nativeFromJson, nativeToJson);
Optional<String> _accountNumber = Optional.optional(nativeFromJson, nativeToJson);
Optional<String> _routeNumber = Optional.optional(nativeFromJson, nativeToJson);
final FirebaseDataConnect _dataConnect; UpdateAccountVariablesBuilder bank(String? t) { final FirebaseDataConnect _dataConnect; UpdateAccountVariablesBuilder bank(String? t) {
_bank.value = t; _bank.value = t;
@@ -23,6 +25,14 @@ class UpdateAccountVariablesBuilder {
_isPrimary.value = t; _isPrimary.value = t;
return this; return this;
} }
UpdateAccountVariablesBuilder accountNumber(String? t) {
_accountNumber.value = t;
return this;
}
UpdateAccountVariablesBuilder routeNumber(String? t) {
_routeNumber.value = t;
return this;
}
UpdateAccountVariablesBuilder(this._dataConnect, {required this.id,}); UpdateAccountVariablesBuilder(this._dataConnect, {required this.id,});
Deserializer<UpdateAccountData> dataDeserializer = (dynamic json) => UpdateAccountData.fromJson(jsonDecode(json)); Deserializer<UpdateAccountData> dataDeserializer = (dynamic json) => UpdateAccountData.fromJson(jsonDecode(json));
@@ -32,7 +42,7 @@ class UpdateAccountVariablesBuilder {
} }
MutationRef<UpdateAccountData, UpdateAccountVariables> ref() { MutationRef<UpdateAccountData, UpdateAccountVariables> ref() {
UpdateAccountVariables vars= UpdateAccountVariables(id: id,bank: _bank,type: _type,last4: _last4,isPrimary: _isPrimary,); UpdateAccountVariables vars= UpdateAccountVariables(id: id,bank: _bank,type: _type,last4: _last4,isPrimary: _isPrimary,accountNumber: _accountNumber,routeNumber: _routeNumber,);
return _dataConnect.mutation("updateAccount", dataDeserializer, varsSerializer, vars); return _dataConnect.mutation("updateAccount", dataDeserializer, varsSerializer, vars);
} }
} }
@@ -114,6 +124,8 @@ class UpdateAccountVariables {
late final Optional<AccountType>type; late final Optional<AccountType>type;
late final Optional<String>last4; late final Optional<String>last4;
late final Optional<bool>isPrimary; late final Optional<bool>isPrimary;
late final Optional<String>accountNumber;
late final Optional<String>routeNumber;
@Deprecated('fromJson is deprecated for Variable classes as they are no longer required for deserialization.') @Deprecated('fromJson is deprecated for Variable classes as they are no longer required for deserialization.')
UpdateAccountVariables.fromJson(Map<String, dynamic> json): UpdateAccountVariables.fromJson(Map<String, dynamic> json):
@@ -136,6 +148,14 @@ class UpdateAccountVariables {
isPrimary = Optional.optional(nativeFromJson, nativeToJson); isPrimary = Optional.optional(nativeFromJson, nativeToJson);
isPrimary.value = json['isPrimary'] == null ? null : nativeFromJson<bool>(json['isPrimary']); isPrimary.value = json['isPrimary'] == null ? null : nativeFromJson<bool>(json['isPrimary']);
accountNumber = Optional.optional(nativeFromJson, nativeToJson);
accountNumber.value = json['accountNumber'] == null ? null : nativeFromJson<String>(json['accountNumber']);
routeNumber = Optional.optional(nativeFromJson, nativeToJson);
routeNumber.value = json['routeNumber'] == null ? null : nativeFromJson<String>(json['routeNumber']);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
@@ -151,11 +171,13 @@ class UpdateAccountVariables {
bank == otherTyped.bank && bank == otherTyped.bank &&
type == otherTyped.type && type == otherTyped.type &&
last4 == otherTyped.last4 && last4 == otherTyped.last4 &&
isPrimary == otherTyped.isPrimary; isPrimary == otherTyped.isPrimary &&
accountNumber == otherTyped.accountNumber &&
routeNumber == otherTyped.routeNumber;
} }
@override @override
int get hashCode => Object.hashAll([id.hashCode, bank.hashCode, type.hashCode, last4.hashCode, isPrimary.hashCode]); int get hashCode => Object.hashAll([id.hashCode, bank.hashCode, type.hashCode, last4.hashCode, isPrimary.hashCode, accountNumber.hashCode, routeNumber.hashCode]);
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@@ -173,6 +195,12 @@ class UpdateAccountVariables {
if(isPrimary.state == OptionalState.set) { if(isPrimary.state == OptionalState.set) {
json['isPrimary'] = isPrimary.toJson(); json['isPrimary'] = isPrimary.toJson();
} }
if(accountNumber.state == OptionalState.set) {
json['accountNumber'] = accountNumber.toJson();
}
if(routeNumber.state == OptionalState.set) {
json['routeNumber'] = routeNumber.toJson();
}
return json; return json;
} }
@@ -182,6 +210,8 @@ class UpdateAccountVariables {
required this.type, required this.type,
required this.last4, required this.last4,
required this.isPrimary, required this.isPrimary,
required this.accountNumber,
required this.routeNumber,
}); });
} }

View File

@@ -16,6 +16,7 @@ class UpdateStaffVariablesBuilder {
Optional<int> _cancellationCount = Optional.optional(nativeFromJson, nativeToJson); Optional<int> _cancellationCount = Optional.optional(nativeFromJson, nativeToJson);
Optional<int> _reliabilityScore = Optional.optional(nativeFromJson, nativeToJson); Optional<int> _reliabilityScore = Optional.optional(nativeFromJson, nativeToJson);
Optional<String> _bio = Optional.optional(nativeFromJson, nativeToJson); Optional<String> _bio = Optional.optional(nativeFromJson, nativeToJson);
Optional<AnyValue> _skills = Optional.optional(AnyValue.fromJson, defaultSerializer);
Optional<AnyValue> _industries = Optional.optional(AnyValue.fromJson, defaultSerializer); Optional<AnyValue> _industries = Optional.optional(AnyValue.fromJson, defaultSerializer);
Optional<AnyValue> _preferredLocations = Optional.optional(AnyValue.fromJson, defaultSerializer); Optional<AnyValue> _preferredLocations = Optional.optional(AnyValue.fromJson, defaultSerializer);
Optional<int> _maxDistanceMiles = Optional.optional(nativeFromJson, nativeToJson); Optional<int> _maxDistanceMiles = Optional.optional(nativeFromJson, nativeToJson);
@@ -92,6 +93,10 @@ class UpdateStaffVariablesBuilder {
_bio.value = t; _bio.value = t;
return this; return this;
} }
UpdateStaffVariablesBuilder skills(AnyValue? t) {
_skills.value = t;
return this;
}
UpdateStaffVariablesBuilder industries(AnyValue? t) { UpdateStaffVariablesBuilder industries(AnyValue? t) {
_industries.value = t; _industries.value = t;
return this; return this;
@@ -177,7 +182,7 @@ class UpdateStaffVariablesBuilder {
} }
MutationRef<UpdateStaffData, UpdateStaffVariables> ref() { MutationRef<UpdateStaffData, UpdateStaffVariables> ref() {
UpdateStaffVariables vars= UpdateStaffVariables(id: id,userId: _userId,fullName: _fullName,level: _level,role: _role,phone: _phone,email: _email,photoUrl: _photoUrl,totalShifts: _totalShifts,averageRating: _averageRating,onTimeRate: _onTimeRate,noShowCount: _noShowCount,cancellationCount: _cancellationCount,reliabilityScore: _reliabilityScore,bio: _bio,industries: _industries,preferredLocations: _preferredLocations,maxDistanceMiles: _maxDistanceMiles,languages: _languages,itemsAttire: _itemsAttire,xp: _xp,badges: _badges,isRecommended: _isRecommended,ownerId: _ownerId,department: _department,hubId: _hubId,manager: _manager,english: _english,backgroundCheckStatus: _backgroundCheckStatus,employmentType: _employmentType,initial: _initial,englishRequired: _englishRequired,city: _city,addres: _addres,); UpdateStaffVariables vars= UpdateStaffVariables(id: id,userId: _userId,fullName: _fullName,level: _level,role: _role,phone: _phone,email: _email,photoUrl: _photoUrl,totalShifts: _totalShifts,averageRating: _averageRating,onTimeRate: _onTimeRate,noShowCount: _noShowCount,cancellationCount: _cancellationCount,reliabilityScore: _reliabilityScore,bio: _bio,skills: _skills,industries: _industries,preferredLocations: _preferredLocations,maxDistanceMiles: _maxDistanceMiles,languages: _languages,itemsAttire: _itemsAttire,xp: _xp,badges: _badges,isRecommended: _isRecommended,ownerId: _ownerId,department: _department,hubId: _hubId,manager: _manager,english: _english,backgroundCheckStatus: _backgroundCheckStatus,employmentType: _employmentType,initial: _initial,englishRequired: _englishRequired,city: _city,addres: _addres,);
return _dataConnect.mutation("UpdateStaff", dataDeserializer, varsSerializer, vars); return _dataConnect.mutation("UpdateStaff", dataDeserializer, varsSerializer, vars);
} }
} }
@@ -269,6 +274,7 @@ class UpdateStaffVariables {
late final Optional<int>cancellationCount; late final Optional<int>cancellationCount;
late final Optional<int>reliabilityScore; late final Optional<int>reliabilityScore;
late final Optional<String>bio; late final Optional<String>bio;
late final Optional<AnyValue>skills;
late final Optional<AnyValue>industries; late final Optional<AnyValue>industries;
late final Optional<AnyValue>preferredLocations; late final Optional<AnyValue>preferredLocations;
late final Optional<int>maxDistanceMiles; late final Optional<int>maxDistanceMiles;
@@ -351,6 +357,10 @@ class UpdateStaffVariables {
bio.value = json['bio'] == null ? null : nativeFromJson<String>(json['bio']); bio.value = json['bio'] == null ? null : nativeFromJson<String>(json['bio']);
skills = Optional.optional(AnyValue.fromJson, defaultSerializer);
skills.value = json['skills'] == null ? null : AnyValue.fromJson(json['skills']);
industries = Optional.optional(AnyValue.fromJson, defaultSerializer); industries = Optional.optional(AnyValue.fromJson, defaultSerializer);
industries.value = json['industries'] == null ? null : AnyValue.fromJson(json['industries']); industries.value = json['industries'] == null ? null : AnyValue.fromJson(json['industries']);
@@ -452,6 +462,7 @@ class UpdateStaffVariables {
cancellationCount == otherTyped.cancellationCount && cancellationCount == otherTyped.cancellationCount &&
reliabilityScore == otherTyped.reliabilityScore && reliabilityScore == otherTyped.reliabilityScore &&
bio == otherTyped.bio && bio == otherTyped.bio &&
skills == otherTyped.skills &&
industries == otherTyped.industries && industries == otherTyped.industries &&
preferredLocations == otherTyped.preferredLocations && preferredLocations == otherTyped.preferredLocations &&
maxDistanceMiles == otherTyped.maxDistanceMiles && maxDistanceMiles == otherTyped.maxDistanceMiles &&
@@ -474,7 +485,7 @@ class UpdateStaffVariables {
} }
@override @override
int get hashCode => Object.hashAll([id.hashCode, userId.hashCode, fullName.hashCode, level.hashCode, role.hashCode, phone.hashCode, email.hashCode, photoUrl.hashCode, totalShifts.hashCode, averageRating.hashCode, onTimeRate.hashCode, noShowCount.hashCode, cancellationCount.hashCode, reliabilityScore.hashCode, bio.hashCode, industries.hashCode, preferredLocations.hashCode, maxDistanceMiles.hashCode, languages.hashCode, itemsAttire.hashCode, xp.hashCode, badges.hashCode, isRecommended.hashCode, ownerId.hashCode, department.hashCode, hubId.hashCode, manager.hashCode, english.hashCode, backgroundCheckStatus.hashCode, employmentType.hashCode, initial.hashCode, englishRequired.hashCode, city.hashCode, addres.hashCode]); int get hashCode => Object.hashAll([id.hashCode, userId.hashCode, fullName.hashCode, level.hashCode, role.hashCode, phone.hashCode, email.hashCode, photoUrl.hashCode, totalShifts.hashCode, averageRating.hashCode, onTimeRate.hashCode, noShowCount.hashCode, cancellationCount.hashCode, reliabilityScore.hashCode, bio.hashCode, skills.hashCode, industries.hashCode, preferredLocations.hashCode, maxDistanceMiles.hashCode, languages.hashCode, itemsAttire.hashCode, xp.hashCode, badges.hashCode, isRecommended.hashCode, ownerId.hashCode, department.hashCode, hubId.hashCode, manager.hashCode, english.hashCode, backgroundCheckStatus.hashCode, employmentType.hashCode, initial.hashCode, englishRequired.hashCode, city.hashCode, addres.hashCode]);
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@@ -522,6 +533,9 @@ class UpdateStaffVariables {
if(bio.state == OptionalState.set) { if(bio.state == OptionalState.set) {
json['bio'] = bio.toJson(); json['bio'] = bio.toJson();
} }
if(skills.state == OptionalState.set) {
json['skills'] = skills.toJson();
}
if(industries.state == OptionalState.set) { if(industries.state == OptionalState.set) {
json['industries'] = industries.toJson(); json['industries'] = industries.toJson();
} }
@@ -598,6 +612,7 @@ class UpdateStaffVariables {
required this.cancellationCount, required this.cancellationCount,
required this.reliabilityScore, required this.reliabilityScore,
required this.bio, required this.bio,
required this.skills,
required this.industries, required this.industries,
required this.preferredLocations, required this.preferredLocations,
required this.maxDistanceMiles, required this.maxDistanceMiles,

View File

@@ -0,0 +1,29 @@
import 'package:krow_domain/krow_domain.dart' as domain;
class StaffSession {
final domain.User user;
final domain.Staff? staff;
const StaffSession({
required this.user,
this.staff,
});
}
class StaffSessionStore {
StaffSession? _session;
StaffSession? get session => _session;
void setSession(StaffSession session) {
_session = session;
}
void clear() {
_session = null;
}
static final StaffSessionStore instance = StaffSessionStore._();
StaffSessionStore._();
}

View File

@@ -4,6 +4,7 @@ import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_data_connect/firebase_data_connect.dart'; import 'package:firebase_data_connect/firebase_data_connect.dart';
import 'package:krow_data_connect/krow_data_connect.dart'; import 'package:krow_data_connect/krow_data_connect.dart';
import 'package:krow_domain/krow_domain.dart' as domain; import 'package:krow_domain/krow_domain.dart' as domain;
import '../../domain/ui_entities/auth_mode.dart';
import '../../domain/repositories/auth_repository_interface.dart'; import '../../domain/repositories/auth_repository_interface.dart';
@@ -67,6 +68,7 @@ class AuthRepositoryImpl implements AuthRepositoryInterface {
/// Signs out the current user. /// Signs out the current user.
@override @override
Future<void> signOut() { Future<void> signOut() {
StaffSessionStore.instance.clear();
return firebaseAuth.signOut(); return firebaseAuth.signOut();
} }
@@ -75,6 +77,7 @@ class AuthRepositoryImpl implements AuthRepositoryInterface {
Future<domain.User?> verifyOtp({ Future<domain.User?> verifyOtp({
required String verificationId, required String verificationId,
required String smsCode, required String smsCode,
required AuthMode mode,
}) async { }) async {
final PhoneAuthCredential credential = PhoneAuthProvider.credential( final PhoneAuthCredential credential = PhoneAuthProvider.credential(
verificationId: verificationId, verificationId: verificationId,
@@ -86,33 +89,88 @@ class AuthRepositoryImpl implements AuthRepositoryInterface {
throw Exception('Phone verification failed, no Firebase user received.'); throw Exception('Phone verification failed, no Firebase user received.');
} }
final QueryResult<GetUserByIdData, GetUserByIdVariables> response = await dataConnect.getUserById( final QueryResult<GetUserByIdData, GetUserByIdVariables> response =
id: firebaseUser.uid, await dataConnect.getUserById(
).execute(); id: firebaseUser.uid,
).execute();
final GetUserByIdUser? user = response.data.user; final GetUserByIdUser? user = response.data.user;
if (user == null) {
await firebaseAuth.signOut(); GetStaffByUserIdStaffs? staffRecord;
throw Exception('Authenticated user profile not found in database.');
} if (mode == AuthMode.signup) {
if (user.userRole != 'STAFF') { if (user == null) {
await firebaseAuth.signOut(); await dataConnect
throw Exception('User is not authorized for this app.'); .createUser(
id: firebaseUser.uid,
role: UserBaseRole.USER,
)
.userRole('STAFF')
.execute();
} else {
if (user.userRole != 'STAFF') {
await firebaseAuth.signOut();
throw Exception('User is not authorized for this app.');
}
final QueryResult<GetStaffByUserIdData, GetStaffByUserIdVariables>
staffResponse = await dataConnect.getStaffByUserId(
userId: firebaseUser.uid,
).execute();
if (staffResponse.data.staffs.isNotEmpty) {
await firebaseAuth.signOut();
throw Exception(
'This user already has a staff profile. Please log in.',
);
}
}
} else {
if (user == null) {
await firebaseAuth.signOut();
throw Exception('Authenticated user profile not found in database.');
}
if (user.userRole != 'STAFF') {
await firebaseAuth.signOut();
throw Exception('User is not authorized for this app.');
}
final QueryResult<GetStaffByUserIdData, GetStaffByUserIdVariables>
staffResponse = await dataConnect.getStaffByUserId(
userId: firebaseUser.uid,
).execute();
if (staffResponse.data.staffs.isEmpty) {
await firebaseAuth.signOut();
throw Exception(
'Your account is not registered yet. Please register first.',
);
}
staffRecord = staffResponse.data.staffs.first;
} }
final String email = user.email ?? ''; final String email = user?.email ?? '';
if (email.isEmpty) {
await firebaseAuth.signOut();
throw Exception('User email is missing in profile data.');
}
//TO-DO: validate if user has staff account, else logout, throw message and login
//TO-DO: create(registration) user and staff account //TO-DO: create(registration) user and staff account
//TO-DO: save user data locally //TO-DO: save user data locally
return domain.User( final domain.User domainUser = domain.User(
id: user.id, id: firebaseUser.uid,
email: email, email: email,
phone: firebaseUser.phoneNumber, phone: firebaseUser.phoneNumber,
role: user.role.stringValue, 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: domainStaff),
);
return domainUser;
} }
} }

View File

@@ -1,4 +1,5 @@
import 'package:krow_core/core.dart'; import 'package:krow_core/core.dart';
import '../ui_entities/auth_mode.dart';
/// Represents the arguments required for the [VerifyOtpUseCase]. /// Represents the arguments required for the [VerifyOtpUseCase].
/// ///
@@ -11,14 +12,18 @@ class VerifyOtpArguments extends UseCaseArgument {
/// The one-time password (OTP) sent to the user's phone. /// The one-time password (OTP) sent to the user's phone.
final String smsCode; final String smsCode;
/// The authentication mode (login or signup).
final AuthMode mode;
/// Creates a [VerifyOtpArguments] instance. /// Creates a [VerifyOtpArguments] instance.
/// ///
/// Both [verificationId] and [smsCode] are required. /// Both [verificationId] and [smsCode] are required.
const VerifyOtpArguments({ const VerifyOtpArguments({
required this.verificationId, required this.verificationId,
required this.smsCode, required this.smsCode,
required this.mode,
}); });
@override @override
List<Object> get props => <Object>[verificationId, smsCode]; List<Object> get props => <Object>[verificationId, smsCode, mode];
} }

View File

@@ -1,4 +1,5 @@
import 'package:krow_domain/krow_domain.dart'; import 'package:krow_domain/krow_domain.dart';
import '../ui_entities/auth_mode.dart';
/// Interface for authentication repository. /// Interface for authentication repository.
abstract interface class AuthRepositoryInterface { abstract interface class AuthRepositoryInterface {
@@ -11,6 +12,7 @@ abstract interface class AuthRepositoryInterface {
Future<User?> verifyOtp({ Future<User?> verifyOtp({
required String verificationId, required String verificationId,
required String smsCode, required String smsCode,
required AuthMode mode,
}); });
/// Signs out the current user. /// Signs out the current user.

View File

@@ -19,6 +19,7 @@ class VerifyOtpUseCase implements UseCase<VerifyOtpArguments, User?> {
return _repository.verifyOtp( return _repository.verifyOtp(
verificationId: arguments.verificationId, verificationId: arguments.verificationId,
smsCode: arguments.smsCode, smsCode: arguments.smsCode,
mode: arguments.mode,
); );
} }
} }

View File

@@ -93,6 +93,7 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> implements Disposable {
VerifyOtpArguments( VerifyOtpArguments(
verificationId: event.verificationId, verificationId: event.verificationId,
smsCode: event.smsCode, smsCode: event.smsCode,
mode: event.mode,
), ),
); );
emit(state.copyWith(status: AuthStatus.authenticated, user: user)); emit(state.copyWith(status: AuthStatus.authenticated, user: user));

View File

@@ -33,10 +33,17 @@ class AuthOtpSubmitted extends AuthEvent {
/// The SMS code (OTP) entered by the user. /// The SMS code (OTP) entered by the user.
final String smsCode; final String smsCode;
const AuthOtpSubmitted({required this.verificationId, required this.smsCode}); /// The authentication mode (login or signup).
final AuthMode mode;
const AuthOtpSubmitted({
required this.verificationId,
required this.smsCode,
required this.mode,
});
@override @override
List<Object> get props => <Object>[verificationId, smsCode]; List<Object> get props => <Object>[verificationId, smsCode, mode];
} }
/// Event for clearing any authentication error in the state. /// Event for clearing any authentication error in the state.

View File

@@ -1,5 +1,9 @@
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:firebase_auth/firebase_auth.dart' as auth;
import 'package:firebase_data_connect/firebase_data_connect.dart' as fdc;
import 'package:krow_data_connect/krow_data_connect.dart' as dc;
import 'package:krow_domain/krow_domain.dart';
import 'profile_setup_event.dart'; import 'profile_setup_event.dart';
import 'profile_setup_state.dart'; import 'profile_setup_state.dart';
@@ -8,8 +12,12 @@ export 'profile_setup_state.dart';
/// BLoC responsible for managing the profile setup state and logic. /// BLoC responsible for managing the profile setup state and logic.
class ProfileSetupBloc extends Bloc<ProfileSetupEvent, ProfileSetupState> { class ProfileSetupBloc extends Bloc<ProfileSetupEvent, ProfileSetupState> {
/// Creates a [ProfileSetupBloc] with an initial state. ProfileSetupBloc({
ProfileSetupBloc() : super(const ProfileSetupState()) { required auth.FirebaseAuth firebaseAuth,
required dc.ExampleConnector dataConnect,
}) : _firebaseAuth = firebaseAuth,
_dataConnect = dataConnect,
super(const ProfileSetupState()) {
on<ProfileSetupFullNameChanged>(_onFullNameChanged); on<ProfileSetupFullNameChanged>(_onFullNameChanged);
on<ProfileSetupBioChanged>(_onBioChanged); on<ProfileSetupBioChanged>(_onBioChanged);
on<ProfileSetupLocationsChanged>(_onLocationsChanged); on<ProfileSetupLocationsChanged>(_onLocationsChanged);
@@ -19,6 +27,9 @@ class ProfileSetupBloc extends Bloc<ProfileSetupEvent, ProfileSetupState> {
on<ProfileSetupSubmitted>(_onSubmitted); on<ProfileSetupSubmitted>(_onSubmitted);
} }
final auth.FirebaseAuth _firebaseAuth;
final dc.ExampleConnector _dataConnect;
/// Handles the [ProfileSetupFullNameChanged] event. /// Handles the [ProfileSetupFullNameChanged] event.
void _onFullNameChanged( void _onFullNameChanged(
ProfileSetupFullNameChanged event, ProfileSetupFullNameChanged event,
@@ -75,17 +86,44 @@ class ProfileSetupBloc extends Bloc<ProfileSetupEvent, ProfileSetupState> {
emit(state.copyWith(status: ProfileSetupStatus.loading)); emit(state.copyWith(status: ProfileSetupStatus.loading));
try { try {
// In a real app, we would send this data to a UseCase final auth.User? firebaseUser = _firebaseAuth.currentUser;
debugPrint('Submitting Profile:'); if (firebaseUser == null) {
debugPrint('Name: ${state.fullName}'); throw Exception('User not authenticated.');
debugPrint('Bio: ${state.bio}'); }
debugPrint('Locations: ${state.preferredLocations}');
debugPrint('Distance: ${state.maxDistanceMiles}');
debugPrint('Skills: ${state.skills}');
debugPrint('Industries: ${state.industries}');
// Mocking profile creation delay final dc.StaffSession? session = dc.StaffSessionStore.instance.session;
await Future.delayed(const Duration(milliseconds: 1500)); final String email = session?.user.email ?? '';
final String? phone = firebaseUser.phoneNumber;
final fdc.OperationResult<dc.CreateStaffData, dc.CreateStaffVariables>
result = await _dataConnect
.createStaff(
userId: firebaseUser.uid,
fullName: state.fullName,
)
.bio(state.bio.isEmpty ? null : state.bio)
.preferredLocations(fdc.AnyValue(state.preferredLocations))
.maxDistanceMiles(state.maxDistanceMiles.toInt())
.industries(fdc.AnyValue(state.industries))
.skills(fdc.AnyValue(state.skills))
.email(email.isEmpty ? null : email)
.phone(phone)
.execute();
final String staffId = result.data?.staff_insert.id ?? '';
final Staff staff = Staff(
id: staffId,
authProviderId: firebaseUser.uid,
name: state.fullName,
email: email,
phone: phone,
status: StaffStatus.completedProfile,
);
if (session != null) {
dc.StaffSessionStore.instance.setSession(
dc.StaffSession(user: session.user, staff: staff),
);
}
emit(state.copyWith(status: ProfileSetupStatus.success)); emit(state.copyWith(status: ProfileSetupStatus.success));
} catch (e) { } catch (e) {

View File

@@ -50,7 +50,13 @@ class PhoneVerificationPage extends StatelessWidget {
}) { }) {
BlocProvider.of<AuthBloc>( BlocProvider.of<AuthBloc>(
context, context,
).add(AuthOtpSubmitted(verificationId: verificationId, smsCode: otp)); ).add(
AuthOtpSubmitted(
verificationId: verificationId,
smsCode: otp,
mode: mode,
),
);
} }
/// Handles the request to resend the verification code using the phone number in the state. /// Handles the request to resend the verification code using the phone number in the state.
@@ -72,6 +78,19 @@ class PhoneVerificationPage extends StatelessWidget {
} else { } else {
Modular.to.pushWorkerHome(); Modular.to.pushWorkerHome();
} }
} else if (state.status == AuthStatus.error &&
state.mode == AuthMode.signup) {
final String message = state.errorMessage ?? '';
if (message.contains('staff profile')) {
Modular.to.pushReplacementNamed(
'./phone-verification',
arguments: <String, String>{
'mode': AuthMode.login.name,
},
);
} else if (message.contains('not authorized')) {
Modular.to.pop();
}
} }
}, },
child: BlocBuilder<AuthBloc, AuthState>( child: BlocBuilder<AuthBloc, AuthState>(

View File

@@ -47,7 +47,12 @@ class StaffAuthenticationModule extends Module {
verifyOtpUseCase: i.get<VerifyOtpUseCase>(), verifyOtpUseCase: i.get<VerifyOtpUseCase>(),
), ),
); );
i.add<ProfileSetupBloc>(ProfileSetupBloc.new); i.add<ProfileSetupBloc>(
() => ProfileSetupBloc(
firebaseAuth: firebase.FirebaseAuth.instance,
dataConnect: ExampleConnector.instance,
),
);
} }
@override @override

View File

@@ -19,81 +19,26 @@ class BankAccountRepositoryImpl implements BankAccountRepository {
Future<List<BankAccount>> getAccounts() async { Future<List<BankAccount>> getAccounts() async {
final auth.User? user = firebaseAuth.currentUser; final auth.User? user = firebaseAuth.currentUser;
if (user == null) throw Exception('User not authenticated'); if (user == null) throw Exception('User not authenticated');
final String? staffId = StaffSessionStore.instance.session?.staff?.id;
if (staffId == null || staffId.isEmpty) {
print('BankAccount getAccounts: missing staffId userId=${user.uid} session=${StaffSessionStore.instance.session}');
throw Exception('Staff profile is missing.');
}
// return some mock data for now final QueryResult<GetAccountsByOwnerIdData, GetAccountsByOwnerIdVariables>
return [ result = await dataConnect
BankAccount( .getAccountsByOwnerId(ownerId: staffId)
id: '1', .execute();
userId: user.uid,
bankName: 'Mock Bank',
accountNumber: '****1234',
accountName: 'My Checking Account',
type: BankAccountType.checking,
last4: '1234',
isPrimary: true,
),
BankAccount(
id: '2',
userId: user.uid,
bankName: 'Mock Bank',
accountNumber: '****5678',
accountName: 'My Savings Account',
type: BankAccountType.savings,
last4: '5678',
isPrimary: false,
),
BankAccount(
id: '3',
userId: user.uid,
bankName: 'Mock Bank',
accountNumber: '****1234',
accountName: 'My Checking Account',
type: BankAccountType.checking,
last4: '1234',
isPrimary: true,
),
BankAccount(
id: '4',
userId: user.uid,
bankName: 'Mock Bank',
accountNumber: '****5678',
accountName: 'My Savings Account',
type: BankAccountType.savings,
last4: '5678',
isPrimary: false,
),
BankAccount(
id: '5',
userId: user.uid,
bankName: 'Mock Bank',
accountNumber: '****1234',
accountName: 'My Checking Account',
type: BankAccountType.checking,
last4: '1234',
isPrimary: true,
),
BankAccount(
id: '6',
userId: user.uid,
bankName: 'Mock Bank',
accountNumber: '****5678',
accountName: 'My Savings Account',
type: BankAccountType.savings,
last4: '5678',
isPrimary: false,
),
];
final QueryResult<GetAccountsByOwnerIdData, GetAccountsByOwnerIdVariables> result = await dataConnect.getAccountsByOwnerId(ownerId: user.uid).execute();
return result.data.accounts.map((GetAccountsByOwnerIdAccounts account) { return result.data.accounts.map((GetAccountsByOwnerIdAccounts account) {
return BankAccount( return BankAccount(
id: account.id, id: account.id,
userId: account.ownerId, userId: account.ownerId,
bankName: account.bank, bankName: account.bank,
accountNumber: account.last4, // Using last4 as account number representation for now accountNumber: account.accountNumber ?? '',
last4: account.last4, last4: account.last4,
accountName: '', // Not returned by API accountName: '', // Not returned by API
sortCode: account.routeNumber,
type: _mapAccountType(account.type), type: _mapAccountType(account.type),
isPrimary: account.isPrimary ?? false, isPrimary: account.isPrimary ?? false,
); );
@@ -104,13 +49,25 @@ class BankAccountRepositoryImpl implements BankAccountRepository {
Future<void> addAccount(BankAccount account) async { Future<void> addAccount(BankAccount account) async {
final auth.User? user = firebaseAuth.currentUser; final auth.User? user = firebaseAuth.currentUser;
if (user == null) throw Exception('User not authenticated'); if (user == null) throw Exception('User not authenticated');
final String? staffId = StaffSessionStore.instance.session?.staff?.id;
if (staffId == null || staffId.isEmpty) {
print('BankAccount addAccount: missing staffId userId=${user.uid} session=${StaffSessionStore.instance.session}');
throw Exception('Staff profile is missing.');
}
final QueryResult<GetAccountsByOwnerIdData, GetAccountsByOwnerIdVariables>
existingAccounts = await dataConnect
.getAccountsByOwnerId(ownerId: staffId)
.execute();
final bool hasAccounts = existingAccounts.data.accounts.isNotEmpty;
final bool isPrimary = !hasAccounts;
await dataConnect.createAccount( await dataConnect.createAccount(
bank: account.bankName, bank: account.bankName,
type: _mapDomainType(account.type), type: _mapDomainType(account.type),
last4: account.last4 ?? account.accountNumber.substring(account.accountNumber.length - 4), last4: _safeLast4(account.last4, account.accountNumber),
ownerId: user.uid, ownerId: staffId,
).isPrimary(account.isPrimary).execute(); ).isPrimary(isPrimary).accountNumber(account.accountNumber).routeNumber(account.sortCode).execute();
} }
BankAccountType _mapAccountType(EnumValue<AccountType> type) { BankAccountType _mapAccountType(EnumValue<AccountType> type) {
@@ -135,4 +92,16 @@ class BankAccountRepositoryImpl implements BankAccountRepository {
return AccountType.CHECKING; // Default fallback return AccountType.CHECKING; // Default fallback
} }
} }
String _safeLast4(String? last4, String accountNumber) {
if (last4 != null && last4.isNotEmpty) {
return last4;
}
if (accountNumber.isEmpty) {
return '';
}
return accountNumber.length > 4
? accountNumber.substring(accountNumber.length - 4)
: accountNumber;
}
} }

View File

@@ -51,6 +51,7 @@ class BankAccountCubit extends Cubit<BankAccountState> {
bankName: 'New Bank', // Mock bankName: 'New Bank', // Mock
accountNumber: accountNumber, accountNumber: accountNumber,
accountName: '', accountName: '',
sortCode: routingNumber,
type: type == 'CHECKING' ? BankAccountType.checking : BankAccountType.savings, type: type == 'CHECKING' ? BankAccountType.checking : BankAccountType.savings,
last4: accountNumber.length > 4 ? accountNumber.substring(accountNumber.length - 4) : accountNumber, last4: accountNumber.length > 4 ? accountNumber.substring(accountNumber.length - 4) : accountNumber,
isPrimary: false, isPrimary: false,

View File

@@ -206,7 +206,11 @@ class BankAccountPage extends StatelessWidget {
), ),
), ),
Text( Text(
strings.account_ending(last4: account.last4), strings.account_ending(
last4: account.last4?.isNotEmpty == true
? account.last4!
: '----',
),
style: UiTypography.body2r.copyWith( // Was body2 style: UiTypography.body2r.copyWith( // Was body2
color: UiColors.textSecondary, color: UiColors.textSecondary,
), ),

View File

@@ -4,6 +4,8 @@ mutation createAccount(
$last4: String! $last4: String!
$isPrimary: Boolean $isPrimary: Boolean
$ownerId: UUID! $ownerId: UUID!
$accountNumber: String
$routeNumber: String
) @auth(level: USER) { ) @auth(level: USER) {
account_insert( account_insert(
data: { data: {
@@ -12,6 +14,8 @@ mutation createAccount(
last4: $last4 last4: $last4
isPrimary: $isPrimary isPrimary: $isPrimary
ownerId: $ownerId ownerId: $ownerId
accountNumber: $accountNumber
routeNumber: $routeNumber
} }
) )
} }
@@ -22,6 +26,8 @@ mutation updateAccount(
$type: AccountType $type: AccountType
$last4: String $last4: String
$isPrimary: Boolean $isPrimary: Boolean
$accountNumber: String
$routeNumber: String
) @auth(level: USER) { ) @auth(level: USER) {
account_update( account_update(
id: $id id: $id
@@ -30,6 +36,8 @@ mutation updateAccount(
type: $type type: $type
last4: $last4 last4: $last4
isPrimary: $isPrimary isPrimary: $isPrimary
accountNumber: $accountNumber
routeNumber: $routeNumber
} }
) )
} }

View File

@@ -6,9 +6,9 @@ query listAccounts @auth(level: USER) {
last4 last4
isPrimary isPrimary
ownerId ownerId
accountNumber
routeNumber
createdAt createdAt
updatedAt
createdBy
} }
} }
@@ -20,9 +20,9 @@ query getAccountById($id: UUID!) @auth(level: USER) {
last4 last4
isPrimary isPrimary
ownerId ownerId
accountNumber
routeNumber
createdAt createdAt
updatedAt
createdBy
} }
} }
@@ -34,9 +34,9 @@ query getAccountsByOwnerId($ownerId: UUID!) @auth(level: USER) {
last4 last4
isPrimary isPrimary
ownerId ownerId
accountNumber
routeNumber
createdAt createdAt
updatedAt
createdBy
} }
} }
@@ -60,5 +60,7 @@ query filterAccounts(
last4 last4
isPrimary isPrimary
ownerId ownerId
accountNumber
routeNumber
} }
} }

View File

@@ -15,7 +15,7 @@ mutation CreateStaff(
$reliabilityScore: Int $reliabilityScore: Int
$bio: String $bio: String
#$skills: Any $skills: Any
$industries: Any $industries: Any
$preferredLocations: Any $preferredLocations: Any
$maxDistanceMiles: Int $maxDistanceMiles: Int
@@ -59,7 +59,7 @@ mutation CreateStaff(
reliabilityScore: $reliabilityScore reliabilityScore: $reliabilityScore
bio: $bio bio: $bio
#skills: $skills skills: $skills
industries: $industries industries: $industries
preferredLocations: $preferredLocations preferredLocations: $preferredLocations
maxDistanceMiles: $maxDistanceMiles maxDistanceMiles: $maxDistanceMiles
@@ -106,7 +106,7 @@ mutation UpdateStaff(
$reliabilityScore: Int $reliabilityScore: Int
$bio: String $bio: String
#$skills: Any $skills: Any
$industries: Any $industries: Any
$preferredLocations: Any $preferredLocations: Any
$maxDistanceMiles: Int $maxDistanceMiles: Int
@@ -151,7 +151,7 @@ mutation UpdateStaff(
reliabilityScore: $reliabilityScore reliabilityScore: $reliabilityScore
bio: $bio bio: $bio
#skills: $skills skills: $skills
industries: $industries industries: $industries
preferredLocations: $preferredLocations preferredLocations: $preferredLocations
maxDistanceMiles: $maxDistanceMiles maxDistanceMiles: $maxDistanceMiles

View File

@@ -20,7 +20,7 @@ query listStaff @auth(level: USER) {
isRecommended isRecommended
bio bio
#skills skills
industries industries
preferredLocations preferredLocations
maxDistanceMiles maxDistanceMiles
@@ -65,7 +65,7 @@ query getStaffById($id: UUID!) @auth(level: USER) {
isRecommended isRecommended
bio bio
#skills skills
industries industries
preferredLocations preferredLocations
maxDistanceMiles maxDistanceMiles
@@ -111,7 +111,7 @@ query getStaffByUserId($userId: String!) @auth(level: USER) {
isRecommended isRecommended
bio bio
#skills skills
industries industries
preferredLocations preferredLocations
maxDistanceMiles maxDistanceMiles
@@ -162,6 +162,7 @@ query filterStaff(
totalShifts totalShifts
ownerId ownerId
isRecommended isRecommended
skills
backgroundCheckStatus backgroundCheckStatus
employmentType employmentType

View File

@@ -10,6 +10,8 @@ type Account @table(name: "accounts") {
type: AccountType! type: AccountType!
last4: String! last4: String!
isPrimary: Boolean isPrimary: Boolean
accountNumber: String
routeNumber: String
ownerId: UUID! #staff/business ownerId: UUID! #staff/business
createdAt: Timestamp @default(expr: "request.time") createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time") updatedAt: Timestamp @default(expr: "request.time")

View File

@@ -61,7 +61,7 @@ type Staff @table(name: "staffs") {
# Profile # Profile
bio: String bio: String
#skills: Any changed it for staffRole skills: Any #changed it for staffRole
industries: Any industries: Any
preferredLocations: Any preferredLocations: Any
maxDistanceMiles: Int maxDistanceMiles: Int