Add product fields

This commit is contained in:
unknown 2018-05-29 22:47:25 -07:00
parent 715db74aaf
commit b51bdfffbc
4 changed files with 160 additions and 72 deletions

View File

@ -127,13 +127,19 @@ class _$CompanyEntitySerializer implements StructuredSerializer<CompanyEntity> {
@override
Iterable serialize(Serializers serializers, CompanyEntity object,
{FullType specifiedType: FullType.unspecified}) {
final result = <Object>[
'name',
serializers.serialize(object.name, specifiedType: const FullType(String)),
'token',
serializers.serialize(object.token,
specifiedType: const FullType(String)),
];
final result = <Object>[];
if (object.name != null) {
result
..add('name')
..add(serializers.serialize(object.name,
specifiedType: const FullType(String)));
}
if (object.token != null) {
result
..add('token')
..add(serializers.serialize(object.token,
specifiedType: const FullType(String)));
}
if (object.plan != null) {
result
..add('plan')
@ -236,32 +242,55 @@ class _$DashboardEntitySerializer
@override
Iterable serialize(Serializers serializers, DashboardEntity object,
{FullType specifiedType: FullType.unspecified}) {
final result = <Object>[
'paidToDate',
serializers.serialize(object.paidToDate,
specifiedType: const FullType(double)),
'paidToDateCurrency',
serializers.serialize(object.paidToDateCurrency,
specifiedType: const FullType(int)),
'balances',
serializers.serialize(object.balances,
specifiedType: const FullType(double)),
'balancesCurrency',
serializers.serialize(object.balancesCurrency,
specifiedType: const FullType(int)),
'averageInvoice',
serializers.serialize(object.averageInvoice,
specifiedType: const FullType(double)),
'averageInvoiceCurrency',
serializers.serialize(object.averageInvoiceCurrency,
specifiedType: const FullType(int)),
'invoicesSent',
serializers.serialize(object.invoicesSent,
specifiedType: const FullType(int)),
'activeClients',
serializers.serialize(object.activeClients,
specifiedType: const FullType(int)),
];
final result = <Object>[];
if (object.paidToDate != null) {
result
..add('paidToDate')
..add(serializers.serialize(object.paidToDate,
specifiedType: const FullType(double)));
}
if (object.paidToDateCurrency != null) {
result
..add('paidToDateCurrency')
..add(serializers.serialize(object.paidToDateCurrency,
specifiedType: const FullType(int)));
}
if (object.balances != null) {
result
..add('balances')
..add(serializers.serialize(object.balances,
specifiedType: const FullType(double)));
}
if (object.balancesCurrency != null) {
result
..add('balancesCurrency')
..add(serializers.serialize(object.balancesCurrency,
specifiedType: const FullType(int)));
}
if (object.averageInvoice != null) {
result
..add('averageInvoice')
..add(serializers.serialize(object.averageInvoice,
specifiedType: const FullType(double)));
}
if (object.averageInvoiceCurrency != null) {
result
..add('averageInvoiceCurrency')
..add(serializers.serialize(object.averageInvoiceCurrency,
specifiedType: const FullType(int)));
}
if (object.invoicesSent != null) {
result
..add('invoicesSent')
..add(serializers.serialize(object.invoicesSent,
specifiedType: const FullType(int)));
}
if (object.activeClients != null) {
result
..add('activeClients')
..add(serializers.serialize(object.activeClients,
specifiedType: const FullType(int)));
}
return result;
}
@ -507,12 +536,7 @@ class _$CompanyEntity extends CompanyEntity {
(new CompanyEntityBuilder()..update(updates)).build();
_$CompanyEntity._({this.name, this.token, this.plan, this.logoUrl})
: super._() {
if (name == null)
throw new BuiltValueNullFieldError('CompanyEntity', 'name');
if (token == null)
throw new BuiltValueNullFieldError('CompanyEntity', 'token');
}
: super._();
@override
CompanyEntity rebuild(void updates(CompanyEntityBuilder b)) =>
@ -723,26 +747,7 @@ class _$DashboardEntity extends DashboardEntity {
this.averageInvoiceCurrency,
this.invoicesSent,
this.activeClients})
: super._() {
if (paidToDate == null)
throw new BuiltValueNullFieldError('DashboardEntity', 'paidToDate');
if (paidToDateCurrency == null)
throw new BuiltValueNullFieldError(
'DashboardEntity', 'paidToDateCurrency');
if (balances == null)
throw new BuiltValueNullFieldError('DashboardEntity', 'balances');
if (balancesCurrency == null)
throw new BuiltValueNullFieldError('DashboardEntity', 'balancesCurrency');
if (averageInvoice == null)
throw new BuiltValueNullFieldError('DashboardEntity', 'averageInvoice');
if (averageInvoiceCurrency == null)
throw new BuiltValueNullFieldError(
'DashboardEntity', 'averageInvoiceCurrency');
if (invoicesSent == null)
throw new BuiltValueNullFieldError('DashboardEntity', 'invoicesSent');
if (activeClients == null)
throw new BuiltValueNullFieldError('DashboardEntity', 'activeClients');
}
: super._();
@override
DashboardEntity rebuild(void updates(DashboardEntityBuilder b)) =>

View File

@ -37,6 +37,18 @@ abstract class ProductEntity implements Built<ProductEntity, ProductEntityBuilde
@nullable
double get cost;
@nullable
@BuiltValueField(wireName: 'updated_at')
int get updatedAt;
@nullable
@BuiltValueField(wireName: 'archived_at')
int get archivedAt;
@nullable
@BuiltValueField(wireName: 'is_deleted')
bool get isDeleted;
//@JsonKey(name: 'tax_name1')
//String taxName1;
//@JsonKey(name: 'tax_rate1')
@ -45,16 +57,10 @@ abstract class ProductEntity implements Built<ProductEntity, ProductEntityBuilde
//String taxName2;
//@JsonKey(name: 'tax_rate2')
//double taxRate2;
//@JsonKey(name: 'updated_at')
//int updatedAt;
//@JsonKey(name: 'archived_at')
//int archivedAt;
//@JsonKey(name: 'custom_value1')
//String customValue1;
//@JsonKey(name: 'custom_value2')
//String customValue2;
//@JsonKey(name: 'is_deleted')
//bool isDeleted;
ProductEntity._();
factory ProductEntity([updates(ProductEntityBuilder b)]) = _$ProductEntity;

View File

@ -146,6 +146,24 @@ class _$ProductEntitySerializer implements StructuredSerializer<ProductEntity> {
..add(serializers.serialize(object.cost,
specifiedType: const FullType(double)));
}
if (object.updatedAt != null) {
result
..add('updated_at')
..add(serializers.serialize(object.updatedAt,
specifiedType: const FullType(int)));
}
if (object.archivedAt != null) {
result
..add('archived_at')
..add(serializers.serialize(object.archivedAt,
specifiedType: const FullType(int)));
}
if (object.isDeleted != null) {
result
..add('is_deleted')
..add(serializers.serialize(object.isDeleted,
specifiedType: const FullType(bool)));
}
return result;
}
@ -177,6 +195,18 @@ class _$ProductEntitySerializer implements StructuredSerializer<ProductEntity> {
result.cost = serializers.deserialize(value,
specifiedType: const FullType(double)) as double;
break;
case 'updated_at':
result.updatedAt = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
break;
case 'archived_at':
result.archivedAt = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
break;
case 'is_deleted':
result.isDeleted = serializers.deserialize(value,
specifiedType: const FullType(bool)) as bool;
break;
}
}
@ -374,11 +404,24 @@ class _$ProductEntity extends ProductEntity {
final String notes;
@override
final double cost;
@override
final int updatedAt;
@override
final int archivedAt;
@override
final bool isDeleted;
factory _$ProductEntity([void updates(ProductEntityBuilder b)]) =>
(new ProductEntityBuilder()..update(updates)).build();
_$ProductEntity._({this.id, this.productKey, this.notes, this.cost})
_$ProductEntity._(
{this.id,
this.productKey,
this.notes,
this.cost,
this.updatedAt,
this.archivedAt,
this.isDeleted})
: super._();
@override
@ -395,14 +438,24 @@ class _$ProductEntity extends ProductEntity {
return id == other.id &&
productKey == other.productKey &&
notes == other.notes &&
cost == other.cost;
cost == other.cost &&
updatedAt == other.updatedAt &&
archivedAt == other.archivedAt &&
isDeleted == other.isDeleted;
}
@override
int get hashCode {
return $jf($jc(
$jc($jc($jc(0, id.hashCode), productKey.hashCode), notes.hashCode),
cost.hashCode));
$jc(
$jc(
$jc(
$jc($jc($jc(0, id.hashCode), productKey.hashCode),
notes.hashCode),
cost.hashCode),
updatedAt.hashCode),
archivedAt.hashCode),
isDeleted.hashCode));
}
@override
@ -411,7 +464,10 @@ class _$ProductEntity extends ProductEntity {
..add('id', id)
..add('productKey', productKey)
..add('notes', notes)
..add('cost', cost))
..add('cost', cost)
..add('updatedAt', updatedAt)
..add('archivedAt', archivedAt)
..add('isDeleted', isDeleted))
.toString();
}
}
@ -436,6 +492,18 @@ class ProductEntityBuilder
double get cost => _$this._cost;
set cost(double cost) => _$this._cost = cost;
int _updatedAt;
int get updatedAt => _$this._updatedAt;
set updatedAt(int updatedAt) => _$this._updatedAt = updatedAt;
int _archivedAt;
int get archivedAt => _$this._archivedAt;
set archivedAt(int archivedAt) => _$this._archivedAt = archivedAt;
bool _isDeleted;
bool get isDeleted => _$this._isDeleted;
set isDeleted(bool isDeleted) => _$this._isDeleted = isDeleted;
ProductEntityBuilder();
ProductEntityBuilder get _$this {
@ -444,6 +512,9 @@ class ProductEntityBuilder
_productKey = _$v.productKey;
_notes = _$v.notes;
_cost = _$v.cost;
_updatedAt = _$v.updatedAt;
_archivedAt = _$v.archivedAt;
_isDeleted = _$v.isDeleted;
_$v = null;
}
return this;
@ -464,7 +535,13 @@ class ProductEntityBuilder
_$ProductEntity build() {
final _$result = _$v ??
new _$ProductEntity._(
id: id, productKey: productKey, notes: notes, cost: cost);
id: id,
productKey: productKey,
notes: notes,
cost: cost,
updatedAt: updatedAt,
archivedAt: archivedAt,
isDeleted: isDeleted);
replace(_$result);
return _$result;
}

View File

@ -15,7 +15,7 @@ class AppLocalization {
'en': {
'log_out': 'Log Out',
'dashboard': 'Dashboard',
'refresh_complete': 'Refresh complete',
'refresh_complete': 'Refresh Complete',
'please_enter_your_email': 'Please enter your email',
'please_enter_your_password': 'Please enter your password',
'please_enter_your_url': 'Please enter your URL',