today coverage ready
This commit is contained in:
@@ -1,16 +1,16 @@
|
|||||||
# Basic Usage
|
# Basic Usage
|
||||||
|
|
||||||
```dart
|
```dart
|
||||||
ExampleConnector.instance.listStaffAvailabilityStats(listStaffAvailabilityStatsVariables).execute();
|
ExampleConnector.instance.listRoleCategories().execute();
|
||||||
ExampleConnector.instance.getStaffAvailabilityStatsByStaffId(getStaffAvailabilityStatsByStaffIdVariables).execute();
|
ExampleConnector.instance.getRoleCategoryById(getRoleCategoryByIdVariables).execute();
|
||||||
ExampleConnector.instance.filterStaffAvailabilityStats(filterStaffAvailabilityStatsVariables).execute();
|
ExampleConnector.instance.getRoleCategoriesByCategory(getRoleCategoriesByCategoryVariables).execute();
|
||||||
ExampleConnector.instance.listStaffRoles(listStaffRolesVariables).execute();
|
ExampleConnector.instance.createCourse(createCourseVariables).execute();
|
||||||
ExampleConnector.instance.getStaffRoleByKey(getStaffRoleByKeyVariables).execute();
|
ExampleConnector.instance.updateCourse(updateCourseVariables).execute();
|
||||||
ExampleConnector.instance.listStaffRolesByStaffId(listStaffRolesByStaffIdVariables).execute();
|
ExampleConnector.instance.deleteCourse(deleteCourseVariables).execute();
|
||||||
ExampleConnector.instance.listStaffRolesByRoleId(listStaffRolesByRoleIdVariables).execute();
|
ExampleConnector.instance.listAttireOptions().execute();
|
||||||
ExampleConnector.instance.filterStaffRoles(filterStaffRolesVariables).execute();
|
ExampleConnector.instance.getAttireOptionById(getAttireOptionByIdVariables).execute();
|
||||||
ExampleConnector.instance.createConversation(createConversationVariables).execute();
|
ExampleConnector.instance.filterAttireOptions(filterAttireOptionsVariables).execute();
|
||||||
ExampleConnector.instance.updateConversation(updateConversationVariables).execute();
|
ExampleConnector.instance.listFaqDatas().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.listStaffAvailabilitiesByDay({ ... })
|
await ExampleConnector.instance.updateWorkforce({ ... })
|
||||||
.offset(...)
|
.workforceNumber(...)
|
||||||
.execute();
|
.execute();
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -6,6 +6,7 @@ class ListShiftRolesByBusinessAndDateRangeVariablesBuilder {
|
|||||||
Timestamp end;
|
Timestamp end;
|
||||||
Optional<int> _offset = Optional.optional(nativeFromJson, nativeToJson);
|
Optional<int> _offset = Optional.optional(nativeFromJson, nativeToJson);
|
||||||
Optional<int> _limit = Optional.optional(nativeFromJson, nativeToJson);
|
Optional<int> _limit = Optional.optional(nativeFromJson, nativeToJson);
|
||||||
|
Optional<ShiftStatus> _status = Optional.optional((data) => ShiftStatus.values.byName(data), enumSerializer);
|
||||||
|
|
||||||
final FirebaseDataConnect _dataConnect; ListShiftRolesByBusinessAndDateRangeVariablesBuilder offset(int? t) {
|
final FirebaseDataConnect _dataConnect; ListShiftRolesByBusinessAndDateRangeVariablesBuilder offset(int? t) {
|
||||||
_offset.value = t;
|
_offset.value = t;
|
||||||
@@ -15,6 +16,10 @@ class ListShiftRolesByBusinessAndDateRangeVariablesBuilder {
|
|||||||
_limit.value = t;
|
_limit.value = t;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
ListShiftRolesByBusinessAndDateRangeVariablesBuilder status(ShiftStatus? t) {
|
||||||
|
_status.value = t;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
ListShiftRolesByBusinessAndDateRangeVariablesBuilder(this._dataConnect, {required this.businessId,required this.start,required this.end,});
|
ListShiftRolesByBusinessAndDateRangeVariablesBuilder(this._dataConnect, {required this.businessId,required this.start,required this.end,});
|
||||||
Deserializer<ListShiftRolesByBusinessAndDateRangeData> dataDeserializer = (dynamic json) => ListShiftRolesByBusinessAndDateRangeData.fromJson(jsonDecode(json));
|
Deserializer<ListShiftRolesByBusinessAndDateRangeData> dataDeserializer = (dynamic json) => ListShiftRolesByBusinessAndDateRangeData.fromJson(jsonDecode(json));
|
||||||
@@ -24,7 +29,7 @@ class ListShiftRolesByBusinessAndDateRangeVariablesBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QueryRef<ListShiftRolesByBusinessAndDateRangeData, ListShiftRolesByBusinessAndDateRangeVariables> ref() {
|
QueryRef<ListShiftRolesByBusinessAndDateRangeData, ListShiftRolesByBusinessAndDateRangeVariables> ref() {
|
||||||
ListShiftRolesByBusinessAndDateRangeVariables vars= ListShiftRolesByBusinessAndDateRangeVariables(businessId: businessId,start: start,end: end,offset: _offset,limit: _limit,);
|
ListShiftRolesByBusinessAndDateRangeVariables vars= ListShiftRolesByBusinessAndDateRangeVariables(businessId: businessId,start: start,end: end,offset: _offset,limit: _limit,status: _status,);
|
||||||
return _dataConnect.query("listShiftRolesByBusinessAndDateRange", dataDeserializer, varsSerializer, vars);
|
return _dataConnect.query("listShiftRolesByBusinessAndDateRange", dataDeserializer, varsSerializer, vars);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -308,6 +313,7 @@ class ListShiftRolesByBusinessAndDateRangeVariables {
|
|||||||
final Timestamp end;
|
final Timestamp end;
|
||||||
late final Optional<int>offset;
|
late final Optional<int>offset;
|
||||||
late final Optional<int>limit;
|
late final Optional<int>limit;
|
||||||
|
late final Optional<ShiftStatus>status;
|
||||||
@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.')
|
||||||
ListShiftRolesByBusinessAndDateRangeVariables.fromJson(Map<String, dynamic> json):
|
ListShiftRolesByBusinessAndDateRangeVariables.fromJson(Map<String, dynamic> json):
|
||||||
|
|
||||||
@@ -326,6 +332,10 @@ class ListShiftRolesByBusinessAndDateRangeVariables {
|
|||||||
limit = Optional.optional(nativeFromJson, nativeToJson);
|
limit = Optional.optional(nativeFromJson, nativeToJson);
|
||||||
limit.value = json['limit'] == null ? null : nativeFromJson<int>(json['limit']);
|
limit.value = json['limit'] == null ? null : nativeFromJson<int>(json['limit']);
|
||||||
|
|
||||||
|
|
||||||
|
status = Optional.optional((data) => ShiftStatus.values.byName(data), enumSerializer);
|
||||||
|
status.value = json['status'] == null ? null : ShiftStatus.values.byName(json['status']);
|
||||||
|
|
||||||
}
|
}
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
@@ -341,11 +351,12 @@ class ListShiftRolesByBusinessAndDateRangeVariables {
|
|||||||
start == otherTyped.start &&
|
start == otherTyped.start &&
|
||||||
end == otherTyped.end &&
|
end == otherTyped.end &&
|
||||||
offset == otherTyped.offset &&
|
offset == otherTyped.offset &&
|
||||||
limit == otherTyped.limit;
|
limit == otherTyped.limit &&
|
||||||
|
status == otherTyped.status;
|
||||||
|
|
||||||
}
|
}
|
||||||
@override
|
@override
|
||||||
int get hashCode => Object.hashAll([businessId.hashCode, start.hashCode, end.hashCode, offset.hashCode, limit.hashCode]);
|
int get hashCode => Object.hashAll([businessId.hashCode, start.hashCode, end.hashCode, offset.hashCode, limit.hashCode, status.hashCode]);
|
||||||
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
@@ -359,6 +370,9 @@ class ListShiftRolesByBusinessAndDateRangeVariables {
|
|||||||
if(limit.state == OptionalState.set) {
|
if(limit.state == OptionalState.set) {
|
||||||
json['limit'] = limit.toJson();
|
json['limit'] = limit.toJson();
|
||||||
}
|
}
|
||||||
|
if(status.state == OptionalState.set) {
|
||||||
|
json['status'] = status.toJson();
|
||||||
|
}
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -368,6 +382,7 @@ class ListShiftRolesByBusinessAndDateRangeVariables {
|
|||||||
required this.end,
|
required this.end,
|
||||||
required this.offset,
|
required this.offset,
|
||||||
required this.limit,
|
required this.limit,
|
||||||
|
required this.status,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,44 @@ class HomeRepositoryImpl implements HomeRepositoryInterface {
|
|||||||
HomeRepositoryImpl(this._mock, this._dataConnect);
|
HomeRepositoryImpl(this._mock, this._dataConnect);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<HomeDashboardData> getDashboardData() {
|
Future<HomeDashboardData> getDashboardData() async {
|
||||||
return _mock.getDashboardData();
|
final HomeDashboardData baseData = await _mock.getDashboardData();
|
||||||
|
final String? businessId = ClientSessionStore.instance.session?.business?.id;
|
||||||
|
if (businessId == null || businessId.isEmpty) {
|
||||||
|
return baseData;
|
||||||
|
}
|
||||||
|
|
||||||
|
final DateTime now = DateTime.now();
|
||||||
|
final DateTime start = DateTime(now.year, now.month, now.day);
|
||||||
|
final DateTime end = DateTime(now.year, now.month, now.day, 23, 59, 59, 999);
|
||||||
|
|
||||||
|
final fdc.QueryResult<
|
||||||
|
ListShiftRolesByBusinessAndDateRangeData,
|
||||||
|
ListShiftRolesByBusinessAndDateRangeVariables> result =
|
||||||
|
await _dataConnect
|
||||||
|
.listShiftRolesByBusinessAndDateRange(
|
||||||
|
businessId: businessId,
|
||||||
|
start: _toTimestamp(start),
|
||||||
|
end: _toTimestamp(end),
|
||||||
|
)
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
int totalNeeded = 0;
|
||||||
|
int totalFilled = 0;
|
||||||
|
for (final ListShiftRolesByBusinessAndDateRangeShiftRoles shiftRole
|
||||||
|
in result.data.shiftRoles) {
|
||||||
|
totalNeeded += shiftRole.count;
|
||||||
|
totalFilled += shiftRole.assigned ?? 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return HomeDashboardData(
|
||||||
|
weeklySpending: baseData.weeklySpending,
|
||||||
|
next7DaysSpending: baseData.next7DaysSpending,
|
||||||
|
weeklyShifts: baseData.weeklyShifts,
|
||||||
|
next7DaysScheduled: baseData.next7DaysScheduled,
|
||||||
|
totalNeeded: totalNeeded,
|
||||||
|
totalFilled: totalFilled,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -21,10 +21,16 @@ class ClientHomeState extends Equatable {
|
|||||||
this.widgetOrder = const <String>[
|
this.widgetOrder = const <String>[
|
||||||
'actions',
|
'actions',
|
||||||
'reorder',
|
'reorder',
|
||||||
|
'coverage',
|
||||||
|
'spending',
|
||||||
|
'liveActivity',
|
||||||
],
|
],
|
||||||
this.widgetVisibility = const <String, bool>{
|
this.widgetVisibility = const <String, bool>{
|
||||||
'actions': true,
|
'actions': true,
|
||||||
'reorder': true,
|
'reorder': true,
|
||||||
|
'coverage': true,
|
||||||
|
'spending': true,
|
||||||
|
'liveActivity': true,
|
||||||
},
|
},
|
||||||
this.isEditMode = false,
|
this.isEditMode = false,
|
||||||
this.errorMessage,
|
this.errorMessage,
|
||||||
|
|||||||
@@ -301,12 +301,14 @@ query listShiftRolesByBusinessAndDateRange(
|
|||||||
$end: Timestamp!
|
$end: Timestamp!
|
||||||
$offset: Int
|
$offset: Int
|
||||||
$limit: Int
|
$limit: Int
|
||||||
|
$status: ShiftStatus
|
||||||
) @auth(level: USER) {
|
) @auth(level: USER) {
|
||||||
shiftRoles(
|
shiftRoles(
|
||||||
where: {
|
where: {
|
||||||
shift: {
|
shift: {
|
||||||
date: { ge: $start, le: $end }
|
date: { ge: $start, le: $end }
|
||||||
order: { businessId: { eq: $businessId } }
|
order: { businessId: { eq: $businessId } }
|
||||||
|
status: { eq: $status }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
offset: $offset
|
offset: $offset
|
||||||
|
|||||||
Reference in New Issue
Block a user