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

View File

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

View File

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

View File

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