From e8005e28b48ee06259d4f51045a58f20c891e0b9 Mon Sep 17 00:00:00 2001 From: dab246 Date: Wed, 4 Oct 2023 16:27:22 +0700 Subject: [PATCH] Fix missing Quota properties --- lib/jmap/quotas/quota.dart | 6 +++--- lib/jmap/quotas/quota.g.dart | 10 +++++----- test/jmap/quotas/get_quota_method_test.dart | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/jmap/quotas/quota.dart b/lib/jmap/quotas/quota.dart index 9ef5ec8..f1421b5 100644 --- a/lib/jmap/quotas/quota.dart +++ b/lib/jmap/quotas/quota.dart @@ -22,7 +22,7 @@ class Quota with EquatableMixin { final UnsignedInt? limit; final Scope scope; final String name; - final List dataTypes; + final List? dataTypes; final List? types; final UnsignedInt? warnLimit; final UnsignedInt? softLimit; @@ -33,7 +33,6 @@ class Quota with EquatableMixin { this.resourceType, this.scope, this.name, - this.dataTypes, { this.used, this.hardLimit, @@ -41,7 +40,8 @@ class Quota with EquatableMixin { this.warnLimit, this.softLimit, this.description, - this.types + this.types, + this.dataTypes, } ); diff --git a/lib/jmap/quotas/quota.g.dart b/lib/jmap/quotas/quota.g.dart index 9d39f7c..8ed28ab 100644 --- a/lib/jmap/quotas/quota.g.dart +++ b/lib/jmap/quotas/quota.g.dart @@ -11,9 +11,6 @@ Quota _$QuotaFromJson(Map json) => Quota( $enumDecode(_$ResourceTypeEnumMap, json['resourceType']), $enumDecode(_$ScopeEnumMap, json['scope']), json['name'] as String, - (json['dataTypes'] as List) - .map((e) => const DataTypeConverter().fromJson(e as String)) - .toList(), used: const UnsignedIntNullableConverter().fromJson(json['used'] as int?), hardLimit: const UnsignedIntNullableConverter() .fromJson(json['hardLimit'] as int?), @@ -27,6 +24,9 @@ Quota _$QuotaFromJson(Map json) => Quota( types: (json['types'] as List?) ?.map((e) => const DataTypeConverter().fromJson(e as String)) .toList(), + dataTypes: (json['dataTypes'] as List?) + ?.map((e) => const DataTypeConverter().fromJson(e as String)) + .toList(), ); Map _$QuotaToJson(Quota instance) { @@ -49,8 +49,8 @@ Map _$QuotaToJson(Quota instance) { 'limit', const UnsignedIntNullableConverter().toJson(instance.limit)); val['scope'] = _$ScopeEnumMap[instance.scope]!; val['name'] = instance.name; - val['dataTypes'] = - instance.dataTypes.map(const DataTypeConverter().toJson).toList(); + writeNotNull('dataTypes', + instance.dataTypes?.map(const DataTypeConverter().toJson).toList()); writeNotNull( 'types', instance.types?.map(const DataTypeConverter().toJson).toList()); writeNotNull('warnLimit', diff --git a/test/jmap/quotas/get_quota_method_test.dart b/test/jmap/quotas/get_quota_method_test.dart index 2d34223..589a754 100644 --- a/test/jmap/quotas/get_quota_method_test.dart +++ b/test/jmap/quotas/get_quota_method_test.dart @@ -18,7 +18,7 @@ void main() { ResourceType.count, Scope.account, 'tdvu@example.com', - [DataType.mail], + dataTypes: [DataType.mail], types: [DataType.mail], used: UnsignedInt(20000), limit: UnsignedInt(50000), @@ -30,7 +30,7 @@ void main() { ResourceType.count, Scope.account, 'datvu@example.com', - [DataType.mail, DataType.calendar, DataType.contact], + dataTypes: [DataType.mail, DataType.calendar, DataType.contact], types: [DataType.mail, DataType.calendar, DataType.contact], used: UnsignedInt(10000), limit: UnsignedInt(70000),