new query to validate if a hub has orders before delete
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
# Basic Usage
|
||||
|
||||
```dart
|
||||
ExampleConnector.instance.listRoles().execute();
|
||||
ExampleConnector.instance.getRoleById(getRoleByIdVariables).execute();
|
||||
ExampleConnector.instance.listRolesByVendorId(listRolesByVendorIdVariables).execute();
|
||||
ExampleConnector.instance.listRolesByroleCategoryId(listRolesByroleCategoryIdVariables).execute();
|
||||
ExampleConnector.instance.CreateUser(createUserVariables).execute();
|
||||
ExampleConnector.instance.UpdateUser(updateUserVariables).execute();
|
||||
ExampleConnector.instance.DeleteUser(deleteUserVariables).execute();
|
||||
ExampleConnector.instance.createVendor(createVendorVariables).execute();
|
||||
ExampleConnector.instance.updateVendor(updateVendorVariables).execute();
|
||||
ExampleConnector.instance.deleteVendor(deleteVendorVariables).execute();
|
||||
ExampleConnector.instance.createInvoiceTemplate(createInvoiceTemplateVariables).execute();
|
||||
ExampleConnector.instance.updateInvoiceTemplate(updateInvoiceTemplateVariables).execute();
|
||||
ExampleConnector.instance.deleteInvoiceTemplate(deleteInvoiceTemplateVariables).execute();
|
||||
ExampleConnector.instance.listOrders(listOrdersVariables).execute();
|
||||
ExampleConnector.instance.getOrderById(getOrderByIdVariables).execute();
|
||||
ExampleConnector.instance.getOrdersByBusinessId(getOrdersByBusinessIdVariables).execute();
|
||||
ExampleConnector.instance.getOrdersByVendorId(getOrdersByVendorIdVariables).execute();
|
||||
ExampleConnector.instance.getOrdersByStatus(getOrdersByStatusVariables).execute();
|
||||
ExampleConnector.instance.getOrdersByDateRange(getOrdersByDateRangeVariables).execute();
|
||||
ExampleConnector.instance.getRapidOrders(getRapidOrdersVariables).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:
|
||||
|
||||
```dart
|
||||
await ExampleConnector.instance.listClientFeedbackRatingsByVendorId({ ... })
|
||||
.dateFrom(...)
|
||||
await ExampleConnector.instance.filterAttireOptions({ ... })
|
||||
.itemId(...)
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,274 @@
|
||||
part of 'generated.dart';
|
||||
|
||||
class ListOrdersByBusinessAndTeamHubVariablesBuilder {
|
||||
String businessId;
|
||||
String teamHubId;
|
||||
Optional<int> _offset = Optional.optional(nativeFromJson, nativeToJson);
|
||||
Optional<int> _limit = Optional.optional(nativeFromJson, nativeToJson);
|
||||
|
||||
final FirebaseDataConnect _dataConnect; ListOrdersByBusinessAndTeamHubVariablesBuilder offset(int? t) {
|
||||
_offset.value = t;
|
||||
return this;
|
||||
}
|
||||
ListOrdersByBusinessAndTeamHubVariablesBuilder limit(int? t) {
|
||||
_limit.value = t;
|
||||
return this;
|
||||
}
|
||||
|
||||
ListOrdersByBusinessAndTeamHubVariablesBuilder(this._dataConnect, {required this.businessId,required this.teamHubId,});
|
||||
Deserializer<ListOrdersByBusinessAndTeamHubData> dataDeserializer = (dynamic json) => ListOrdersByBusinessAndTeamHubData.fromJson(jsonDecode(json));
|
||||
Serializer<ListOrdersByBusinessAndTeamHubVariables> varsSerializer = (ListOrdersByBusinessAndTeamHubVariables vars) => jsonEncode(vars.toJson());
|
||||
Future<QueryResult<ListOrdersByBusinessAndTeamHubData, ListOrdersByBusinessAndTeamHubVariables>> execute() {
|
||||
return ref().execute();
|
||||
}
|
||||
|
||||
QueryRef<ListOrdersByBusinessAndTeamHubData, ListOrdersByBusinessAndTeamHubVariables> ref() {
|
||||
ListOrdersByBusinessAndTeamHubVariables vars= ListOrdersByBusinessAndTeamHubVariables(businessId: businessId,teamHubId: teamHubId,offset: _offset,limit: _limit,);
|
||||
return _dataConnect.query("listOrdersByBusinessAndTeamHub", dataDeserializer, varsSerializer, vars);
|
||||
}
|
||||
}
|
||||
|
||||
@immutable
|
||||
class ListOrdersByBusinessAndTeamHubOrders {
|
||||
final String id;
|
||||
final String? eventName;
|
||||
final EnumValue<OrderType> orderType;
|
||||
final EnumValue<OrderStatus> status;
|
||||
final EnumValue<OrderDuration>? duration;
|
||||
final String businessId;
|
||||
final String? vendorId;
|
||||
final String teamHubId;
|
||||
final Timestamp? date;
|
||||
final Timestamp? startDate;
|
||||
final Timestamp? endDate;
|
||||
final int? requested;
|
||||
final double? total;
|
||||
final String? notes;
|
||||
final Timestamp? createdAt;
|
||||
final Timestamp? updatedAt;
|
||||
final String? createdBy;
|
||||
ListOrdersByBusinessAndTeamHubOrders.fromJson(dynamic json):
|
||||
|
||||
id = nativeFromJson<String>(json['id']),
|
||||
eventName = json['eventName'] == null ? null : nativeFromJson<String>(json['eventName']),
|
||||
orderType = orderTypeDeserializer(json['orderType']),
|
||||
status = orderStatusDeserializer(json['status']),
|
||||
duration = json['duration'] == null ? null : orderDurationDeserializer(json['duration']),
|
||||
businessId = nativeFromJson<String>(json['businessId']),
|
||||
vendorId = json['vendorId'] == null ? null : nativeFromJson<String>(json['vendorId']),
|
||||
teamHubId = nativeFromJson<String>(json['teamHubId']),
|
||||
date = json['date'] == null ? null : Timestamp.fromJson(json['date']),
|
||||
startDate = json['startDate'] == null ? null : Timestamp.fromJson(json['startDate']),
|
||||
endDate = json['endDate'] == null ? null : Timestamp.fromJson(json['endDate']),
|
||||
requested = json['requested'] == null ? null : nativeFromJson<int>(json['requested']),
|
||||
total = json['total'] == null ? null : nativeFromJson<double>(json['total']),
|
||||
notes = json['notes'] == null ? null : nativeFromJson<String>(json['notes']),
|
||||
createdAt = json['createdAt'] == null ? null : Timestamp.fromJson(json['createdAt']),
|
||||
updatedAt = json['updatedAt'] == null ? null : Timestamp.fromJson(json['updatedAt']),
|
||||
createdBy = json['createdBy'] == null ? null : nativeFromJson<String>(json['createdBy']);
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
if(identical(this, other)) {
|
||||
return true;
|
||||
}
|
||||
if(other.runtimeType != runtimeType) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final ListOrdersByBusinessAndTeamHubOrders otherTyped = other as ListOrdersByBusinessAndTeamHubOrders;
|
||||
return id == otherTyped.id &&
|
||||
eventName == otherTyped.eventName &&
|
||||
orderType == otherTyped.orderType &&
|
||||
status == otherTyped.status &&
|
||||
duration == otherTyped.duration &&
|
||||
businessId == otherTyped.businessId &&
|
||||
vendorId == otherTyped.vendorId &&
|
||||
teamHubId == otherTyped.teamHubId &&
|
||||
date == otherTyped.date &&
|
||||
startDate == otherTyped.startDate &&
|
||||
endDate == otherTyped.endDate &&
|
||||
requested == otherTyped.requested &&
|
||||
total == otherTyped.total &&
|
||||
notes == otherTyped.notes &&
|
||||
createdAt == otherTyped.createdAt &&
|
||||
updatedAt == otherTyped.updatedAt &&
|
||||
createdBy == otherTyped.createdBy;
|
||||
|
||||
}
|
||||
@override
|
||||
int get hashCode => Object.hashAll([id.hashCode, eventName.hashCode, orderType.hashCode, status.hashCode, duration.hashCode, businessId.hashCode, vendorId.hashCode, teamHubId.hashCode, date.hashCode, startDate.hashCode, endDate.hashCode, requested.hashCode, total.hashCode, notes.hashCode, createdAt.hashCode, updatedAt.hashCode, createdBy.hashCode]);
|
||||
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
Map<String, dynamic> json = {};
|
||||
json['id'] = nativeToJson<String>(id);
|
||||
if (eventName != null) {
|
||||
json['eventName'] = nativeToJson<String?>(eventName);
|
||||
}
|
||||
json['orderType'] =
|
||||
orderTypeSerializer(orderType)
|
||||
;
|
||||
json['status'] =
|
||||
orderStatusSerializer(status)
|
||||
;
|
||||
if (duration != null) {
|
||||
json['duration'] =
|
||||
orderDurationSerializer(duration!)
|
||||
;
|
||||
}
|
||||
json['businessId'] = nativeToJson<String>(businessId);
|
||||
if (vendorId != null) {
|
||||
json['vendorId'] = nativeToJson<String?>(vendorId);
|
||||
}
|
||||
json['teamHubId'] = nativeToJson<String>(teamHubId);
|
||||
if (date != null) {
|
||||
json['date'] = date!.toJson();
|
||||
}
|
||||
if (startDate != null) {
|
||||
json['startDate'] = startDate!.toJson();
|
||||
}
|
||||
if (endDate != null) {
|
||||
json['endDate'] = endDate!.toJson();
|
||||
}
|
||||
if (requested != null) {
|
||||
json['requested'] = nativeToJson<int?>(requested);
|
||||
}
|
||||
if (total != null) {
|
||||
json['total'] = nativeToJson<double?>(total);
|
||||
}
|
||||
if (notes != null) {
|
||||
json['notes'] = nativeToJson<String?>(notes);
|
||||
}
|
||||
if (createdAt != null) {
|
||||
json['createdAt'] = createdAt!.toJson();
|
||||
}
|
||||
if (updatedAt != null) {
|
||||
json['updatedAt'] = updatedAt!.toJson();
|
||||
}
|
||||
if (createdBy != null) {
|
||||
json['createdBy'] = nativeToJson<String?>(createdBy);
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
ListOrdersByBusinessAndTeamHubOrders({
|
||||
required this.id,
|
||||
this.eventName,
|
||||
required this.orderType,
|
||||
required this.status,
|
||||
this.duration,
|
||||
required this.businessId,
|
||||
this.vendorId,
|
||||
required this.teamHubId,
|
||||
this.date,
|
||||
this.startDate,
|
||||
this.endDate,
|
||||
this.requested,
|
||||
this.total,
|
||||
this.notes,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
this.createdBy,
|
||||
});
|
||||
}
|
||||
|
||||
@immutable
|
||||
class ListOrdersByBusinessAndTeamHubData {
|
||||
final List<ListOrdersByBusinessAndTeamHubOrders> orders;
|
||||
ListOrdersByBusinessAndTeamHubData.fromJson(dynamic json):
|
||||
|
||||
orders = (json['orders'] as List<dynamic>)
|
||||
.map((e) => ListOrdersByBusinessAndTeamHubOrders.fromJson(e))
|
||||
.toList();
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
if(identical(this, other)) {
|
||||
return true;
|
||||
}
|
||||
if(other.runtimeType != runtimeType) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final ListOrdersByBusinessAndTeamHubData otherTyped = other as ListOrdersByBusinessAndTeamHubData;
|
||||
return orders == otherTyped.orders;
|
||||
|
||||
}
|
||||
@override
|
||||
int get hashCode => orders.hashCode;
|
||||
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
Map<String, dynamic> json = {};
|
||||
json['orders'] = orders.map((e) => e.toJson()).toList();
|
||||
return json;
|
||||
}
|
||||
|
||||
ListOrdersByBusinessAndTeamHubData({
|
||||
required this.orders,
|
||||
});
|
||||
}
|
||||
|
||||
@immutable
|
||||
class ListOrdersByBusinessAndTeamHubVariables {
|
||||
final String businessId;
|
||||
final String teamHubId;
|
||||
late final Optional<int>offset;
|
||||
late final Optional<int>limit;
|
||||
@Deprecated('fromJson is deprecated for Variable classes as they are no longer required for deserialization.')
|
||||
ListOrdersByBusinessAndTeamHubVariables.fromJson(Map<String, dynamic> json):
|
||||
|
||||
businessId = nativeFromJson<String>(json['businessId']),
|
||||
teamHubId = nativeFromJson<String>(json['teamHubId']) {
|
||||
|
||||
|
||||
|
||||
|
||||
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']);
|
||||
|
||||
}
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
if(identical(this, other)) {
|
||||
return true;
|
||||
}
|
||||
if(other.runtimeType != runtimeType) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final ListOrdersByBusinessAndTeamHubVariables otherTyped = other as ListOrdersByBusinessAndTeamHubVariables;
|
||||
return businessId == otherTyped.businessId &&
|
||||
teamHubId == otherTyped.teamHubId &&
|
||||
offset == otherTyped.offset &&
|
||||
limit == otherTyped.limit;
|
||||
|
||||
}
|
||||
@override
|
||||
int get hashCode => Object.hashAll([businessId.hashCode, teamHubId.hashCode, offset.hashCode, limit.hashCode]);
|
||||
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
Map<String, dynamic> json = {};
|
||||
json['businessId'] = nativeToJson<String>(businessId);
|
||||
json['teamHubId'] = nativeToJson<String>(teamHubId);
|
||||
if(offset.state == OptionalState.set) {
|
||||
json['offset'] = offset.toJson();
|
||||
}
|
||||
if(limit.state == OptionalState.set) {
|
||||
json['limit'] = limit.toJson();
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
ListOrdersByBusinessAndTeamHubVariables({
|
||||
required this.businessId,
|
||||
required this.teamHubId,
|
||||
required this.offset,
|
||||
required this.limit,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -392,3 +392,43 @@ query getRapidOrders(
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#to validate if an hub has orders before delete
|
||||
query listOrdersByBusinessAndTeamHub(
|
||||
$businessId: UUID!
|
||||
$teamHubId: UUID!
|
||||
$offset: Int
|
||||
$limit: Int
|
||||
) @auth(level: USER) {
|
||||
orders(
|
||||
where: {
|
||||
businessId: { eq: $businessId }
|
||||
teamHubId: { eq: $teamHubId }
|
||||
}
|
||||
offset: $offset
|
||||
limit: $limit
|
||||
orderBy: { createdAt: DESC }
|
||||
) {
|
||||
id
|
||||
eventName
|
||||
orderType
|
||||
status
|
||||
duration
|
||||
|
||||
businessId
|
||||
vendorId
|
||||
teamHubId
|
||||
|
||||
date
|
||||
startDate
|
||||
endDate
|
||||
|
||||
requested
|
||||
total
|
||||
notes
|
||||
|
||||
createdAt
|
||||
updatedAt
|
||||
createdBy
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user