adding validations for apply

This commit is contained in:
José Salazar
2026-02-02 07:14:54 +09:00
parent 136993caec
commit 761830b380
8 changed files with 19483 additions and 18413 deletions

View File

@@ -1,21 +1,143 @@
PODS:
- AppCheckCore (11.2.0):
- GoogleUtilities/Environment (~> 8.0)
- GoogleUtilities/UserDefaults (~> 8.0)
- PromisesObjC (~> 2.4)
- Firebase/AppCheck (12.8.0):
- Firebase/CoreOnly
- FirebaseAppCheck (~> 12.8.0)
- Firebase/Auth (12.8.0):
- Firebase/CoreOnly
- FirebaseAuth (~> 12.8.0)
- Firebase/CoreOnly (12.8.0):
- FirebaseCore (~> 12.8.0)
- firebase_app_check (0.4.1-4):
- Firebase/AppCheck (~> 12.8.0)
- Firebase/CoreOnly (~> 12.8.0)
- firebase_core
- FlutterMacOS
- firebase_auth (6.1.4):
- Firebase/Auth (~> 12.8.0)
- Firebase/CoreOnly (~> 12.8.0)
- firebase_core
- FlutterMacOS
- firebase_core (4.4.0):
- Firebase/CoreOnly (~> 12.8.0)
- FlutterMacOS
- FirebaseAppCheck (12.8.0):
- AppCheckCore (~> 11.0)
- FirebaseAppCheckInterop (~> 12.8.0)
- FirebaseCore (~> 12.8.0)
- GoogleUtilities/Environment (~> 8.1)
- GoogleUtilities/UserDefaults (~> 8.1)
- FirebaseAppCheckInterop (12.8.0)
- FirebaseAuth (12.8.0):
- FirebaseAppCheckInterop (~> 12.8.0)
- FirebaseAuthInterop (~> 12.8.0)
- FirebaseCore (~> 12.8.0)
- FirebaseCoreExtension (~> 12.8.0)
- GoogleUtilities/AppDelegateSwizzler (~> 8.1)
- GoogleUtilities/Environment (~> 8.1)
- GTMSessionFetcher/Core (< 6.0, >= 3.4)
- RecaptchaInterop (~> 101.0)
- FirebaseAuthInterop (12.8.0)
- FirebaseCore (12.8.0):
- FirebaseCoreInternal (~> 12.8.0)
- GoogleUtilities/Environment (~> 8.1)
- GoogleUtilities/Logger (~> 8.1)
- FirebaseCoreExtension (12.8.0):
- FirebaseCore (~> 12.8.0)
- FirebaseCoreInternal (12.8.0):
- "GoogleUtilities/NSData+zlib (~> 8.1)"
- FlutterMacOS (1.0.0)
- geolocator_apple (1.2.0):
- Flutter
- FlutterMacOS
- GoogleUtilities/AppDelegateSwizzler (8.1.0):
- GoogleUtilities/Environment
- GoogleUtilities/Logger
- GoogleUtilities/Network
- GoogleUtilities/Privacy
- GoogleUtilities/Environment (8.1.0):
- GoogleUtilities/Privacy
- GoogleUtilities/Logger (8.1.0):
- GoogleUtilities/Environment
- GoogleUtilities/Privacy
- GoogleUtilities/Network (8.1.0):
- GoogleUtilities/Logger
- "GoogleUtilities/NSData+zlib"
- GoogleUtilities/Privacy
- GoogleUtilities/Reachability
- "GoogleUtilities/NSData+zlib (8.1.0)":
- GoogleUtilities/Privacy
- GoogleUtilities/Privacy (8.1.0)
- GoogleUtilities/Reachability (8.1.0):
- GoogleUtilities/Logger
- GoogleUtilities/Privacy
- GoogleUtilities/UserDefaults (8.1.0):
- GoogleUtilities/Logger
- GoogleUtilities/Privacy
- GTMSessionFetcher/Core (5.0.0)
- PromisesObjC (2.4.0)
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
DEPENDENCIES:
- firebase_app_check (from `Flutter/ephemeral/.symlinks/plugins/firebase_app_check/macos`)
- firebase_auth (from `Flutter/ephemeral/.symlinks/plugins/firebase_auth/macos`)
- firebase_core (from `Flutter/ephemeral/.symlinks/plugins/firebase_core/macos`)
- FlutterMacOS (from `Flutter/ephemeral`)
- geolocator_apple (from `Flutter/ephemeral/.symlinks/plugins/geolocator_apple/darwin`)
- shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin`)
SPEC REPOS:
trunk:
- AppCheckCore
- Firebase
- FirebaseAppCheck
- FirebaseAppCheckInterop
- FirebaseAuth
- FirebaseAuthInterop
- FirebaseCore
- FirebaseCoreExtension
- FirebaseCoreInternal
- GoogleUtilities
- GTMSessionFetcher
- PromisesObjC
EXTERNAL SOURCES:
firebase_app_check:
:path: Flutter/ephemeral/.symlinks/plugins/firebase_app_check/macos
firebase_auth:
:path: Flutter/ephemeral/.symlinks/plugins/firebase_auth/macos
firebase_core:
:path: Flutter/ephemeral/.symlinks/plugins/firebase_core/macos
FlutterMacOS:
:path: Flutter/ephemeral
geolocator_apple:
:path: Flutter/ephemeral/.symlinks/plugins/geolocator_apple/darwin
shared_preferences_foundation:
:path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin
SPEC CHECKSUMS:
AppCheckCore: cc8fd0a3a230ddd401f326489c99990b013f0c4f
Firebase: 9a58fdbc9d8655ed7b79a19cf9690bb007d3d46d
firebase_app_check: daf97f2d7044e28b68d23bc90e16751acee09732
firebase_auth: 2c2438e41f061c03bd67dcb045dfd7bc843b5f52
firebase_core: b1697fb64ff2b9ca16baaa821205f8b0c058e5d2
FirebaseAppCheck: 11da425929a45c677d537adfff3520ccd57c1690
FirebaseAppCheckInterop: ba3dc604a89815379e61ec2365101608d365cf7d
FirebaseAuth: 4c289b1a43f5955283244a55cf6bd616de344be5
FirebaseAuthInterop: 95363fe96493cb4f106656666a0768b420cba090
FirebaseCore: 0dbad74bda10b8fb9ca34ad8f375fb9dd3ebef7c
FirebaseCoreExtension: 6605938d51f765d8b18bfcafd2085276a252bee2
FirebaseCoreInternal: fe5fa466aeb314787093a7dce9f0beeaad5a2a21
FlutterMacOS: d0db08ddef1a9af05a5ec4b724367152bb0500b1
geolocator_apple: ab36aa0e8b7d7a2d7639b3b4e48308394e8cef5e
GoogleUtilities: 00c88b9a86066ef77f0da2fab05f65d7768ed8e1
GTMSessionFetcher: 02d6e866e90bc236f48a703a041dfe43e6221a29
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
shared_preferences_foundation: 7036424c3d8ec98dfe75ff1667cb0cd531ec82bb
PODFILE CHECKSUM: 54d867c82ac51cbd61b565781b9fada492027009

View File

@@ -1,16 +1,16 @@
# Basic Usage
```dart
ExampleConnector.instance.createApplication(createApplicationVariables).execute();
ExampleConnector.instance.updateApplicationStatus(updateApplicationStatusVariables).execute();
ExampleConnector.instance.deleteApplication(deleteApplicationVariables).execute();
ExampleConnector.instance.createStaffRole(createStaffRoleVariables).execute();
ExampleConnector.instance.deleteStaffRole(deleteStaffRoleVariables).execute();
ExampleConnector.instance.CreateUser(createUserVariables).execute();
ExampleConnector.instance.UpdateUser(updateUserVariables).execute();
ExampleConnector.instance.DeleteUser(deleteUserVariables).execute();
ExampleConnector.instance.createUserConversation(createUserConversationVariables).execute();
ExampleConnector.instance.updateUserConversation(updateUserConversationVariables).execute();
ExampleConnector.instance.listAssignments(listAssignmentsVariables).execute();
ExampleConnector.instance.getAssignmentById(getAssignmentByIdVariables).execute();
ExampleConnector.instance.listAssignmentsByWorkforceId(listAssignmentsByWorkforceIdVariables).execute();
ExampleConnector.instance.listAssignmentsByWorkforceIds(listAssignmentsByWorkforceIdsVariables).execute();
ExampleConnector.instance.listAssignmentsByShiftRole(listAssignmentsByShiftRoleVariables).execute();
ExampleConnector.instance.filterAssignments(filterAssignmentsVariables).execute();
ExampleConnector.instance.createClientFeedback(createClientFeedbackVariables).execute();
ExampleConnector.instance.updateClientFeedback(updateClientFeedbackVariables).execute();
ExampleConnector.instance.deleteClientFeedback(deleteClientFeedbackVariables).execute();
ExampleConnector.instance.createCourse(createCourseVariables).execute();
```

View File

@@ -0,0 +1,675 @@
part of 'generated.dart';
class VaidateDayStaffApplicationVariablesBuilder {
String staffId;
Optional<int> _offset = Optional.optional(nativeFromJson, nativeToJson);
Optional<int> _limit = Optional.optional(nativeFromJson, nativeToJson);
Optional<Timestamp> _dayStart = Optional.optional((json) => json['dayStart'] = Timestamp.fromJson(json['dayStart']), defaultSerializer);
Optional<Timestamp> _dayEnd = Optional.optional((json) => json['dayEnd'] = Timestamp.fromJson(json['dayEnd']), defaultSerializer);
final FirebaseDataConnect _dataConnect; VaidateDayStaffApplicationVariablesBuilder offset(int? t) {
_offset.value = t;
return this;
}
VaidateDayStaffApplicationVariablesBuilder limit(int? t) {
_limit.value = t;
return this;
}
VaidateDayStaffApplicationVariablesBuilder dayStart(Timestamp? t) {
_dayStart.value = t;
return this;
}
VaidateDayStaffApplicationVariablesBuilder dayEnd(Timestamp? t) {
_dayEnd.value = t;
return this;
}
VaidateDayStaffApplicationVariablesBuilder(this._dataConnect, {required this.staffId,});
Deserializer<VaidateDayStaffApplicationData> dataDeserializer = (dynamic json) => VaidateDayStaffApplicationData.fromJson(jsonDecode(json));
Serializer<VaidateDayStaffApplicationVariables> varsSerializer = (VaidateDayStaffApplicationVariables vars) => jsonEncode(vars.toJson());
Future<QueryResult<VaidateDayStaffApplicationData, VaidateDayStaffApplicationVariables>> execute() {
return ref().execute();
}
QueryRef<VaidateDayStaffApplicationData, VaidateDayStaffApplicationVariables> ref() {
VaidateDayStaffApplicationVariables vars= VaidateDayStaffApplicationVariables(staffId: staffId,offset: _offset,limit: _limit,dayStart: _dayStart,dayEnd: _dayEnd,);
return _dataConnect.query("vaidateDayStaffApplication", dataDeserializer, varsSerializer, vars);
}
}
@immutable
class VaidateDayStaffApplicationApplications {
final String id;
final String shiftId;
final String staffId;
final EnumValue<ApplicationStatus> status;
final Timestamp? appliedAt;
final Timestamp? checkInTime;
final Timestamp? checkOutTime;
final EnumValue<ApplicationOrigin> origin;
final Timestamp? createdAt;
final VaidateDayStaffApplicationApplicationsShift shift;
final VaidateDayStaffApplicationApplicationsShiftRole shiftRole;
VaidateDayStaffApplicationApplications.fromJson(dynamic json):
id = nativeFromJson<String>(json['id']),
shiftId = nativeFromJson<String>(json['shiftId']),
staffId = nativeFromJson<String>(json['staffId']),
status = applicationStatusDeserializer(json['status']),
appliedAt = json['appliedAt'] == null ? null : Timestamp.fromJson(json['appliedAt']),
checkInTime = json['checkInTime'] == null ? null : Timestamp.fromJson(json['checkInTime']),
checkOutTime = json['checkOutTime'] == null ? null : Timestamp.fromJson(json['checkOutTime']),
origin = applicationOriginDeserializer(json['origin']),
createdAt = json['createdAt'] == null ? null : Timestamp.fromJson(json['createdAt']),
shift = VaidateDayStaffApplicationApplicationsShift.fromJson(json['shift']),
shiftRole = VaidateDayStaffApplicationApplicationsShiftRole.fromJson(json['shiftRole']);
@override
bool operator ==(Object other) {
if(identical(this, other)) {
return true;
}
if(other.runtimeType != runtimeType) {
return false;
}
final VaidateDayStaffApplicationApplications otherTyped = other as VaidateDayStaffApplicationApplications;
return id == otherTyped.id &&
shiftId == otherTyped.shiftId &&
staffId == otherTyped.staffId &&
status == otherTyped.status &&
appliedAt == otherTyped.appliedAt &&
checkInTime == otherTyped.checkInTime &&
checkOutTime == otherTyped.checkOutTime &&
origin == otherTyped.origin &&
createdAt == otherTyped.createdAt &&
shift == otherTyped.shift &&
shiftRole == otherTyped.shiftRole;
}
@override
int get hashCode => Object.hashAll([id.hashCode, shiftId.hashCode, staffId.hashCode, status.hashCode, appliedAt.hashCode, checkInTime.hashCode, checkOutTime.hashCode, origin.hashCode, createdAt.hashCode, shift.hashCode, shiftRole.hashCode]);
Map<String, dynamic> toJson() {
Map<String, dynamic> json = {};
json['id'] = nativeToJson<String>(id);
json['shiftId'] = nativeToJson<String>(shiftId);
json['staffId'] = nativeToJson<String>(staffId);
json['status'] =
applicationStatusSerializer(status)
;
if (appliedAt != null) {
json['appliedAt'] = appliedAt!.toJson();
}
if (checkInTime != null) {
json['checkInTime'] = checkInTime!.toJson();
}
if (checkOutTime != null) {
json['checkOutTime'] = checkOutTime!.toJson();
}
json['origin'] =
applicationOriginSerializer(origin)
;
if (createdAt != null) {
json['createdAt'] = createdAt!.toJson();
}
json['shift'] = shift.toJson();
json['shiftRole'] = shiftRole.toJson();
return json;
}
VaidateDayStaffApplicationApplications({
required this.id,
required this.shiftId,
required this.staffId,
required this.status,
this.appliedAt,
this.checkInTime,
this.checkOutTime,
required this.origin,
this.createdAt,
required this.shift,
required this.shiftRole,
});
}
@immutable
class VaidateDayStaffApplicationApplicationsShift {
final String id;
final String title;
final Timestamp? date;
final Timestamp? startTime;
final Timestamp? endTime;
final String? location;
final EnumValue<ShiftStatus>? status;
final int? durationDays;
final String? description;
final VaidateDayStaffApplicationApplicationsShiftOrder order;
VaidateDayStaffApplicationApplicationsShift.fromJson(dynamic json):
id = nativeFromJson<String>(json['id']),
title = nativeFromJson<String>(json['title']),
date = json['date'] == null ? null : Timestamp.fromJson(json['date']),
startTime = json['startTime'] == null ? null : Timestamp.fromJson(json['startTime']),
endTime = json['endTime'] == null ? null : Timestamp.fromJson(json['endTime']),
location = json['location'] == null ? null : nativeFromJson<String>(json['location']),
status = json['status'] == null ? null : shiftStatusDeserializer(json['status']),
durationDays = json['durationDays'] == null ? null : nativeFromJson<int>(json['durationDays']),
description = json['description'] == null ? null : nativeFromJson<String>(json['description']),
order = VaidateDayStaffApplicationApplicationsShiftOrder.fromJson(json['order']);
@override
bool operator ==(Object other) {
if(identical(this, other)) {
return true;
}
if(other.runtimeType != runtimeType) {
return false;
}
final VaidateDayStaffApplicationApplicationsShift otherTyped = other as VaidateDayStaffApplicationApplicationsShift;
return id == otherTyped.id &&
title == otherTyped.title &&
date == otherTyped.date &&
startTime == otherTyped.startTime &&
endTime == otherTyped.endTime &&
location == otherTyped.location &&
status == otherTyped.status &&
durationDays == otherTyped.durationDays &&
description == otherTyped.description &&
order == otherTyped.order;
}
@override
int get hashCode => Object.hashAll([id.hashCode, title.hashCode, date.hashCode, startTime.hashCode, endTime.hashCode, location.hashCode, status.hashCode, durationDays.hashCode, description.hashCode, order.hashCode]);
Map<String, dynamic> toJson() {
Map<String, dynamic> json = {};
json['id'] = nativeToJson<String>(id);
json['title'] = nativeToJson<String>(title);
if (date != null) {
json['date'] = date!.toJson();
}
if (startTime != null) {
json['startTime'] = startTime!.toJson();
}
if (endTime != null) {
json['endTime'] = endTime!.toJson();
}
if (location != null) {
json['location'] = nativeToJson<String?>(location);
}
if (status != null) {
json['status'] =
shiftStatusSerializer(status!)
;
}
if (durationDays != null) {
json['durationDays'] = nativeToJson<int?>(durationDays);
}
if (description != null) {
json['description'] = nativeToJson<String?>(description);
}
json['order'] = order.toJson();
return json;
}
VaidateDayStaffApplicationApplicationsShift({
required this.id,
required this.title,
this.date,
this.startTime,
this.endTime,
this.location,
this.status,
this.durationDays,
this.description,
required this.order,
});
}
@immutable
class VaidateDayStaffApplicationApplicationsShiftOrder {
final String id;
final String? eventName;
final VaidateDayStaffApplicationApplicationsShiftOrderTeamHub teamHub;
final VaidateDayStaffApplicationApplicationsShiftOrderBusiness business;
final VaidateDayStaffApplicationApplicationsShiftOrderVendor? vendor;
VaidateDayStaffApplicationApplicationsShiftOrder.fromJson(dynamic json):
id = nativeFromJson<String>(json['id']),
eventName = json['eventName'] == null ? null : nativeFromJson<String>(json['eventName']),
teamHub = VaidateDayStaffApplicationApplicationsShiftOrderTeamHub.fromJson(json['teamHub']),
business = VaidateDayStaffApplicationApplicationsShiftOrderBusiness.fromJson(json['business']),
vendor = json['vendor'] == null ? null : VaidateDayStaffApplicationApplicationsShiftOrderVendor.fromJson(json['vendor']);
@override
bool operator ==(Object other) {
if(identical(this, other)) {
return true;
}
if(other.runtimeType != runtimeType) {
return false;
}
final VaidateDayStaffApplicationApplicationsShiftOrder otherTyped = other as VaidateDayStaffApplicationApplicationsShiftOrder;
return id == otherTyped.id &&
eventName == otherTyped.eventName &&
teamHub == otherTyped.teamHub &&
business == otherTyped.business &&
vendor == otherTyped.vendor;
}
@override
int get hashCode => Object.hashAll([id.hashCode, eventName.hashCode, teamHub.hashCode, business.hashCode, vendor.hashCode]);
Map<String, dynamic> toJson() {
Map<String, dynamic> json = {};
json['id'] = nativeToJson<String>(id);
if (eventName != null) {
json['eventName'] = nativeToJson<String?>(eventName);
}
json['teamHub'] = teamHub.toJson();
json['business'] = business.toJson();
if (vendor != null) {
json['vendor'] = vendor!.toJson();
}
return json;
}
VaidateDayStaffApplicationApplicationsShiftOrder({
required this.id,
this.eventName,
required this.teamHub,
required this.business,
this.vendor,
});
}
@immutable
class VaidateDayStaffApplicationApplicationsShiftOrderTeamHub {
final String address;
final String? placeId;
final String hubName;
VaidateDayStaffApplicationApplicationsShiftOrderTeamHub.fromJson(dynamic json):
address = nativeFromJson<String>(json['address']),
placeId = json['placeId'] == null ? null : nativeFromJson<String>(json['placeId']),
hubName = nativeFromJson<String>(json['hubName']);
@override
bool operator ==(Object other) {
if(identical(this, other)) {
return true;
}
if(other.runtimeType != runtimeType) {
return false;
}
final VaidateDayStaffApplicationApplicationsShiftOrderTeamHub otherTyped = other as VaidateDayStaffApplicationApplicationsShiftOrderTeamHub;
return address == otherTyped.address &&
placeId == otherTyped.placeId &&
hubName == otherTyped.hubName;
}
@override
int get hashCode => Object.hashAll([address.hashCode, placeId.hashCode, hubName.hashCode]);
Map<String, dynamic> toJson() {
Map<String, dynamic> json = {};
json['address'] = nativeToJson<String>(address);
if (placeId != null) {
json['placeId'] = nativeToJson<String?>(placeId);
}
json['hubName'] = nativeToJson<String>(hubName);
return json;
}
VaidateDayStaffApplicationApplicationsShiftOrderTeamHub({
required this.address,
this.placeId,
required this.hubName,
});
}
@immutable
class VaidateDayStaffApplicationApplicationsShiftOrderBusiness {
final String id;
final String businessName;
final String? email;
final String? contactName;
final String? companyLogoUrl;
VaidateDayStaffApplicationApplicationsShiftOrderBusiness.fromJson(dynamic json):
id = nativeFromJson<String>(json['id']),
businessName = nativeFromJson<String>(json['businessName']),
email = json['email'] == null ? null : nativeFromJson<String>(json['email']),
contactName = json['contactName'] == null ? null : nativeFromJson<String>(json['contactName']),
companyLogoUrl = json['companyLogoUrl'] == null ? null : nativeFromJson<String>(json['companyLogoUrl']);
@override
bool operator ==(Object other) {
if(identical(this, other)) {
return true;
}
if(other.runtimeType != runtimeType) {
return false;
}
final VaidateDayStaffApplicationApplicationsShiftOrderBusiness otherTyped = other as VaidateDayStaffApplicationApplicationsShiftOrderBusiness;
return id == otherTyped.id &&
businessName == otherTyped.businessName &&
email == otherTyped.email &&
contactName == otherTyped.contactName &&
companyLogoUrl == otherTyped.companyLogoUrl;
}
@override
int get hashCode => Object.hashAll([id.hashCode, businessName.hashCode, email.hashCode, contactName.hashCode, companyLogoUrl.hashCode]);
Map<String, dynamic> toJson() {
Map<String, dynamic> json = {};
json['id'] = nativeToJson<String>(id);
json['businessName'] = nativeToJson<String>(businessName);
if (email != null) {
json['email'] = nativeToJson<String?>(email);
}
if (contactName != null) {
json['contactName'] = nativeToJson<String?>(contactName);
}
if (companyLogoUrl != null) {
json['companyLogoUrl'] = nativeToJson<String?>(companyLogoUrl);
}
return json;
}
VaidateDayStaffApplicationApplicationsShiftOrderBusiness({
required this.id,
required this.businessName,
this.email,
this.contactName,
this.companyLogoUrl,
});
}
@immutable
class VaidateDayStaffApplicationApplicationsShiftOrderVendor {
final String id;
final String companyName;
VaidateDayStaffApplicationApplicationsShiftOrderVendor.fromJson(dynamic json):
id = nativeFromJson<String>(json['id']),
companyName = nativeFromJson<String>(json['companyName']);
@override
bool operator ==(Object other) {
if(identical(this, other)) {
return true;
}
if(other.runtimeType != runtimeType) {
return false;
}
final VaidateDayStaffApplicationApplicationsShiftOrderVendor otherTyped = other as VaidateDayStaffApplicationApplicationsShiftOrderVendor;
return id == otherTyped.id &&
companyName == otherTyped.companyName;
}
@override
int get hashCode => Object.hashAll([id.hashCode, companyName.hashCode]);
Map<String, dynamic> toJson() {
Map<String, dynamic> json = {};
json['id'] = nativeToJson<String>(id);
json['companyName'] = nativeToJson<String>(companyName);
return json;
}
VaidateDayStaffApplicationApplicationsShiftOrderVendor({
required this.id,
required this.companyName,
});
}
@immutable
class VaidateDayStaffApplicationApplicationsShiftRole {
final String id;
final String roleId;
final int count;
final int? assigned;
final Timestamp? startTime;
final Timestamp? endTime;
final double? hours;
final double? totalValue;
final VaidateDayStaffApplicationApplicationsShiftRoleRole role;
VaidateDayStaffApplicationApplicationsShiftRole.fromJson(dynamic json):
id = nativeFromJson<String>(json['id']),
roleId = nativeFromJson<String>(json['roleId']),
count = nativeFromJson<int>(json['count']),
assigned = json['assigned'] == null ? null : nativeFromJson<int>(json['assigned']),
startTime = json['startTime'] == null ? null : Timestamp.fromJson(json['startTime']),
endTime = json['endTime'] == null ? null : Timestamp.fromJson(json['endTime']),
hours = json['hours'] == null ? null : nativeFromJson<double>(json['hours']),
totalValue = json['totalValue'] == null ? null : nativeFromJson<double>(json['totalValue']),
role = VaidateDayStaffApplicationApplicationsShiftRoleRole.fromJson(json['role']);
@override
bool operator ==(Object other) {
if(identical(this, other)) {
return true;
}
if(other.runtimeType != runtimeType) {
return false;
}
final VaidateDayStaffApplicationApplicationsShiftRole otherTyped = other as VaidateDayStaffApplicationApplicationsShiftRole;
return id == otherTyped.id &&
roleId == otherTyped.roleId &&
count == otherTyped.count &&
assigned == otherTyped.assigned &&
startTime == otherTyped.startTime &&
endTime == otherTyped.endTime &&
hours == otherTyped.hours &&
totalValue == otherTyped.totalValue &&
role == otherTyped.role;
}
@override
int get hashCode => Object.hashAll([id.hashCode, roleId.hashCode, count.hashCode, assigned.hashCode, startTime.hashCode, endTime.hashCode, hours.hashCode, totalValue.hashCode, role.hashCode]);
Map<String, dynamic> toJson() {
Map<String, dynamic> json = {};
json['id'] = nativeToJson<String>(id);
json['roleId'] = nativeToJson<String>(roleId);
json['count'] = nativeToJson<int>(count);
if (assigned != null) {
json['assigned'] = nativeToJson<int?>(assigned);
}
if (startTime != null) {
json['startTime'] = startTime!.toJson();
}
if (endTime != null) {
json['endTime'] = endTime!.toJson();
}
if (hours != null) {
json['hours'] = nativeToJson<double?>(hours);
}
if (totalValue != null) {
json['totalValue'] = nativeToJson<double?>(totalValue);
}
json['role'] = role.toJson();
return json;
}
VaidateDayStaffApplicationApplicationsShiftRole({
required this.id,
required this.roleId,
required this.count,
this.assigned,
this.startTime,
this.endTime,
this.hours,
this.totalValue,
required this.role,
});
}
@immutable
class VaidateDayStaffApplicationApplicationsShiftRoleRole {
final String id;
final String name;
final double costPerHour;
VaidateDayStaffApplicationApplicationsShiftRoleRole.fromJson(dynamic json):
id = nativeFromJson<String>(json['id']),
name = nativeFromJson<String>(json['name']),
costPerHour = nativeFromJson<double>(json['costPerHour']);
@override
bool operator ==(Object other) {
if(identical(this, other)) {
return true;
}
if(other.runtimeType != runtimeType) {
return false;
}
final VaidateDayStaffApplicationApplicationsShiftRoleRole otherTyped = other as VaidateDayStaffApplicationApplicationsShiftRoleRole;
return id == otherTyped.id &&
name == otherTyped.name &&
costPerHour == otherTyped.costPerHour;
}
@override
int get hashCode => Object.hashAll([id.hashCode, name.hashCode, costPerHour.hashCode]);
Map<String, dynamic> toJson() {
Map<String, dynamic> json = {};
json['id'] = nativeToJson<String>(id);
json['name'] = nativeToJson<String>(name);
json['costPerHour'] = nativeToJson<double>(costPerHour);
return json;
}
VaidateDayStaffApplicationApplicationsShiftRoleRole({
required this.id,
required this.name,
required this.costPerHour,
});
}
@immutable
class VaidateDayStaffApplicationData {
final List<VaidateDayStaffApplicationApplications> applications;
VaidateDayStaffApplicationData.fromJson(dynamic json):
applications = (json['applications'] as List<dynamic>)
.map((e) => VaidateDayStaffApplicationApplications.fromJson(e))
.toList();
@override
bool operator ==(Object other) {
if(identical(this, other)) {
return true;
}
if(other.runtimeType != runtimeType) {
return false;
}
final VaidateDayStaffApplicationData otherTyped = other as VaidateDayStaffApplicationData;
return applications == otherTyped.applications;
}
@override
int get hashCode => applications.hashCode;
Map<String, dynamic> toJson() {
Map<String, dynamic> json = {};
json['applications'] = applications.map((e) => e.toJson()).toList();
return json;
}
VaidateDayStaffApplicationData({
required this.applications,
});
}
@immutable
class VaidateDayStaffApplicationVariables {
final String staffId;
late final Optional<int>offset;
late final Optional<int>limit;
late final Optional<Timestamp>dayStart;
late final Optional<Timestamp>dayEnd;
@Deprecated('fromJson is deprecated for Variable classes as they are no longer required for deserialization.')
VaidateDayStaffApplicationVariables.fromJson(Map<String, dynamic> json):
staffId = nativeFromJson<String>(json['staffId']) {
offset = Optional.optional(nativeFromJson, nativeToJson);
offset.value = json['offset'] == null ? null : nativeFromJson<int>(json['offset']);
limit = Optional.optional(nativeFromJson, nativeToJson);
limit.value = json['limit'] == null ? null : nativeFromJson<int>(json['limit']);
dayStart = Optional.optional((json) => json['dayStart'] = Timestamp.fromJson(json['dayStart']), defaultSerializer);
dayStart.value = json['dayStart'] == null ? null : Timestamp.fromJson(json['dayStart']);
dayEnd = Optional.optional((json) => json['dayEnd'] = Timestamp.fromJson(json['dayEnd']), defaultSerializer);
dayEnd.value = json['dayEnd'] == null ? null : Timestamp.fromJson(json['dayEnd']);
}
@override
bool operator ==(Object other) {
if(identical(this, other)) {
return true;
}
if(other.runtimeType != runtimeType) {
return false;
}
final VaidateDayStaffApplicationVariables otherTyped = other as VaidateDayStaffApplicationVariables;
return staffId == otherTyped.staffId &&
offset == otherTyped.offset &&
limit == otherTyped.limit &&
dayStart == otherTyped.dayStart &&
dayEnd == otherTyped.dayEnd;
}
@override
int get hashCode => Object.hashAll([staffId.hashCode, offset.hashCode, limit.hashCode, dayStart.hashCode, dayEnd.hashCode]);
Map<String, dynamic> toJson() {
Map<String, dynamic> json = {};
json['staffId'] = nativeToJson<String>(staffId);
if(offset.state == OptionalState.set) {
json['offset'] = offset.toJson();
}
if(limit.state == OptionalState.set) {
json['limit'] = limit.toJson();
}
if(dayStart.state == OptionalState.set) {
json['dayStart'] = dayStart.toJson();
}
if(dayEnd.state == OptionalState.set) {
json['dayEnd'] = dayEnd.toJson();
}
return json;
}
VaidateDayStaffApplicationVariables({
required this.staffId,
required this.offset,
required this.limit,
required this.dayStart,
required this.dayEnd,
});
}

View File

@@ -207,6 +207,7 @@ class ShiftsRepositoryImpl implements ShiftsRepositoryInterface {
final List<Shift> mappedShifts = [];
for (final sr in allShiftRoles) {
final DateTime? shiftDate = _toDateTime(sr.shift.date);
final startDt = _toDateTime(sr.startTime);
final endDt = _toDateTime(sr.endTime);
final createdDt = _toDateTime(sr.createdAt);
@@ -220,7 +221,7 @@ class ShiftsRepositoryImpl implements ShiftsRepositoryInterface {
hourlyRate: sr.role.costPerHour,
location: sr.shift.location ?? '',
locationAddress: sr.shift.locationAddress ?? '',
date: startDt?.toIso8601String() ?? '',
date: shiftDate?.toIso8601String() ?? '',
startTime: startDt != null
? DateFormat('HH:mm').format(startDt)
: '',
@@ -371,17 +372,7 @@ class ShiftsRepositoryImpl implements ShiftsRepositoryInterface {
String targetRoleId = roleId ?? '';
if (targetRoleId.isEmpty) {
final rolesResult = await _dataConnect
.listShiftRolesByShiftId(shiftId: shiftId)
.execute();
if (rolesResult.data.shiftRoles.isEmpty) {
throw Exception('No open roles for this shift');
}
final sr = rolesResult.data.shiftRoles.firstWhere(
(r) => (r.assigned ?? 0) < r.count,
orElse: () => rolesResult.data.shiftRoles.first,
);
targetRoleId = sr.roleId;
throw Exception('Missing role id.');
}
final roleResult = await _dataConnect
@@ -391,6 +382,41 @@ class ShiftsRepositoryImpl implements ShiftsRepositoryInterface {
if (role == null) {
throw Exception('Shift role not found');
}
final shiftResult = await _dataConnect.getShiftById(id: shiftId).execute();
final shift = shiftResult.data.shift;
if (shift == null) {
throw Exception('Shift not found');
}
final DateTime? shiftDate = _toDateTime(shift.date);
if (shiftDate != null) {
final DateTime dayStartUtc = DateTime.utc(
shiftDate.year,
shiftDate.month,
shiftDate.day,
);
final DateTime dayEndUtc = DateTime.utc(
shiftDate.year,
shiftDate.month,
shiftDate.day,
23,
59,
59,
999,
999,
);
print(
'Staff applyForShift: dayStartUtc=${_toTimestamp(dayStartUtc).toJson()} '
'dayEndUtc=${_toTimestamp(dayEndUtc).toJson()}',
);
final dayApplications = await _dataConnect
.vaidateDayStaffApplication(staffId: staffId)
.dayStart(_toTimestamp(dayStartUtc))
.dayEnd(_toTimestamp(dayEndUtc))
.execute();
if (dayApplications.data.applications.isNotEmpty) {
throw Exception('The user already has a shift that day.');
}
}
final existingApplicationResult = await _dataConnect
.getApplicationByStaffShiftAndRole(
staffId: staffId,
@@ -406,11 +432,6 @@ class ShiftsRepositoryImpl implements ShiftsRepositoryInterface {
throw Exception('This shift is full.');
}
final shiftResult = await _dataConnect.getShiftById(id: shiftId).execute();
final shift = shiftResult.data.shift;
if (shift == null) {
throw Exception('Shift not found');
}
final int filled = shift.filled ?? 0;
String? appId;

View File

@@ -9,12 +9,20 @@ import '../blocs/shift_details/shift_details_bloc.dart';
import '../blocs/shift_details/shift_details_event.dart';
import '../blocs/shift_details/shift_details_state.dart';
class ShiftDetailsPage extends StatelessWidget {
class ShiftDetailsPage extends StatefulWidget {
final String shiftId;
final Shift? shift;
const ShiftDetailsPage({super.key, required this.shiftId, this.shift});
@override
State<ShiftDetailsPage> createState() => _ShiftDetailsPageState();
}
class _ShiftDetailsPageState extends State<ShiftDetailsPage> {
bool _actionDialogOpen = false;
bool _isApplying = false;
String _formatTime(String time) {
if (time.isEmpty) return '';
try {
@@ -124,10 +132,19 @@ class ShiftDetailsPage extends StatelessWidget {
return BlocProvider<ShiftDetailsBloc>(
create: (_) =>
Modular.get<ShiftDetailsBloc>()
..add(LoadShiftDetailsEvent(shiftId, roleId: shift?.roleId)),
..add(
LoadShiftDetailsEvent(
widget.shiftId,
roleId: widget.shift?.roleId,
),
),
child: BlocListener<ShiftDetailsBloc, ShiftDetailsState>(
listener: (context, state) {
if (state is ShiftActionSuccess || state is ShiftDetailsError) {
_closeActionDialog(context);
}
if (state is ShiftActionSuccess) {
_isApplying = false;
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(state.message),
@@ -136,7 +153,7 @@ class ShiftDetailsPage extends StatelessWidget {
);
Modular.to.navigateToShiftsHome(selectedDate: state.shiftDate);
} else if (state is ShiftDetailsError) {
if (shift == null) {
if (_isApplying || widget.shift == null) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(state.message),
@@ -144,6 +161,7 @@ class ShiftDetailsPage extends StatelessWidget {
),
);
}
_isApplying = false;
}
},
child: BlocBuilder<ShiftDetailsBloc, ShiftDetailsState>(
@@ -158,7 +176,7 @@ class ShiftDetailsPage extends StatelessWidget {
if (state is ShiftDetailsLoaded) {
displayShift = state.shift;
} else {
displayShift = shift;
displayShift = widget.shift;
}
if (displayShift == null) {
@@ -474,9 +492,7 @@ class ShiftDetailsPage extends StatelessWidget {
child: ElevatedButton(
onPressed: () => _bookShift(
context,
displayShift!.id,
displayShift!.roleId,
DateTime.tryParse(displayShift!.date),
displayShift!,
),
style: ElevatedButton.styleFrom(
backgroundColor: const Color(
@@ -510,9 +526,7 @@ class ShiftDetailsPage extends StatelessWidget {
void _bookShift(
BuildContext context,
String id,
String? roleId,
DateTime? date,
Shift shift,
) {
showDialog(
context: context,
@@ -526,9 +540,15 @@ class ShiftDetailsPage extends StatelessWidget {
),
TextButton(
onPressed: () {
BlocProvider.of<ShiftDetailsBloc>(
context,
).add(BookShiftDetailsEvent(id, roleId: roleId, date: date));
Modular.to.pop();
_showApplyingDialog(context, shift);
BlocProvider.of<ShiftDetailsBloc>(context).add(
BookShiftDetailsEvent(
shift.id,
roleId: shift.roleId,
date: DateTime.tryParse(shift.date),
),
);
},
style: TextButton.styleFrom(
foregroundColor: const Color(0xFF10B981),
@@ -568,4 +588,62 @@ class ShiftDetailsPage extends StatelessWidget {
),
);
}
void _showApplyingDialog(BuildContext context, Shift shift) {
if (_actionDialogOpen) return;
_actionDialogOpen = true;
_isApplying = true;
showDialog(
context: context,
useRootNavigator: true,
barrierDismissible: false,
builder: (ctx) => AlertDialog(
title: const Text('Applying'),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
const SizedBox(
height: 36,
width: 36,
child: CircularProgressIndicator(),
),
const SizedBox(height: 16),
Text(
shift.title,
style: UiTypography.body2b.copyWith(
color: UiColors.textPrimary,
),
textAlign: TextAlign.center,
),
const SizedBox(height: 6),
Text(
'${_formatDate(shift.date)}${_formatTime(shift.startTime)} - ${_formatTime(shift.endTime)}',
style: UiTypography.body3r.copyWith(
color: UiColors.textSecondary,
),
textAlign: TextAlign.center,
),
if (shift.clientName.isNotEmpty) ...[
const SizedBox(height: 6),
Text(
shift.clientName,
style: UiTypography.body3r.copyWith(
color: UiColors.textSecondary,
),
textAlign: TextAlign.center,
),
],
],
),
),
).then((_) {
_actionDialogOpen = false;
});
}
void _closeActionDialog(BuildContext context) {
if (!_actionDialogOpen) return;
Navigator.of(context, rootNavigator: true).pop();
_actionDialogOpen = false;
}
}

View File

@@ -350,6 +350,91 @@ query getApplicationsByStaffId(
}
}
query vaidateDayStaffApplication(
$staffId: UUID!
$offset: Int
$limit: Int
$dayStart: Timestamp
$dayEnd: Timestamp
) @auth(level: USER) {
applications(
where: {
staffId: { eq: $staffId }
shift: {
date: { ge: $dayStart, le: $dayEnd }
}
}
offset: $offset
limit: $limit
) {
id
shiftId
staffId
status
appliedAt
checkInTime
checkOutTime
origin
createdAt
shift {
id
title
date
startTime
endTime
location
status
durationDays
description
order {
id
eventName
#location
teamHub {
address
placeId
hubName
}
business {
id
businessName
email
contactName
companyLogoUrl
}
vendor {
id
companyName
}
}
}
shiftRole {
id
roleId
count
assigned
startTime
endTime
hours
totalValue
role {
id
name
costPerHour
}
}
}
}
#validation before apply
query getApplicationByStaffShiftAndRole(
$staffId: UUID!