registration and login ready, with some validations
This commit is contained in:
@@ -24,3 +24,4 @@ export 'src/session/client_session_store.dart';
|
||||
|
||||
// Export the generated Data Connect SDK
|
||||
export 'src/dataconnect_generated/generated.dart';
|
||||
export 'src/session/staff_session_store.dart';
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
# Basic Usage
|
||||
|
||||
```dart
|
||||
ExampleConnector.instance.createTeamMember(createTeamMemberVariables).execute();
|
||||
ExampleConnector.instance.updateTeamMember(updateTeamMemberVariables).execute();
|
||||
ExampleConnector.instance.updateTeamMemberInviteStatus(updateTeamMemberInviteStatusVariables).execute();
|
||||
ExampleConnector.instance.acceptInviteByCode(acceptInviteByCodeVariables).execute();
|
||||
ExampleConnector.instance.cancelInviteByCode(cancelInviteByCodeVariables).execute();
|
||||
ExampleConnector.instance.deleteTeamMember(deleteTeamMemberVariables).execute();
|
||||
ExampleConnector.instance.listActivityLogs(listActivityLogsVariables).execute();
|
||||
ExampleConnector.instance.getActivityLogById(getActivityLogByIdVariables).execute();
|
||||
ExampleConnector.instance.listActivityLogsByUserId(listActivityLogsByUserIdVariables).execute();
|
||||
ExampleConnector.instance.listUnreadActivityLogsByUserId(listUnreadActivityLogsByUserIdVariables).execute();
|
||||
ExampleConnector.instance.CreateUser(createUserVariables).execute();
|
||||
ExampleConnector.instance.UpdateUser(updateUserVariables).execute();
|
||||
ExampleConnector.instance.DeleteUser(deleteUserVariables).execute();
|
||||
ExampleConnector.instance.listVendorRates().execute();
|
||||
ExampleConnector.instance.getVendorRateById(getVendorRateByIdVariables).execute();
|
||||
ExampleConnector.instance.listApplications().execute();
|
||||
ExampleConnector.instance.getApplicationById(getApplicationByIdVariables).execute();
|
||||
ExampleConnector.instance.getApplicationsByShiftId(getApplicationsByShiftIdVariables).execute();
|
||||
ExampleConnector.instance.getApplicationsByShiftIdAndStatus(getApplicationsByShiftIdAndStatusVariables).execute();
|
||||
ExampleConnector.instance.getApplicationsByStaffId(getApplicationsByStaffIdVariables).execute();
|
||||
|
||||
```
|
||||
|
||||
@@ -23,7 +23,7 @@ Optional fields can be discovered based on classes that have `Optional` object t
|
||||
This is an example of a mutation with an optional field:
|
||||
|
||||
```dart
|
||||
await ExampleConnector.instance.getRapidOrders({ ... })
|
||||
await ExampleConnector.instance.listStaffAvailabilitiesByDay({ ... })
|
||||
.offset(...)
|
||||
.execute();
|
||||
```
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -15,6 +15,7 @@ class CreateStaffVariablesBuilder {
|
||||
Optional<int> _cancellationCount = Optional.optional(nativeFromJson, nativeToJson);
|
||||
Optional<int> _reliabilityScore = 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> _preferredLocations = Optional.optional(AnyValue.fromJson, defaultSerializer);
|
||||
Optional<int> _maxDistanceMiles = Optional.optional(nativeFromJson, nativeToJson);
|
||||
@@ -83,6 +84,10 @@ class CreateStaffVariablesBuilder {
|
||||
_bio.value = t;
|
||||
return this;
|
||||
}
|
||||
CreateStaffVariablesBuilder skills(AnyValue? t) {
|
||||
_skills.value = t;
|
||||
return this;
|
||||
}
|
||||
CreateStaffVariablesBuilder industries(AnyValue? t) {
|
||||
_industries.value = t;
|
||||
return this;
|
||||
@@ -168,7 +173,7 @@ class CreateStaffVariablesBuilder {
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -257,6 +262,7 @@ class CreateStaffVariables {
|
||||
late final Optional<int>cancellationCount;
|
||||
late final Optional<int>reliabilityScore;
|
||||
late final Optional<String>bio;
|
||||
late final Optional<AnyValue>skills;
|
||||
late final Optional<AnyValue>industries;
|
||||
late final Optional<AnyValue>preferredLocations;
|
||||
late final Optional<int>maxDistanceMiles;
|
||||
@@ -333,6 +339,10 @@ class CreateStaffVariables {
|
||||
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.value = json['industries'] == null ? null : AnyValue.fromJson(json['industries']);
|
||||
|
||||
@@ -433,6 +443,7 @@ class CreateStaffVariables {
|
||||
cancellationCount == otherTyped.cancellationCount &&
|
||||
reliabilityScore == otherTyped.reliabilityScore &&
|
||||
bio == otherTyped.bio &&
|
||||
skills == otherTyped.skills &&
|
||||
industries == otherTyped.industries &&
|
||||
preferredLocations == otherTyped.preferredLocations &&
|
||||
maxDistanceMiles == otherTyped.maxDistanceMiles &&
|
||||
@@ -455,7 +466,7 @@ class CreateStaffVariables {
|
||||
|
||||
}
|
||||
@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() {
|
||||
@@ -498,6 +509,9 @@ class CreateStaffVariables {
|
||||
if(bio.state == OptionalState.set) {
|
||||
json['bio'] = bio.toJson();
|
||||
}
|
||||
if(skills.state == OptionalState.set) {
|
||||
json['skills'] = skills.toJson();
|
||||
}
|
||||
if(industries.state == OptionalState.set) {
|
||||
json['industries'] = industries.toJson();
|
||||
}
|
||||
@@ -573,6 +587,7 @@ class CreateStaffVariables {
|
||||
required this.cancellationCount,
|
||||
required this.reliabilityScore,
|
||||
required this.bio,
|
||||
required this.skills,
|
||||
required this.industries,
|
||||
required this.preferredLocations,
|
||||
required this.maxDistanceMiles,
|
||||
|
||||
@@ -51,6 +51,7 @@ class FilterStaffStaffs {
|
||||
final int? totalShifts;
|
||||
final String? ownerId;
|
||||
final bool? isRecommended;
|
||||
final AnyValue? skills;
|
||||
final EnumValue<BackgroundCheckStatus>? backgroundCheckStatus;
|
||||
final EnumValue<EmploymentType>? employmentType;
|
||||
final String? initial;
|
||||
@@ -71,6 +72,7 @@ class FilterStaffStaffs {
|
||||
totalShifts = json['totalShifts'] == null ? null : nativeFromJson<int>(json['totalShifts']),
|
||||
ownerId = json['ownerId'] == null ? null : nativeFromJson<String>(json['ownerId']),
|
||||
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']),
|
||||
employmentType = json['employmentType'] == null ? null : employmentTypeDeserializer(json['employmentType']),
|
||||
initial = json['initial'] == null ? null : nativeFromJson<String>(json['initial']),
|
||||
@@ -99,6 +101,7 @@ class FilterStaffStaffs {
|
||||
totalShifts == otherTyped.totalShifts &&
|
||||
ownerId == otherTyped.ownerId &&
|
||||
isRecommended == otherTyped.isRecommended &&
|
||||
skills == otherTyped.skills &&
|
||||
backgroundCheckStatus == otherTyped.backgroundCheckStatus &&
|
||||
employmentType == otherTyped.employmentType &&
|
||||
initial == otherTyped.initial &&
|
||||
@@ -108,7 +111,7 @@ class FilterStaffStaffs {
|
||||
|
||||
}
|
||||
@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() {
|
||||
@@ -143,6 +146,9 @@ class FilterStaffStaffs {
|
||||
if (isRecommended != null) {
|
||||
json['isRecommended'] = nativeToJson<bool?>(isRecommended);
|
||||
}
|
||||
if (skills != null) {
|
||||
json['skills'] = skills!.toJson();
|
||||
}
|
||||
if (backgroundCheckStatus != null) {
|
||||
json['backgroundCheckStatus'] =
|
||||
backgroundCheckStatusSerializer(backgroundCheckStatus!)
|
||||
@@ -181,6 +187,7 @@ class FilterStaffStaffs {
|
||||
this.totalShifts,
|
||||
this.ownerId,
|
||||
this.isRecommended,
|
||||
this.skills,
|
||||
this.backgroundCheckStatus,
|
||||
this.employmentType,
|
||||
this.initial,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -37,6 +37,7 @@ class GetStaffByIdStaff {
|
||||
final AnyValue? badges;
|
||||
final bool? isRecommended;
|
||||
final String? bio;
|
||||
final AnyValue? skills;
|
||||
final AnyValue? industries;
|
||||
final AnyValue? preferredLocations;
|
||||
final int? maxDistanceMiles;
|
||||
@@ -76,6 +77,7 @@ class GetStaffByIdStaff {
|
||||
badges = json['badges'] == null ? null : AnyValue.fromJson(json['badges']),
|
||||
isRecommended = json['isRecommended'] == null ? null : nativeFromJson<bool>(json['isRecommended']),
|
||||
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']),
|
||||
preferredLocations = json['preferredLocations'] == null ? null : AnyValue.fromJson(json['preferredLocations']),
|
||||
maxDistanceMiles = json['maxDistanceMiles'] == null ? null : nativeFromJson<int>(json['maxDistanceMiles']),
|
||||
@@ -123,6 +125,7 @@ class GetStaffByIdStaff {
|
||||
badges == otherTyped.badges &&
|
||||
isRecommended == otherTyped.isRecommended &&
|
||||
bio == otherTyped.bio &&
|
||||
skills == otherTyped.skills &&
|
||||
industries == otherTyped.industries &&
|
||||
preferredLocations == otherTyped.preferredLocations &&
|
||||
maxDistanceMiles == otherTyped.maxDistanceMiles &&
|
||||
@@ -145,7 +148,7 @@ class GetStaffByIdStaff {
|
||||
|
||||
}
|
||||
@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() {
|
||||
@@ -198,6 +201,9 @@ class GetStaffByIdStaff {
|
||||
if (bio != null) {
|
||||
json['bio'] = nativeToJson<String?>(bio);
|
||||
}
|
||||
if (skills != null) {
|
||||
json['skills'] = skills!.toJson();
|
||||
}
|
||||
if (industries != null) {
|
||||
json['industries'] = industries!.toJson();
|
||||
}
|
||||
@@ -285,6 +291,7 @@ class GetStaffByIdStaff {
|
||||
this.badges,
|
||||
this.isRecommended,
|
||||
this.bio,
|
||||
this.skills,
|
||||
this.industries,
|
||||
this.preferredLocations,
|
||||
this.maxDistanceMiles,
|
||||
|
||||
@@ -36,6 +36,7 @@ class GetStaffByUserIdStaffs {
|
||||
final AnyValue? badges;
|
||||
final bool? isRecommended;
|
||||
final String? bio;
|
||||
final AnyValue? skills;
|
||||
final AnyValue? industries;
|
||||
final AnyValue? preferredLocations;
|
||||
final int? maxDistanceMiles;
|
||||
@@ -74,6 +75,7 @@ class GetStaffByUserIdStaffs {
|
||||
badges = json['badges'] == null ? null : AnyValue.fromJson(json['badges']),
|
||||
isRecommended = json['isRecommended'] == null ? null : nativeFromJson<bool>(json['isRecommended']),
|
||||
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']),
|
||||
preferredLocations = json['preferredLocations'] == null ? null : AnyValue.fromJson(json['preferredLocations']),
|
||||
maxDistanceMiles = json['maxDistanceMiles'] == null ? null : nativeFromJson<int>(json['maxDistanceMiles']),
|
||||
@@ -120,6 +122,7 @@ class GetStaffByUserIdStaffs {
|
||||
badges == otherTyped.badges &&
|
||||
isRecommended == otherTyped.isRecommended &&
|
||||
bio == otherTyped.bio &&
|
||||
skills == otherTyped.skills &&
|
||||
industries == otherTyped.industries &&
|
||||
preferredLocations == otherTyped.preferredLocations &&
|
||||
maxDistanceMiles == otherTyped.maxDistanceMiles &&
|
||||
@@ -142,7 +145,7 @@ class GetStaffByUserIdStaffs {
|
||||
|
||||
}
|
||||
@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() {
|
||||
@@ -192,6 +195,9 @@ class GetStaffByUserIdStaffs {
|
||||
if (bio != null) {
|
||||
json['bio'] = nativeToJson<String?>(bio);
|
||||
}
|
||||
if (skills != null) {
|
||||
json['skills'] = skills!.toJson();
|
||||
}
|
||||
if (industries != null) {
|
||||
json['industries'] = industries!.toJson();
|
||||
}
|
||||
@@ -278,6 +284,7 @@ class GetStaffByUserIdStaffs {
|
||||
this.badges,
|
||||
this.isRecommended,
|
||||
this.bio,
|
||||
this.skills,
|
||||
this.industries,
|
||||
this.preferredLocations,
|
||||
this.maxDistanceMiles,
|
||||
|
||||
@@ -36,6 +36,7 @@ class ListStaffStaffs {
|
||||
final AnyValue? badges;
|
||||
final bool? isRecommended;
|
||||
final String? bio;
|
||||
final AnyValue? skills;
|
||||
final AnyValue? industries;
|
||||
final AnyValue? preferredLocations;
|
||||
final int? maxDistanceMiles;
|
||||
@@ -73,6 +74,7 @@ class ListStaffStaffs {
|
||||
badges = json['badges'] == null ? null : AnyValue.fromJson(json['badges']),
|
||||
isRecommended = json['isRecommended'] == null ? null : nativeFromJson<bool>(json['isRecommended']),
|
||||
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']),
|
||||
preferredLocations = json['preferredLocations'] == null ? null : AnyValue.fromJson(json['preferredLocations']),
|
||||
maxDistanceMiles = json['maxDistanceMiles'] == null ? null : nativeFromJson<int>(json['maxDistanceMiles']),
|
||||
@@ -118,6 +120,7 @@ class ListStaffStaffs {
|
||||
badges == otherTyped.badges &&
|
||||
isRecommended == otherTyped.isRecommended &&
|
||||
bio == otherTyped.bio &&
|
||||
skills == otherTyped.skills &&
|
||||
industries == otherTyped.industries &&
|
||||
preferredLocations == otherTyped.preferredLocations &&
|
||||
maxDistanceMiles == otherTyped.maxDistanceMiles &&
|
||||
@@ -138,7 +141,7 @@ class ListStaffStaffs {
|
||||
|
||||
}
|
||||
@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() {
|
||||
@@ -191,6 +194,9 @@ class ListStaffStaffs {
|
||||
if (bio != null) {
|
||||
json['bio'] = nativeToJson<String?>(bio);
|
||||
}
|
||||
if (skills != null) {
|
||||
json['skills'] = skills!.toJson();
|
||||
}
|
||||
if (industries != null) {
|
||||
json['industries'] = industries!.toJson();
|
||||
}
|
||||
@@ -272,6 +278,7 @@ class ListStaffStaffs {
|
||||
this.badges,
|
||||
this.isRecommended,
|
||||
this.bio,
|
||||
this.skills,
|
||||
this.industries,
|
||||
this.preferredLocations,
|
||||
this.maxDistanceMiles,
|
||||
|
||||
@@ -16,6 +16,7 @@ class UpdateStaffVariablesBuilder {
|
||||
Optional<int> _cancellationCount = Optional.optional(nativeFromJson, nativeToJson);
|
||||
Optional<int> _reliabilityScore = 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> _preferredLocations = Optional.optional(AnyValue.fromJson, defaultSerializer);
|
||||
Optional<int> _maxDistanceMiles = Optional.optional(nativeFromJson, nativeToJson);
|
||||
@@ -92,6 +93,10 @@ class UpdateStaffVariablesBuilder {
|
||||
_bio.value = t;
|
||||
return this;
|
||||
}
|
||||
UpdateStaffVariablesBuilder skills(AnyValue? t) {
|
||||
_skills.value = t;
|
||||
return this;
|
||||
}
|
||||
UpdateStaffVariablesBuilder industries(AnyValue? t) {
|
||||
_industries.value = t;
|
||||
return this;
|
||||
@@ -177,7 +182,7 @@ class UpdateStaffVariablesBuilder {
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -269,6 +274,7 @@ class UpdateStaffVariables {
|
||||
late final Optional<int>cancellationCount;
|
||||
late final Optional<int>reliabilityScore;
|
||||
late final Optional<String>bio;
|
||||
late final Optional<AnyValue>skills;
|
||||
late final Optional<AnyValue>industries;
|
||||
late final Optional<AnyValue>preferredLocations;
|
||||
late final Optional<int>maxDistanceMiles;
|
||||
@@ -351,6 +357,10 @@ class UpdateStaffVariables {
|
||||
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.value = json['industries'] == null ? null : AnyValue.fromJson(json['industries']);
|
||||
|
||||
@@ -452,6 +462,7 @@ class UpdateStaffVariables {
|
||||
cancellationCount == otherTyped.cancellationCount &&
|
||||
reliabilityScore == otherTyped.reliabilityScore &&
|
||||
bio == otherTyped.bio &&
|
||||
skills == otherTyped.skills &&
|
||||
industries == otherTyped.industries &&
|
||||
preferredLocations == otherTyped.preferredLocations &&
|
||||
maxDistanceMiles == otherTyped.maxDistanceMiles &&
|
||||
@@ -474,7 +485,7 @@ class UpdateStaffVariables {
|
||||
|
||||
}
|
||||
@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() {
|
||||
@@ -522,6 +533,9 @@ class UpdateStaffVariables {
|
||||
if(bio.state == OptionalState.set) {
|
||||
json['bio'] = bio.toJson();
|
||||
}
|
||||
if(skills.state == OptionalState.set) {
|
||||
json['skills'] = skills.toJson();
|
||||
}
|
||||
if(industries.state == OptionalState.set) {
|
||||
json['industries'] = industries.toJson();
|
||||
}
|
||||
@@ -598,6 +612,7 @@ class UpdateStaffVariables {
|
||||
required this.cancellationCount,
|
||||
required this.reliabilityScore,
|
||||
required this.bio,
|
||||
required this.skills,
|
||||
required this.industries,
|
||||
required this.preferredLocations,
|
||||
required this.maxDistanceMiles,
|
||||
|
||||
@@ -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._();
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import 'package:firebase_auth/firebase_auth.dart';
|
||||
import 'package:firebase_data_connect/firebase_data_connect.dart';
|
||||
import 'package:krow_data_connect/krow_data_connect.dart';
|
||||
import 'package:krow_domain/krow_domain.dart' as domain;
|
||||
import '../../domain/ui_entities/auth_mode.dart';
|
||||
|
||||
import '../../domain/repositories/auth_repository_interface.dart';
|
||||
|
||||
@@ -67,6 +68,7 @@ class AuthRepositoryImpl implements AuthRepositoryInterface {
|
||||
/// Signs out the current user.
|
||||
@override
|
||||
Future<void> signOut() {
|
||||
StaffSessionStore.instance.clear();
|
||||
return firebaseAuth.signOut();
|
||||
}
|
||||
|
||||
@@ -75,6 +77,7 @@ class AuthRepositoryImpl implements AuthRepositoryInterface {
|
||||
Future<domain.User?> verifyOtp({
|
||||
required String verificationId,
|
||||
required String smsCode,
|
||||
required AuthMode mode,
|
||||
}) async {
|
||||
final PhoneAuthCredential credential = PhoneAuthProvider.credential(
|
||||
verificationId: verificationId,
|
||||
@@ -86,33 +89,76 @@ class AuthRepositoryImpl implements AuthRepositoryInterface {
|
||||
throw Exception('Phone verification failed, no Firebase user received.');
|
||||
}
|
||||
|
||||
final QueryResult<GetUserByIdData, GetUserByIdVariables> response = await dataConnect.getUserById(
|
||||
id: firebaseUser.uid,
|
||||
).execute();
|
||||
final QueryResult<GetUserByIdData, GetUserByIdVariables> response =
|
||||
await dataConnect.getUserById(
|
||||
id: firebaseUser.uid,
|
||||
).execute();
|
||||
final GetUserByIdUser? user = response.data.user;
|
||||
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.');
|
||||
|
||||
if (mode == AuthMode.signup) {
|
||||
if (user == null) {
|
||||
await dataConnect
|
||||
.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.',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
final String email = user.email ?? '';
|
||||
if (email.isEmpty) {
|
||||
final String email = user?.email ?? '';
|
||||
if (mode != AuthMode.signup && 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: save user data locally
|
||||
return domain.User(
|
||||
id: user.id,
|
||||
final domain.User domainUser = domain.User(
|
||||
id: firebaseUser.uid,
|
||||
email: email,
|
||||
phone: firebaseUser.phoneNumber,
|
||||
role: user.role.stringValue,
|
||||
role: user?.role.stringValue ?? 'USER',
|
||||
);
|
||||
StaffSessionStore.instance.setSession(
|
||||
StaffSession(user: domainUser, staff: null),
|
||||
);
|
||||
return domainUser;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:krow_core/core.dart';
|
||||
import '../ui_entities/auth_mode.dart';
|
||||
|
||||
/// 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.
|
||||
final String smsCode;
|
||||
|
||||
/// The authentication mode (login or signup).
|
||||
final AuthMode mode;
|
||||
|
||||
/// Creates a [VerifyOtpArguments] instance.
|
||||
///
|
||||
/// Both [verificationId] and [smsCode] are required.
|
||||
const VerifyOtpArguments({
|
||||
required this.verificationId,
|
||||
required this.smsCode,
|
||||
required this.mode,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object> get props => <Object>[verificationId, smsCode];
|
||||
List<Object> get props => <Object>[verificationId, smsCode, mode];
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
import '../ui_entities/auth_mode.dart';
|
||||
|
||||
/// Interface for authentication repository.
|
||||
abstract interface class AuthRepositoryInterface {
|
||||
@@ -11,6 +12,7 @@ abstract interface class AuthRepositoryInterface {
|
||||
Future<User?> verifyOtp({
|
||||
required String verificationId,
|
||||
required String smsCode,
|
||||
required AuthMode mode,
|
||||
});
|
||||
|
||||
/// Signs out the current user.
|
||||
|
||||
@@ -19,6 +19,7 @@ class VerifyOtpUseCase implements UseCase<VerifyOtpArguments, User?> {
|
||||
return _repository.verifyOtp(
|
||||
verificationId: arguments.verificationId,
|
||||
smsCode: arguments.smsCode,
|
||||
mode: arguments.mode,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,6 +93,7 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> implements Disposable {
|
||||
VerifyOtpArguments(
|
||||
verificationId: event.verificationId,
|
||||
smsCode: event.smsCode,
|
||||
mode: event.mode,
|
||||
),
|
||||
);
|
||||
emit(state.copyWith(status: AuthStatus.authenticated, user: user));
|
||||
|
||||
@@ -33,10 +33,17 @@ class AuthOtpSubmitted extends AuthEvent {
|
||||
/// The SMS code (OTP) entered by the user.
|
||||
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
|
||||
List<Object> get props => <Object>[verificationId, smsCode];
|
||||
List<Object> get props => <Object>[verificationId, smsCode, mode];
|
||||
}
|
||||
|
||||
/// Event for clearing any authentication error in the state.
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
import 'package:flutter/foundation.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_state.dart';
|
||||
|
||||
@@ -8,8 +12,12 @@ export 'profile_setup_state.dart';
|
||||
|
||||
/// BLoC responsible for managing the profile setup state and logic.
|
||||
class ProfileSetupBloc extends Bloc<ProfileSetupEvent, ProfileSetupState> {
|
||||
/// Creates a [ProfileSetupBloc] with an initial state.
|
||||
ProfileSetupBloc() : super(const ProfileSetupState()) {
|
||||
ProfileSetupBloc({
|
||||
required auth.FirebaseAuth firebaseAuth,
|
||||
required dc.ExampleConnector dataConnect,
|
||||
}) : _firebaseAuth = firebaseAuth,
|
||||
_dataConnect = dataConnect,
|
||||
super(const ProfileSetupState()) {
|
||||
on<ProfileSetupFullNameChanged>(_onFullNameChanged);
|
||||
on<ProfileSetupBioChanged>(_onBioChanged);
|
||||
on<ProfileSetupLocationsChanged>(_onLocationsChanged);
|
||||
@@ -19,6 +27,9 @@ class ProfileSetupBloc extends Bloc<ProfileSetupEvent, ProfileSetupState> {
|
||||
on<ProfileSetupSubmitted>(_onSubmitted);
|
||||
}
|
||||
|
||||
final auth.FirebaseAuth _firebaseAuth;
|
||||
final dc.ExampleConnector _dataConnect;
|
||||
|
||||
/// Handles the [ProfileSetupFullNameChanged] event.
|
||||
void _onFullNameChanged(
|
||||
ProfileSetupFullNameChanged event,
|
||||
@@ -75,17 +86,44 @@ class ProfileSetupBloc extends Bloc<ProfileSetupEvent, ProfileSetupState> {
|
||||
emit(state.copyWith(status: ProfileSetupStatus.loading));
|
||||
|
||||
try {
|
||||
// In a real app, we would send this data to a UseCase
|
||||
debugPrint('Submitting Profile:');
|
||||
debugPrint('Name: ${state.fullName}');
|
||||
debugPrint('Bio: ${state.bio}');
|
||||
debugPrint('Locations: ${state.preferredLocations}');
|
||||
debugPrint('Distance: ${state.maxDistanceMiles}');
|
||||
debugPrint('Skills: ${state.skills}');
|
||||
debugPrint('Industries: ${state.industries}');
|
||||
final auth.User? firebaseUser = _firebaseAuth.currentUser;
|
||||
if (firebaseUser == null) {
|
||||
throw Exception('User not authenticated.');
|
||||
}
|
||||
|
||||
// Mocking profile creation delay
|
||||
await Future.delayed(const Duration(milliseconds: 1500));
|
||||
final dc.StaffSession? session = dc.StaffSessionStore.instance.session;
|
||||
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));
|
||||
} catch (e) {
|
||||
|
||||
@@ -50,7 +50,13 @@ class PhoneVerificationPage extends StatelessWidget {
|
||||
}) {
|
||||
BlocProvider.of<AuthBloc>(
|
||||
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.
|
||||
@@ -72,6 +78,19 @@ class PhoneVerificationPage extends StatelessWidget {
|
||||
} else {
|
||||
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>(
|
||||
|
||||
@@ -47,7 +47,12 @@ class StaffAuthenticationModule extends Module {
|
||||
verifyOtpUseCase: i.get<VerifyOtpUseCase>(),
|
||||
),
|
||||
);
|
||||
i.add<ProfileSetupBloc>(ProfileSetupBloc.new);
|
||||
i.add<ProfileSetupBloc>(
|
||||
() => ProfileSetupBloc(
|
||||
firebaseAuth: firebase.FirebaseAuth.instance,
|
||||
dataConnect: ExampleConnector.instance,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -15,7 +15,7 @@ mutation CreateStaff(
|
||||
$reliabilityScore: Int
|
||||
|
||||
$bio: String
|
||||
#$skills: Any
|
||||
$skills: Any
|
||||
$industries: Any
|
||||
$preferredLocations: Any
|
||||
$maxDistanceMiles: Int
|
||||
@@ -59,7 +59,7 @@ mutation CreateStaff(
|
||||
reliabilityScore: $reliabilityScore
|
||||
|
||||
bio: $bio
|
||||
#skills: $skills
|
||||
skills: $skills
|
||||
industries: $industries
|
||||
preferredLocations: $preferredLocations
|
||||
maxDistanceMiles: $maxDistanceMiles
|
||||
@@ -106,7 +106,7 @@ mutation UpdateStaff(
|
||||
$reliabilityScore: Int
|
||||
|
||||
$bio: String
|
||||
#$skills: Any
|
||||
$skills: Any
|
||||
$industries: Any
|
||||
$preferredLocations: Any
|
||||
$maxDistanceMiles: Int
|
||||
@@ -151,7 +151,7 @@ mutation UpdateStaff(
|
||||
reliabilityScore: $reliabilityScore
|
||||
|
||||
bio: $bio
|
||||
#skills: $skills
|
||||
skills: $skills
|
||||
industries: $industries
|
||||
preferredLocations: $preferredLocations
|
||||
maxDistanceMiles: $maxDistanceMiles
|
||||
|
||||
@@ -20,7 +20,7 @@ query listStaff @auth(level: USER) {
|
||||
isRecommended
|
||||
|
||||
bio
|
||||
#skills
|
||||
skills
|
||||
industries
|
||||
preferredLocations
|
||||
maxDistanceMiles
|
||||
@@ -65,7 +65,7 @@ query getStaffById($id: UUID!) @auth(level: USER) {
|
||||
isRecommended
|
||||
|
||||
bio
|
||||
#skills
|
||||
skills
|
||||
industries
|
||||
preferredLocations
|
||||
maxDistanceMiles
|
||||
@@ -111,7 +111,7 @@ query getStaffByUserId($userId: String!) @auth(level: USER) {
|
||||
isRecommended
|
||||
|
||||
bio
|
||||
#skills
|
||||
skills
|
||||
industries
|
||||
preferredLocations
|
||||
maxDistanceMiles
|
||||
@@ -162,6 +162,7 @@ query filterStaff(
|
||||
totalShifts
|
||||
ownerId
|
||||
isRecommended
|
||||
skills
|
||||
|
||||
backgroundCheckStatus
|
||||
employmentType
|
||||
|
||||
@@ -61,7 +61,7 @@ type Staff @table(name: "staffs") {
|
||||
|
||||
# Profile
|
||||
bio: String
|
||||
#skills: Any changed it for staffRole
|
||||
skills: Any #changed it for staffRole
|
||||
industries: Any
|
||||
preferredLocations: Any
|
||||
maxDistanceMiles: Int
|
||||
|
||||
Reference in New Issue
Block a user