This commit is contained in:
Hillel Coren 2019-09-18 11:54:13 +03:00
parent 67fce0cf85
commit 31b6d137bd
13 changed files with 524 additions and 631 deletions

View File

@ -99,99 +99,161 @@ abstract class CompanyEntity
@BuiltValueField(wireName: 'default_url')
String get appUrl;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'currency_id')
String get companyCurrencyId;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'timezone_id')
String get timezoneId;
@BuiltValueField(wireName: 'country_id')
String get countryId;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'date_format_id')
String get dateFormatId;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'datetime_format_id')
String get datetimeFormatId;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'invoice_terms')
String get defaultInvoiceTerms;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'invoice_taxes')
bool get enableInvoiceTaxes;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'invoice_item_taxes')
bool get enableInvoiceItemTaxes;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'invoice_design_id')
String get defaultInvoiceDesignId;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'quote_design_id')
String get defaultQuoteDesignId;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'language_id')
String get languageId;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'invoice_footer')
String get defaultInvoiceFooter;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'show_item_taxes')
bool get showInvoiceItemTaxes;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'military_time')
bool get enableMilitaryTime;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'tax_name1')
String get defaultTaxName1;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'tax_rate1')
double get defaultTaxRate1;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'tax_name2')
String get defaultTaxName2;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'tax_rate2')
double get defaultTaxRate2;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'quote_terms')
String get defaultQuoteTerms;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'show_currency_code')
bool get showCurrencyCode;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'enable_second_tax_rate')
bool get enableSecondTaxRate;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'start_of_week')
int get startOfWeek;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'financial_year_start')
int get financialYearStart;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'enabled_modules')
int get enabledModules;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'payment_terms')
int get defaultPaymentTerms;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'payment_type_id')
String get defaultPaymentTypeId;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'task_rate')
double get defaultTaskRate;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'inclusive_taxes')
bool get enableInclusiveTaxes;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'convert_products')
bool get convertProductExchangeRate;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'custom_invoice_taxes1')
bool get enableCustomInvoiceTaxes1;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'custom_invoice_taxes2')
bool get enableCustomInvoiceTaxes2;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'tax_rates')
BuiltList<TaxRateEntity> get taxRates;
@ -205,58 +267,96 @@ abstract class CompanyEntity
@BuiltValueField(wireName: 'expense_categories')
BuiltList<ExpenseCategoryEntity> get expenseCategories;
// TODO remove this
@nullable
BuiltMap<String, ExpenseCategoryEntity> get expenseCategoryMap;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'users')
BuiltList<UserEntity> get users;
// TODO remove this
@nullable
BuiltMap<String, UserEntity> get userMap;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'custom_fields')
BuiltMap<String, String> get customFields;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'custom_payment_terms')
BuiltList<PaymentTermEntity> get customPaymentTerms;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'invoice_fields')
String get invoiceFields;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'email_footer')
String get emailFooter;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'email_subject_invoice')
String get emailSubjectInvoice;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'email_subject_quote')
String get emailSubjectQuote;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'email_subject_payment')
String get emailSubjectPayment;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'email_template_invoice')
String get emailBodyInvoice;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'email_template_quote')
String get emailBodyQuote;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'email_template_payment')
String get emailBodyPayment;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'email_subject_reminder1')
String get emailSubjectReminder1;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'email_subject_reminder2')
String get emailSubjectReminder2;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'email_subject_reminder3')
String get emailSubjectReminder3;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'email_template_reminder1')
String get emailBodyReminder1;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'email_template_reminder2')
String get emailBodyReminder2;
// TODO remove this
@nullable
@BuiltValueField(wireName: 'email_template_reminder3')
String get emailBodyReminder3;
@ -425,7 +525,7 @@ abstract class UserEntity implements Built<UserEntity, UserEntityBuilder> {
firstName: '',
lastName: '',
email: '',
id: 0,
id: '',
isAdmin: false,
permissionsMap: BuiltMap<String, bool>(),
);
@ -433,7 +533,7 @@ abstract class UserEntity implements Built<UserEntity, UserEntityBuilder> {
UserEntity._();
int get id;
String get id;
@BuiltValueField(wireName: 'first_name')
String get firstName;
@ -445,6 +545,8 @@ abstract class UserEntity implements Built<UserEntity, UserEntityBuilder> {
String get fullName => (firstName + ' ' + lastName).trim();
// TODO remove this
@nullable
@BuiltValueField(wireName: 'is_admin')
bool get isAdmin;
@ -483,7 +585,6 @@ abstract class UserCompanyEntity
implements Built<UserCompanyEntity, UserCompanyEntityBuilder> {
factory UserCompanyEntity() {
return _$UserCompanyEntity._(
isAdmin: false,
company: CompanyEntity(),
user: UserEntity(),
token: TokenEntity(),
@ -492,8 +593,6 @@ abstract class UserCompanyEntity
UserCompanyEntity._();
bool get isAdmin;
CompanyEntity get company;
UserEntity get user;

View File

@ -32,158 +32,15 @@ class _$CompanyEntitySerializer implements StructuredSerializer<CompanyEntity> {
'company_key',
serializers.serialize(object.companyKey,
specifiedType: const FullType(String)),
'invoice_terms',
serializers.serialize(object.defaultInvoiceTerms,
'country_id',
serializers.serialize(object.countryId,
specifiedType: const FullType(String)),
'invoice_taxes',
serializers.serialize(object.enableInvoiceTaxes,
specifiedType: const FullType(bool)),
'invoice_item_taxes',
serializers.serialize(object.enableInvoiceItemTaxes,
specifiedType: const FullType(bool)),
'invoice_design_id',
serializers.serialize(object.defaultInvoiceDesignId,
specifiedType: const FullType(String)),
'quote_design_id',
serializers.serialize(object.defaultQuoteDesignId,
specifiedType: const FullType(String)),
'language_id',
serializers.serialize(object.languageId,
specifiedType: const FullType(String)),
'invoice_footer',
serializers.serialize(object.defaultInvoiceFooter,
specifiedType: const FullType(String)),
'show_item_taxes',
serializers.serialize(object.showInvoiceItemTaxes,
specifiedType: const FullType(bool)),
'military_time',
serializers.serialize(object.enableMilitaryTime,
specifiedType: const FullType(bool)),
'tax_name1',
serializers.serialize(object.defaultTaxName1,
specifiedType: const FullType(String)),
'tax_rate1',
serializers.serialize(object.defaultTaxRate1,
specifiedType: const FullType(double)),
'tax_name2',
serializers.serialize(object.defaultTaxName2,
specifiedType: const FullType(String)),
'tax_rate2',
serializers.serialize(object.defaultTaxRate2,
specifiedType: const FullType(double)),
'quote_terms',
serializers.serialize(object.defaultQuoteTerms,
specifiedType: const FullType(String)),
'show_currency_code',
serializers.serialize(object.showCurrencyCode,
specifiedType: const FullType(bool)),
'enable_second_tax_rate',
serializers.serialize(object.enableSecondTaxRate,
specifiedType: const FullType(bool)),
'start_of_week',
serializers.serialize(object.startOfWeek,
specifiedType: const FullType(int)),
'financial_year_start',
serializers.serialize(object.financialYearStart,
specifiedType: const FullType(int)),
'enabled_modules',
serializers.serialize(object.enabledModules,
specifiedType: const FullType(int)),
'payment_terms',
serializers.serialize(object.defaultPaymentTerms,
specifiedType: const FullType(int)),
'payment_type_id',
serializers.serialize(object.defaultPaymentTypeId,
specifiedType: const FullType(String)),
'task_rate',
serializers.serialize(object.defaultTaskRate,
specifiedType: const FullType(double)),
'inclusive_taxes',
serializers.serialize(object.enableInclusiveTaxes,
specifiedType: const FullType(bool)),
'convert_products',
serializers.serialize(object.convertProductExchangeRate,
specifiedType: const FullType(bool)),
'custom_invoice_taxes1',
serializers.serialize(object.enableCustomInvoiceTaxes1,
specifiedType: const FullType(bool)),
'custom_invoice_taxes2',
serializers.serialize(object.enableCustomInvoiceTaxes2,
specifiedType: const FullType(bool)),
'tax_rates',
serializers.serialize(object.taxRates,
specifiedType:
const FullType(BuiltList, const [const FullType(TaxRateEntity)])),
'taskStatusMap',
serializers.serialize(object.taskStatusMap,
specifiedType: const FullType(BuiltMap, const [
const FullType(String),
const FullType(TaskStatusEntity)
])),
'expenseCategoryMap',
serializers.serialize(object.expenseCategoryMap,
specifiedType: const FullType(BuiltMap, const [
const FullType(String),
const FullType(ExpenseCategoryEntity)
])),
'users',
serializers.serialize(object.users,
specifiedType:
const FullType(BuiltList, const [const FullType(UserEntity)])),
'userMap',
serializers.serialize(object.userMap,
specifiedType: const FullType(BuiltMap,
const [const FullType(String), const FullType(UserEntity)])),
'custom_fields',
serializers.serialize(object.customFields,
specifiedType: const FullType(BuiltMap,
const [const FullType(String), const FullType(String)])),
'custom_payment_terms',
serializers.serialize(object.customPaymentTerms,
specifiedType: const FullType(
BuiltList, const [const FullType(PaymentTermEntity)])),
'invoice_fields',
serializers.serialize(object.invoiceFields,
specifiedType: const FullType(String)),
'email_footer',
serializers.serialize(object.emailFooter,
specifiedType: const FullType(String)),
'email_subject_invoice',
serializers.serialize(object.emailSubjectInvoice,
specifiedType: const FullType(String)),
'email_subject_quote',
serializers.serialize(object.emailSubjectQuote,
specifiedType: const FullType(String)),
'email_subject_payment',
serializers.serialize(object.emailSubjectPayment,
specifiedType: const FullType(String)),
'email_template_invoice',
serializers.serialize(object.emailBodyInvoice,
specifiedType: const FullType(String)),
'email_template_quote',
serializers.serialize(object.emailBodyQuote,
specifiedType: const FullType(String)),
'email_template_payment',
serializers.serialize(object.emailBodyPayment,
specifiedType: const FullType(String)),
'email_subject_reminder1',
serializers.serialize(object.emailSubjectReminder1,
specifiedType: const FullType(String)),
'email_subject_reminder2',
serializers.serialize(object.emailSubjectReminder2,
specifiedType: const FullType(String)),
'email_subject_reminder3',
serializers.serialize(object.emailSubjectReminder3,
specifiedType: const FullType(String)),
'email_template_reminder1',
serializers.serialize(object.emailBodyReminder1,
specifiedType: const FullType(String)),
'email_template_reminder2',
serializers.serialize(object.emailBodyReminder2,
specifiedType: const FullType(String)),
'email_template_reminder3',
serializers.serialize(object.emailBodyReminder3,
specifiedType: const FullType(String)),
];
if (object.plan != null) {
result
@ -215,12 +72,6 @@ class _$CompanyEntitySerializer implements StructuredSerializer<CompanyEntity> {
..add(serializers.serialize(object.timezoneId,
specifiedType: const FullType(String)));
}
if (object.countryId != null) {
result
..add('country_id')
..add(serializers.serialize(object.countryId,
specifiedType: const FullType(String)));
}
if (object.dateFormatId != null) {
result
..add('date_format_id')
@ -233,6 +84,169 @@ class _$CompanyEntitySerializer implements StructuredSerializer<CompanyEntity> {
..add(serializers.serialize(object.datetimeFormatId,
specifiedType: const FullType(String)));
}
if (object.defaultInvoiceTerms != null) {
result
..add('invoice_terms')
..add(serializers.serialize(object.defaultInvoiceTerms,
specifiedType: const FullType(String)));
}
if (object.enableInvoiceTaxes != null) {
result
..add('invoice_taxes')
..add(serializers.serialize(object.enableInvoiceTaxes,
specifiedType: const FullType(bool)));
}
if (object.enableInvoiceItemTaxes != null) {
result
..add('invoice_item_taxes')
..add(serializers.serialize(object.enableInvoiceItemTaxes,
specifiedType: const FullType(bool)));
}
if (object.defaultInvoiceDesignId != null) {
result
..add('invoice_design_id')
..add(serializers.serialize(object.defaultInvoiceDesignId,
specifiedType: const FullType(String)));
}
if (object.defaultQuoteDesignId != null) {
result
..add('quote_design_id')
..add(serializers.serialize(object.defaultQuoteDesignId,
specifiedType: const FullType(String)));
}
if (object.languageId != null) {
result
..add('language_id')
..add(serializers.serialize(object.languageId,
specifiedType: const FullType(String)));
}
if (object.defaultInvoiceFooter != null) {
result
..add('invoice_footer')
..add(serializers.serialize(object.defaultInvoiceFooter,
specifiedType: const FullType(String)));
}
if (object.showInvoiceItemTaxes != null) {
result
..add('show_item_taxes')
..add(serializers.serialize(object.showInvoiceItemTaxes,
specifiedType: const FullType(bool)));
}
if (object.enableMilitaryTime != null) {
result
..add('military_time')
..add(serializers.serialize(object.enableMilitaryTime,
specifiedType: const FullType(bool)));
}
if (object.defaultTaxName1 != null) {
result
..add('tax_name1')
..add(serializers.serialize(object.defaultTaxName1,
specifiedType: const FullType(String)));
}
if (object.defaultTaxRate1 != null) {
result
..add('tax_rate1')
..add(serializers.serialize(object.defaultTaxRate1,
specifiedType: const FullType(double)));
}
if (object.defaultTaxName2 != null) {
result
..add('tax_name2')
..add(serializers.serialize(object.defaultTaxName2,
specifiedType: const FullType(String)));
}
if (object.defaultTaxRate2 != null) {
result
..add('tax_rate2')
..add(serializers.serialize(object.defaultTaxRate2,
specifiedType: const FullType(double)));
}
if (object.defaultQuoteTerms != null) {
result
..add('quote_terms')
..add(serializers.serialize(object.defaultQuoteTerms,
specifiedType: const FullType(String)));
}
if (object.showCurrencyCode != null) {
result
..add('show_currency_code')
..add(serializers.serialize(object.showCurrencyCode,
specifiedType: const FullType(bool)));
}
if (object.enableSecondTaxRate != null) {
result
..add('enable_second_tax_rate')
..add(serializers.serialize(object.enableSecondTaxRate,
specifiedType: const FullType(bool)));
}
if (object.startOfWeek != null) {
result
..add('start_of_week')
..add(serializers.serialize(object.startOfWeek,
specifiedType: const FullType(int)));
}
if (object.financialYearStart != null) {
result
..add('financial_year_start')
..add(serializers.serialize(object.financialYearStart,
specifiedType: const FullType(int)));
}
if (object.enabledModules != null) {
result
..add('enabled_modules')
..add(serializers.serialize(object.enabledModules,
specifiedType: const FullType(int)));
}
if (object.defaultPaymentTerms != null) {
result
..add('payment_terms')
..add(serializers.serialize(object.defaultPaymentTerms,
specifiedType: const FullType(int)));
}
if (object.defaultPaymentTypeId != null) {
result
..add('payment_type_id')
..add(serializers.serialize(object.defaultPaymentTypeId,
specifiedType: const FullType(String)));
}
if (object.defaultTaskRate != null) {
result
..add('task_rate')
..add(serializers.serialize(object.defaultTaskRate,
specifiedType: const FullType(double)));
}
if (object.enableInclusiveTaxes != null) {
result
..add('inclusive_taxes')
..add(serializers.serialize(object.enableInclusiveTaxes,
specifiedType: const FullType(bool)));
}
if (object.convertProductExchangeRate != null) {
result
..add('convert_products')
..add(serializers.serialize(object.convertProductExchangeRate,
specifiedType: const FullType(bool)));
}
if (object.enableCustomInvoiceTaxes1 != null) {
result
..add('custom_invoice_taxes1')
..add(serializers.serialize(object.enableCustomInvoiceTaxes1,
specifiedType: const FullType(bool)));
}
if (object.enableCustomInvoiceTaxes2 != null) {
result
..add('custom_invoice_taxes2')
..add(serializers.serialize(object.enableCustomInvoiceTaxes2,
specifiedType: const FullType(bool)));
}
if (object.taxRates != null) {
result
..add('tax_rates')
..add(serializers.serialize(object.taxRates,
specifiedType: const FullType(
BuiltList, const [const FullType(TaxRateEntity)])));
}
if (object.taskStatuses != null) {
result
..add('task_statuses')
@ -247,6 +261,127 @@ class _$CompanyEntitySerializer implements StructuredSerializer<CompanyEntity> {
specifiedType: const FullType(
BuiltList, const [const FullType(ExpenseCategoryEntity)])));
}
if (object.expenseCategoryMap != null) {
result
..add('expenseCategoryMap')
..add(serializers.serialize(object.expenseCategoryMap,
specifiedType: const FullType(BuiltMap, const [
const FullType(String),
const FullType(ExpenseCategoryEntity)
])));
}
if (object.users != null) {
result
..add('users')
..add(serializers.serialize(object.users,
specifiedType:
const FullType(BuiltList, const [const FullType(UserEntity)])));
}
if (object.userMap != null) {
result
..add('userMap')
..add(serializers.serialize(object.userMap,
specifiedType: const FullType(BuiltMap,
const [const FullType(String), const FullType(UserEntity)])));
}
if (object.customFields != null) {
result
..add('custom_fields')
..add(serializers.serialize(object.customFields,
specifiedType: const FullType(BuiltMap,
const [const FullType(String), const FullType(String)])));
}
if (object.customPaymentTerms != null) {
result
..add('custom_payment_terms')
..add(serializers.serialize(object.customPaymentTerms,
specifiedType: const FullType(
BuiltList, const [const FullType(PaymentTermEntity)])));
}
if (object.invoiceFields != null) {
result
..add('invoice_fields')
..add(serializers.serialize(object.invoiceFields,
specifiedType: const FullType(String)));
}
if (object.emailFooter != null) {
result
..add('email_footer')
..add(serializers.serialize(object.emailFooter,
specifiedType: const FullType(String)));
}
if (object.emailSubjectInvoice != null) {
result
..add('email_subject_invoice')
..add(serializers.serialize(object.emailSubjectInvoice,
specifiedType: const FullType(String)));
}
if (object.emailSubjectQuote != null) {
result
..add('email_subject_quote')
..add(serializers.serialize(object.emailSubjectQuote,
specifiedType: const FullType(String)));
}
if (object.emailSubjectPayment != null) {
result
..add('email_subject_payment')
..add(serializers.serialize(object.emailSubjectPayment,
specifiedType: const FullType(String)));
}
if (object.emailBodyInvoice != null) {
result
..add('email_template_invoice')
..add(serializers.serialize(object.emailBodyInvoice,
specifiedType: const FullType(String)));
}
if (object.emailBodyQuote != null) {
result
..add('email_template_quote')
..add(serializers.serialize(object.emailBodyQuote,
specifiedType: const FullType(String)));
}
if (object.emailBodyPayment != null) {
result
..add('email_template_payment')
..add(serializers.serialize(object.emailBodyPayment,
specifiedType: const FullType(String)));
}
if (object.emailSubjectReminder1 != null) {
result
..add('email_subject_reminder1')
..add(serializers.serialize(object.emailSubjectReminder1,
specifiedType: const FullType(String)));
}
if (object.emailSubjectReminder2 != null) {
result
..add('email_subject_reminder2')
..add(serializers.serialize(object.emailSubjectReminder2,
specifiedType: const FullType(String)));
}
if (object.emailSubjectReminder3 != null) {
result
..add('email_subject_reminder3')
..add(serializers.serialize(object.emailSubjectReminder3,
specifiedType: const FullType(String)));
}
if (object.emailBodyReminder1 != null) {
result
..add('email_template_reminder1')
..add(serializers.serialize(object.emailBodyReminder1,
specifiedType: const FullType(String)));
}
if (object.emailBodyReminder2 != null) {
result
..add('email_template_reminder2')
..add(serializers.serialize(object.emailBodyReminder2,
specifiedType: const FullType(String)));
}
if (object.emailBodyReminder3 != null) {
result
..add('email_template_reminder3')
..add(serializers.serialize(object.emailBodyReminder3,
specifiedType: const FullType(String)));
}
if (object.fillProducts != null) {
result
..add('fill_products')
@ -723,7 +858,7 @@ class _$UserEntitySerializer implements StructuredSerializer<UserEntity> {
{FullType specifiedType = FullType.unspecified}) {
final result = <Object>[
'id',
serializers.serialize(object.id, specifiedType: const FullType(int)),
serializers.serialize(object.id, specifiedType: const FullType(String)),
'first_name',
serializers.serialize(object.firstName,
specifiedType: const FullType(String)),
@ -733,15 +868,17 @@ class _$UserEntitySerializer implements StructuredSerializer<UserEntity> {
'email',
serializers.serialize(object.email,
specifiedType: const FullType(String)),
'is_admin',
serializers.serialize(object.isAdmin,
specifiedType: const FullType(bool)),
'permissions',
serializers.serialize(object.permissionsMap,
specifiedType: const FullType(
BuiltMap, const [const FullType(String), const FullType(bool)])),
];
if (object.isAdmin != null) {
result
..add('is_admin')
..add(serializers.serialize(object.isAdmin,
specifiedType: const FullType(bool)));
}
return result;
}
@ -758,7 +895,7 @@ class _$UserEntitySerializer implements StructuredSerializer<UserEntity> {
switch (key) {
case 'id':
result.id = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
specifiedType: const FullType(String)) as String;
break;
case 'first_name':
result.firstName = serializers.deserialize(value,
@ -801,9 +938,6 @@ class _$UserCompanyEntitySerializer
Iterable<Object> serialize(Serializers serializers, UserCompanyEntity object,
{FullType specifiedType = FullType.unspecified}) {
final result = <Object>[
'isAdmin',
serializers.serialize(object.isAdmin,
specifiedType: const FullType(bool)),
'company',
serializers.serialize(object.company,
specifiedType: const FullType(CompanyEntity)),
@ -830,10 +964,6 @@ class _$UserCompanyEntitySerializer
iterator.moveNext();
final dynamic value = iterator.current;
switch (key) {
case 'isAdmin':
result.isAdmin = serializers.deserialize(value,
specifiedType: const FullType(bool)) as bool;
break;
case 'company':
result.company.replace(serializers.deserialize(value,
specifiedType: const FullType(CompanyEntity)) as CompanyEntity);
@ -1104,165 +1234,12 @@ class _$CompanyEntity extends CompanyEntity {
if (companyKey == null) {
throw new BuiltValueNullFieldError('CompanyEntity', 'companyKey');
}
if (defaultInvoiceTerms == null) {
throw new BuiltValueNullFieldError(
'CompanyEntity', 'defaultInvoiceTerms');
}
if (enableInvoiceTaxes == null) {
throw new BuiltValueNullFieldError('CompanyEntity', 'enableInvoiceTaxes');
}
if (enableInvoiceItemTaxes == null) {
throw new BuiltValueNullFieldError(
'CompanyEntity', 'enableInvoiceItemTaxes');
}
if (defaultInvoiceDesignId == null) {
throw new BuiltValueNullFieldError(
'CompanyEntity', 'defaultInvoiceDesignId');
}
if (defaultQuoteDesignId == null) {
throw new BuiltValueNullFieldError(
'CompanyEntity', 'defaultQuoteDesignId');
}
if (languageId == null) {
throw new BuiltValueNullFieldError('CompanyEntity', 'languageId');
}
if (defaultInvoiceFooter == null) {
throw new BuiltValueNullFieldError(
'CompanyEntity', 'defaultInvoiceFooter');
}
if (showInvoiceItemTaxes == null) {
throw new BuiltValueNullFieldError(
'CompanyEntity', 'showInvoiceItemTaxes');
}
if (enableMilitaryTime == null) {
throw new BuiltValueNullFieldError('CompanyEntity', 'enableMilitaryTime');
}
if (defaultTaxName1 == null) {
throw new BuiltValueNullFieldError('CompanyEntity', 'defaultTaxName1');
}
if (defaultTaxRate1 == null) {
throw new BuiltValueNullFieldError('CompanyEntity', 'defaultTaxRate1');
}
if (defaultTaxName2 == null) {
throw new BuiltValueNullFieldError('CompanyEntity', 'defaultTaxName2');
}
if (defaultTaxRate2 == null) {
throw new BuiltValueNullFieldError('CompanyEntity', 'defaultTaxRate2');
}
if (defaultQuoteTerms == null) {
throw new BuiltValueNullFieldError('CompanyEntity', 'defaultQuoteTerms');
}
if (showCurrencyCode == null) {
throw new BuiltValueNullFieldError('CompanyEntity', 'showCurrencyCode');
}
if (enableSecondTaxRate == null) {
throw new BuiltValueNullFieldError(
'CompanyEntity', 'enableSecondTaxRate');
}
if (startOfWeek == null) {
throw new BuiltValueNullFieldError('CompanyEntity', 'startOfWeek');
}
if (financialYearStart == null) {
throw new BuiltValueNullFieldError('CompanyEntity', 'financialYearStart');
}
if (enabledModules == null) {
throw new BuiltValueNullFieldError('CompanyEntity', 'enabledModules');
}
if (defaultPaymentTerms == null) {
throw new BuiltValueNullFieldError(
'CompanyEntity', 'defaultPaymentTerms');
}
if (defaultPaymentTypeId == null) {
throw new BuiltValueNullFieldError(
'CompanyEntity', 'defaultPaymentTypeId');
}
if (defaultTaskRate == null) {
throw new BuiltValueNullFieldError('CompanyEntity', 'defaultTaskRate');
}
if (enableInclusiveTaxes == null) {
throw new BuiltValueNullFieldError(
'CompanyEntity', 'enableInclusiveTaxes');
}
if (convertProductExchangeRate == null) {
throw new BuiltValueNullFieldError(
'CompanyEntity', 'convertProductExchangeRate');
}
if (enableCustomInvoiceTaxes1 == null) {
throw new BuiltValueNullFieldError(
'CompanyEntity', 'enableCustomInvoiceTaxes1');
}
if (enableCustomInvoiceTaxes2 == null) {
throw new BuiltValueNullFieldError(
'CompanyEntity', 'enableCustomInvoiceTaxes2');
}
if (taxRates == null) {
throw new BuiltValueNullFieldError('CompanyEntity', 'taxRates');
if (countryId == null) {
throw new BuiltValueNullFieldError('CompanyEntity', 'countryId');
}
if (taskStatusMap == null) {
throw new BuiltValueNullFieldError('CompanyEntity', 'taskStatusMap');
}
if (expenseCategoryMap == null) {
throw new BuiltValueNullFieldError('CompanyEntity', 'expenseCategoryMap');
}
if (users == null) {
throw new BuiltValueNullFieldError('CompanyEntity', 'users');
}
if (userMap == null) {
throw new BuiltValueNullFieldError('CompanyEntity', 'userMap');
}
if (customFields == null) {
throw new BuiltValueNullFieldError('CompanyEntity', 'customFields');
}
if (customPaymentTerms == null) {
throw new BuiltValueNullFieldError('CompanyEntity', 'customPaymentTerms');
}
if (invoiceFields == null) {
throw new BuiltValueNullFieldError('CompanyEntity', 'invoiceFields');
}
if (emailFooter == null) {
throw new BuiltValueNullFieldError('CompanyEntity', 'emailFooter');
}
if (emailSubjectInvoice == null) {
throw new BuiltValueNullFieldError(
'CompanyEntity', 'emailSubjectInvoice');
}
if (emailSubjectQuote == null) {
throw new BuiltValueNullFieldError('CompanyEntity', 'emailSubjectQuote');
}
if (emailSubjectPayment == null) {
throw new BuiltValueNullFieldError(
'CompanyEntity', 'emailSubjectPayment');
}
if (emailBodyInvoice == null) {
throw new BuiltValueNullFieldError('CompanyEntity', 'emailBodyInvoice');
}
if (emailBodyQuote == null) {
throw new BuiltValueNullFieldError('CompanyEntity', 'emailBodyQuote');
}
if (emailBodyPayment == null) {
throw new BuiltValueNullFieldError('CompanyEntity', 'emailBodyPayment');
}
if (emailSubjectReminder1 == null) {
throw new BuiltValueNullFieldError(
'CompanyEntity', 'emailSubjectReminder1');
}
if (emailSubjectReminder2 == null) {
throw new BuiltValueNullFieldError(
'CompanyEntity', 'emailSubjectReminder2');
}
if (emailSubjectReminder3 == null) {
throw new BuiltValueNullFieldError(
'CompanyEntity', 'emailSubjectReminder3');
}
if (emailBodyReminder1 == null) {
throw new BuiltValueNullFieldError('CompanyEntity', 'emailBodyReminder1');
}
if (emailBodyReminder2 == null) {
throw new BuiltValueNullFieldError('CompanyEntity', 'emailBodyReminder2');
}
if (emailBodyReminder3 == null) {
throw new BuiltValueNullFieldError('CompanyEntity', 'emailBodyReminder3');
}
}
@override
@ -1905,15 +1882,15 @@ class CompanyEntityBuilder
convertProductExchangeRate: convertProductExchangeRate,
enableCustomInvoiceTaxes1: enableCustomInvoiceTaxes1,
enableCustomInvoiceTaxes2: enableCustomInvoiceTaxes2,
taxRates: taxRates.build(),
taxRates: _taxRates?.build(),
taskStatuses: _taskStatuses?.build(),
taskStatusMap: taskStatusMap.build(),
expenseCategories: _expenseCategories?.build(),
expenseCategoryMap: expenseCategoryMap.build(),
users: users.build(),
userMap: userMap.build(),
customFields: customFields.build(),
customPaymentTerms: customPaymentTerms.build(),
expenseCategoryMap: _expenseCategoryMap?.build(),
users: _users?.build(),
userMap: _userMap?.build(),
customFields: _customFields?.build(),
customPaymentTerms: _customPaymentTerms?.build(),
invoiceFields: invoiceFields,
emailFooter: emailFooter,
emailSubjectInvoice: emailSubjectInvoice,
@ -1937,7 +1914,7 @@ class CompanyEntityBuilder
String _$failedField;
try {
_$failedField = 'taxRates';
taxRates.build();
_taxRates?.build();
_$failedField = 'taskStatuses';
_taskStatuses?.build();
_$failedField = 'taskStatusMap';
@ -1945,15 +1922,15 @@ class CompanyEntityBuilder
_$failedField = 'expenseCategories';
_expenseCategories?.build();
_$failedField = 'expenseCategoryMap';
expenseCategoryMap.build();
_expenseCategoryMap?.build();
_$failedField = 'users';
users.build();
_users?.build();
_$failedField = 'userMap';
userMap.build();
_userMap?.build();
_$failedField = 'customFields';
customFields.build();
_customFields?.build();
_$failedField = 'customPaymentTerms';
customPaymentTerms.build();
_customPaymentTerms?.build();
} catch (e) {
throw new BuiltValueNestedFieldError(
'CompanyEntity', _$failedField, e.toString());
@ -2199,7 +2176,7 @@ class TaxRateEntityBuilder
class _$UserEntity extends UserEntity {
@override
final int id;
final String id;
@override
final String firstName;
@override
@ -2234,9 +2211,6 @@ class _$UserEntity extends UserEntity {
if (email == null) {
throw new BuiltValueNullFieldError('UserEntity', 'email');
}
if (isAdmin == null) {
throw new BuiltValueNullFieldError('UserEntity', 'isAdmin');
}
if (permissionsMap == null) {
throw new BuiltValueNullFieldError('UserEntity', 'permissionsMap');
}
@ -2289,9 +2263,9 @@ class _$UserEntity extends UserEntity {
class UserEntityBuilder implements Builder<UserEntity, UserEntityBuilder> {
_$UserEntity _$v;
int _id;
int get id => _$this._id;
set id(int id) => _$this._id = id;
String _id;
String get id => _$this._id;
set id(String id) => _$this._id = id;
String _firstName;
String get firstName => _$this._firstName;
@ -2372,8 +2346,6 @@ class UserEntityBuilder implements Builder<UserEntity, UserEntityBuilder> {
}
class _$UserCompanyEntity extends UserCompanyEntity {
@override
final bool isAdmin;
@override
final CompanyEntity company;
@override
@ -2385,11 +2357,7 @@ class _$UserCompanyEntity extends UserCompanyEntity {
[void Function(UserCompanyEntityBuilder) updates]) =>
(new UserCompanyEntityBuilder()..update(updates)).build();
_$UserCompanyEntity._({this.isAdmin, this.company, this.user, this.token})
: super._() {
if (isAdmin == null) {
throw new BuiltValueNullFieldError('UserCompanyEntity', 'isAdmin');
}
_$UserCompanyEntity._({this.company, this.user, this.token}) : super._() {
if (company == null) {
throw new BuiltValueNullFieldError('UserCompanyEntity', 'company');
}
@ -2413,7 +2381,6 @@ class _$UserCompanyEntity extends UserCompanyEntity {
bool operator ==(Object other) {
if (identical(other, this)) return true;
return other is UserCompanyEntity &&
isAdmin == other.isAdmin &&
company == other.company &&
user == other.user &&
token == other.token;
@ -2421,15 +2388,13 @@ class _$UserCompanyEntity extends UserCompanyEntity {
@override
int get hashCode {
return $jf($jc(
$jc($jc($jc(0, isAdmin.hashCode), company.hashCode), user.hashCode),
token.hashCode));
return $jf(
$jc($jc($jc(0, company.hashCode), user.hashCode), token.hashCode));
}
@override
String toString() {
return (newBuiltValueToStringHelper('UserCompanyEntity')
..add('isAdmin', isAdmin)
..add('company', company)
..add('user', user)
..add('token', token))
@ -2441,10 +2406,6 @@ class UserCompanyEntityBuilder
implements Builder<UserCompanyEntity, UserCompanyEntityBuilder> {
_$UserCompanyEntity _$v;
bool _isAdmin;
bool get isAdmin => _$this._isAdmin;
set isAdmin(bool isAdmin) => _$this._isAdmin = isAdmin;
CompanyEntityBuilder _company;
CompanyEntityBuilder get company =>
_$this._company ??= new CompanyEntityBuilder();
@ -2462,7 +2423,6 @@ class UserCompanyEntityBuilder
UserCompanyEntityBuilder get _$this {
if (_$v != null) {
_isAdmin = _$v.isAdmin;
_company = _$v.company?.toBuilder();
_user = _$v.user?.toBuilder();
_token = _$v.token?.toBuilder();
@ -2490,7 +2450,6 @@ class UserCompanyEntityBuilder
try {
_$result = _$v ??
new _$UserCompanyEntity._(
isAdmin: isAdmin,
company: company.build(),
user: user.build(),
token: token.build());

View File

@ -218,25 +218,11 @@ abstract class LoginResponse
LoginResponse._();
@BuiltValueField(wireName: 'data')
LoginResponseData get data;
static Serializer<LoginResponse> get serializer => _$loginResponseSerializer;
}
abstract class LoginResponseData
implements Built<LoginResponseData, LoginResponseDataBuilder> {
factory LoginResponseData([void updates(LoginResponseDataBuilder b)]) =
_$LoginResponseData;
LoginResponseData._();
@BuiltValueField(wireName: 'company_users')
BuiltList<UserCompanyEntity> get userCompanies;
StaticData get static;
static Serializer<LoginResponseData> get serializer =>
_$loginResponseDataSerializer;
static Serializer<LoginResponse> get serializer => _$loginResponseSerializer;
}
abstract class StaticData implements Built<StaticData, StaticDataBuilder> {

View File

@ -196,8 +196,6 @@ Serializer<ErrorMessage> _$errorMessageSerializer =
new _$ErrorMessageSerializer();
Serializer<LoginResponse> _$loginResponseSerializer =
new _$LoginResponseSerializer();
Serializer<LoginResponseData> _$loginResponseDataSerializer =
new _$LoginResponseDataSerializer();
Serializer<StaticData> _$staticDataSerializer = new _$StaticDataSerializer();
Serializer<DashboardResponse> _$dashboardResponseSerializer =
new _$DashboardResponseSerializer();
@ -326,8 +324,12 @@ class _$LoginResponseSerializer implements StructuredSerializer<LoginResponse> {
{FullType specifiedType = FullType.unspecified}) {
final result = <Object>[
'data',
serializers.serialize(object.data,
specifiedType: const FullType(LoginResponseData)),
serializers.serialize(object.userCompanies,
specifiedType: const FullType(
BuiltList, const [const FullType(UserCompanyEntity)])),
'static',
serializers.serialize(object.static,
specifiedType: const FullType(StaticData)),
];
return result;
@ -346,53 +348,6 @@ class _$LoginResponseSerializer implements StructuredSerializer<LoginResponse> {
final dynamic value = iterator.current;
switch (key) {
case 'data':
result.data.replace(serializers.deserialize(value,
specifiedType: const FullType(LoginResponseData))
as LoginResponseData);
break;
}
}
return result.build();
}
}
class _$LoginResponseDataSerializer
implements StructuredSerializer<LoginResponseData> {
@override
final Iterable<Type> types = const [LoginResponseData, _$LoginResponseData];
@override
final String wireName = 'LoginResponseData';
@override
Iterable<Object> serialize(Serializers serializers, LoginResponseData object,
{FullType specifiedType = FullType.unspecified}) {
final result = <Object>[
'company_users',
serializers.serialize(object.userCompanies,
specifiedType: const FullType(
BuiltList, const [const FullType(UserCompanyEntity)])),
'static',
serializers.serialize(object.static,
specifiedType: const FullType(StaticData)),
];
return result;
}
@override
LoginResponseData deserialize(
Serializers serializers, Iterable<Object> serialized,
{FullType specifiedType = FullType.unspecified}) {
final result = new LoginResponseDataBuilder();
final iterator = serialized.iterator;
while (iterator.moveNext()) {
final key = iterator.current as String;
iterator.moveNext();
final dynamic value = iterator.current;
switch (key) {
case 'company_users':
result.userCompanies.replace(serializers.deserialize(value,
specifiedType: const FullType(
BuiltList, const [const FullType(UserCompanyEntity)]))
@ -868,14 +823,19 @@ class ErrorMessageBuilder
class _$LoginResponse extends LoginResponse {
@override
final LoginResponseData data;
final BuiltList<UserCompanyEntity> userCompanies;
@override
final StaticData static;
factory _$LoginResponse([void Function(LoginResponseBuilder) updates]) =>
(new LoginResponseBuilder()..update(updates)).build();
_$LoginResponse._({this.data}) : super._() {
if (data == null) {
throw new BuiltValueNullFieldError('LoginResponse', 'data');
_$LoginResponse._({this.userCompanies, this.static}) : super._() {
if (userCompanies == null) {
throw new BuiltValueNullFieldError('LoginResponse', 'userCompanies');
}
if (static == null) {
throw new BuiltValueNullFieldError('LoginResponse', 'static');
}
}
@ -889,17 +849,21 @@ class _$LoginResponse extends LoginResponse {
@override
bool operator ==(Object other) {
if (identical(other, this)) return true;
return other is LoginResponse && data == other.data;
return other is LoginResponse &&
userCompanies == other.userCompanies &&
static == other.static;
}
@override
int get hashCode {
return $jf($jc(0, data.hashCode));
return $jf($jc($jc(0, userCompanies.hashCode), static.hashCode));
}
@override
String toString() {
return (newBuiltValueToStringHelper('LoginResponse')..add('data', data))
return (newBuiltValueToStringHelper('LoginResponse')
..add('userCompanies', userCompanies)
..add('static', static))
.toString();
}
}
@ -908,16 +872,22 @@ class LoginResponseBuilder
implements Builder<LoginResponse, LoginResponseBuilder> {
_$LoginResponse _$v;
LoginResponseDataBuilder _data;
LoginResponseDataBuilder get data =>
_$this._data ??= new LoginResponseDataBuilder();
set data(LoginResponseDataBuilder data) => _$this._data = data;
ListBuilder<UserCompanyEntity> _userCompanies;
ListBuilder<UserCompanyEntity> get userCompanies =>
_$this._userCompanies ??= new ListBuilder<UserCompanyEntity>();
set userCompanies(ListBuilder<UserCompanyEntity> userCompanies) =>
_$this._userCompanies = userCompanies;
StaticDataBuilder _static;
StaticDataBuilder get static => _$this._static ??= new StaticDataBuilder();
set static(StaticDataBuilder static) => _$this._static = static;
LoginResponseBuilder();
LoginResponseBuilder get _$this {
if (_$v != null) {
_data = _$v.data?.toBuilder();
_userCompanies = _$v.userCompanies?.toBuilder();
_static = _$v.static?.toBuilder();
_$v = null;
}
return this;
@ -939,117 +909,9 @@ class LoginResponseBuilder
@override
_$LoginResponse build() {
_$LoginResponse _$result;
try {
_$result = _$v ?? new _$LoginResponse._(data: data.build());
} catch (_) {
String _$failedField;
try {
_$failedField = 'data';
data.build();
} catch (e) {
throw new BuiltValueNestedFieldError(
'LoginResponse', _$failedField, e.toString());
}
rethrow;
}
replace(_$result);
return _$result;
}
}
class _$LoginResponseData extends LoginResponseData {
@override
final BuiltList<UserCompanyEntity> userCompanies;
@override
final StaticData static;
factory _$LoginResponseData(
[void Function(LoginResponseDataBuilder) updates]) =>
(new LoginResponseDataBuilder()..update(updates)).build();
_$LoginResponseData._({this.userCompanies, this.static}) : super._() {
if (userCompanies == null) {
throw new BuiltValueNullFieldError('LoginResponseData', 'userCompanies');
}
if (static == null) {
throw new BuiltValueNullFieldError('LoginResponseData', 'static');
}
}
@override
LoginResponseData rebuild(void Function(LoginResponseDataBuilder) updates) =>
(toBuilder()..update(updates)).build();
@override
LoginResponseDataBuilder toBuilder() =>
new LoginResponseDataBuilder()..replace(this);
@override
bool operator ==(Object other) {
if (identical(other, this)) return true;
return other is LoginResponseData &&
userCompanies == other.userCompanies &&
static == other.static;
}
@override
int get hashCode {
return $jf($jc($jc(0, userCompanies.hashCode), static.hashCode));
}
@override
String toString() {
return (newBuiltValueToStringHelper('LoginResponseData')
..add('userCompanies', userCompanies)
..add('static', static))
.toString();
}
}
class LoginResponseDataBuilder
implements Builder<LoginResponseData, LoginResponseDataBuilder> {
_$LoginResponseData _$v;
ListBuilder<UserCompanyEntity> _userCompanies;
ListBuilder<UserCompanyEntity> get userCompanies =>
_$this._userCompanies ??= new ListBuilder<UserCompanyEntity>();
set userCompanies(ListBuilder<UserCompanyEntity> userCompanies) =>
_$this._userCompanies = userCompanies;
StaticDataBuilder _static;
StaticDataBuilder get static => _$this._static ??= new StaticDataBuilder();
set static(StaticDataBuilder static) => _$this._static = static;
LoginResponseDataBuilder();
LoginResponseDataBuilder get _$this {
if (_$v != null) {
_userCompanies = _$v.userCompanies?.toBuilder();
_static = _$v.static?.toBuilder();
_$v = null;
}
return this;
}
@override
void replace(LoginResponseData other) {
if (other == null) {
throw new ArgumentError.notNull('other');
}
_$v = other as _$LoginResponseData;
}
@override
void update(void Function(LoginResponseDataBuilder) updates) {
if (updates != null) updates(this);
}
@override
_$LoginResponseData build() {
_$LoginResponseData _$result;
try {
_$result = _$v ??
new _$LoginResponseData._(
new _$LoginResponse._(
userCompanies: userCompanies.build(), static: static.build());
} catch (_) {
String _$failedField;
@ -1060,7 +922,7 @@ class LoginResponseDataBuilder
static.build();
} catch (e) {
throw new BuiltValueNestedFieldError(
'LoginResponseData', _$failedField, e.toString());
'LoginResponse', _$failedField, e.toString());
}
rethrow;
}

View File

@ -75,7 +75,6 @@ Serializers _$serializers = (new Serializers().toBuilder()
..add(LanguageListResponse.serializer)
..add(ListUIState.serializer)
..add(LoginResponse.serializer)
..add(LoginResponseData.serializer)
..add(PaymentEntity.serializer)
..add(PaymentItemResponse.serializer)
..add(PaymentListResponse.serializer)

View File

@ -59,8 +59,8 @@ abstract class CountryEntity extends Object
name: '',
iso2: '',
iso3: '',
swapPostalCodeInt: 0,
swapCurrencySymbolInt: 0,
swapPostalCode: false,
swapCurrencySymbol: false,
thousandSeparator: '',
decimalSeparator: '',
);
@ -70,14 +70,10 @@ abstract class CountryEntity extends Object
String get name;
@BuiltValueField(wireName: 'swap_postal_code')
int get swapPostalCodeInt;
bool get swapPostalCode => swapCurrencySymbolInt == 1;
bool get swapPostalCode;
@BuiltValueField(wireName: 'swap_currency_symbol')
int get swapCurrencySymbolInt;
bool get swapCurrencySymbol => swapCurrencySymbolInt == 1;
bool get swapCurrencySymbol;
// TODO remove once fixed in the app
@nullable

View File

@ -121,11 +121,11 @@ class _$CountryEntitySerializer implements StructuredSerializer<CountryEntity> {
'name',
serializers.serialize(object.name, specifiedType: const FullType(String)),
'swap_postal_code',
serializers.serialize(object.swapPostalCodeInt,
specifiedType: const FullType(int)),
serializers.serialize(object.swapPostalCode,
specifiedType: const FullType(bool)),
'swap_currency_symbol',
serializers.serialize(object.swapCurrencySymbolInt,
specifiedType: const FullType(int)),
serializers.serialize(object.swapCurrencySymbol,
specifiedType: const FullType(bool)),
'iso_3166_2',
serializers.serialize(object.iso2, specifiedType: const FullType(String)),
'iso_3166_3',
@ -169,12 +169,12 @@ class _$CountryEntitySerializer implements StructuredSerializer<CountryEntity> {
specifiedType: const FullType(String)) as String;
break;
case 'swap_postal_code':
result.swapPostalCodeInt = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
result.swapPostalCode = serializers.deserialize(value,
specifiedType: const FullType(bool)) as bool;
break;
case 'swap_currency_symbol':
result.swapCurrencySymbolInt = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
result.swapCurrencySymbol = serializers.deserialize(value,
specifiedType: const FullType(bool)) as bool;
break;
case 'thousand_separator':
result.thousandSeparator = serializers.deserialize(value,
@ -396,9 +396,9 @@ class _$CountryEntity extends CountryEntity {
@override
final String name;
@override
final int swapPostalCodeInt;
final bool swapPostalCode;
@override
final int swapCurrencySymbolInt;
final bool swapCurrencySymbol;
@override
final String thousandSeparator;
@override
@ -415,8 +415,8 @@ class _$CountryEntity extends CountryEntity {
_$CountryEntity._(
{this.name,
this.swapPostalCodeInt,
this.swapCurrencySymbolInt,
this.swapPostalCode,
this.swapCurrencySymbol,
this.thousandSeparator,
this.decimalSeparator,
this.iso2,
@ -426,12 +426,11 @@ class _$CountryEntity extends CountryEntity {
if (name == null) {
throw new BuiltValueNullFieldError('CountryEntity', 'name');
}
if (swapPostalCodeInt == null) {
throw new BuiltValueNullFieldError('CountryEntity', 'swapPostalCodeInt');
if (swapPostalCode == null) {
throw new BuiltValueNullFieldError('CountryEntity', 'swapPostalCode');
}
if (swapCurrencySymbolInt == null) {
throw new BuiltValueNullFieldError(
'CountryEntity', 'swapCurrencySymbolInt');
if (swapCurrencySymbol == null) {
throw new BuiltValueNullFieldError('CountryEntity', 'swapCurrencySymbol');
}
if (iso2 == null) {
throw new BuiltValueNullFieldError('CountryEntity', 'iso2');
@ -453,8 +452,8 @@ class _$CountryEntity extends CountryEntity {
if (identical(other, this)) return true;
return other is CountryEntity &&
name == other.name &&
swapPostalCodeInt == other.swapPostalCodeInt &&
swapCurrencySymbolInt == other.swapCurrencySymbolInt &&
swapPostalCode == other.swapPostalCode &&
swapCurrencySymbol == other.swapCurrencySymbol &&
thousandSeparator == other.thousandSeparator &&
decimalSeparator == other.decimalSeparator &&
iso2 == other.iso2 &&
@ -469,10 +468,8 @@ class _$CountryEntity extends CountryEntity {
$jc(
$jc(
$jc(
$jc(
$jc($jc(0, name.hashCode),
swapPostalCodeInt.hashCode),
swapCurrencySymbolInt.hashCode),
$jc($jc($jc(0, name.hashCode), swapPostalCode.hashCode),
swapCurrencySymbol.hashCode),
thousandSeparator.hashCode),
decimalSeparator.hashCode),
iso2.hashCode),
@ -484,8 +481,8 @@ class _$CountryEntity extends CountryEntity {
String toString() {
return (newBuiltValueToStringHelper('CountryEntity')
..add('name', name)
..add('swapPostalCodeInt', swapPostalCodeInt)
..add('swapCurrencySymbolInt', swapCurrencySymbolInt)
..add('swapPostalCode', swapPostalCode)
..add('swapCurrencySymbol', swapCurrencySymbol)
..add('thousandSeparator', thousandSeparator)
..add('decimalSeparator', decimalSeparator)
..add('iso2', iso2)
@ -503,15 +500,15 @@ class CountryEntityBuilder
String get name => _$this._name;
set name(String name) => _$this._name = name;
int _swapPostalCodeInt;
int get swapPostalCodeInt => _$this._swapPostalCodeInt;
set swapPostalCodeInt(int swapPostalCodeInt) =>
_$this._swapPostalCodeInt = swapPostalCodeInt;
bool _swapPostalCode;
bool get swapPostalCode => _$this._swapPostalCode;
set swapPostalCode(bool swapPostalCode) =>
_$this._swapPostalCode = swapPostalCode;
int _swapCurrencySymbolInt;
int get swapCurrencySymbolInt => _$this._swapCurrencySymbolInt;
set swapCurrencySymbolInt(int swapCurrencySymbolInt) =>
_$this._swapCurrencySymbolInt = swapCurrencySymbolInt;
bool _swapCurrencySymbol;
bool get swapCurrencySymbol => _$this._swapCurrencySymbol;
set swapCurrencySymbol(bool swapCurrencySymbol) =>
_$this._swapCurrencySymbol = swapCurrencySymbol;
String _thousandSeparator;
String get thousandSeparator => _$this._thousandSeparator;
@ -540,8 +537,8 @@ class CountryEntityBuilder
CountryEntityBuilder get _$this {
if (_$v != null) {
_name = _$v.name;
_swapPostalCodeInt = _$v.swapPostalCodeInt;
_swapCurrencySymbolInt = _$v.swapCurrencySymbolInt;
_swapPostalCode = _$v.swapPostalCode;
_swapCurrencySymbol = _$v.swapCurrencySymbol;
_thousandSeparator = _$v.thousandSeparator;
_decimalSeparator = _$v.decimalSeparator;
_iso2 = _$v.iso2;
@ -570,8 +567,8 @@ class CountryEntityBuilder
final _$result = _$v ??
new _$CountryEntity._(
name: name,
swapPostalCodeInt: swapPostalCodeInt,
swapCurrencySymbolInt: swapCurrencySymbolInt,
swapPostalCode: swapPostalCode,
swapCurrencySymbol: swapCurrencySymbol,
thousandSeparator: thousandSeparator,
decimalSeparator: decimalSeparator,
iso2: iso2,

View File

@ -52,8 +52,8 @@ abstract class CurrencyEntity extends Object
thousandSeparator: '',
decimalSeparator: '',
code: '',
swapCurrencySymbolInt: 0,
exchangeRate: 0.0,
swapCurrencySymbol: false,
);
}
CurrencyEntity._();
@ -73,9 +73,7 @@ abstract class CurrencyEntity extends Object
String get code;
@BuiltValueField(wireName: 'swap_currency_symbol')
int get swapCurrencySymbolInt;
bool get swapCurrencySymbol => swapCurrencySymbolInt == 1;
bool get swapCurrencySymbol;
// TODO remove once fixed in the app
@nullable

View File

@ -136,8 +136,8 @@ class _$CurrencyEntitySerializer
'code',
serializers.serialize(object.code, specifiedType: const FullType(String)),
'swap_currency_symbol',
serializers.serialize(object.swapCurrencySymbolInt,
specifiedType: const FullType(int)),
serializers.serialize(object.swapCurrencySymbol,
specifiedType: const FullType(bool)),
];
if (object.exchangeRate != null) {
result
@ -191,8 +191,8 @@ class _$CurrencyEntitySerializer
specifiedType: const FullType(String)) as String;
break;
case 'swap_currency_symbol':
result.swapCurrencySymbolInt = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
result.swapCurrencySymbol = serializers.deserialize(value,
specifiedType: const FullType(bool)) as bool;
break;
case 'exchange_rate':
result.exchangeRate = serializers.deserialize(value,
@ -413,7 +413,7 @@ class _$CurrencyEntity extends CurrencyEntity {
@override
final String code;
@override
final int swapCurrencySymbolInt;
final bool swapCurrencySymbol;
@override
final double exchangeRate;
@override
@ -429,7 +429,7 @@ class _$CurrencyEntity extends CurrencyEntity {
this.thousandSeparator,
this.decimalSeparator,
this.code,
this.swapCurrencySymbolInt,
this.swapCurrencySymbol,
this.exchangeRate,
this.id})
: super._() {
@ -451,9 +451,9 @@ class _$CurrencyEntity extends CurrencyEntity {
if (code == null) {
throw new BuiltValueNullFieldError('CurrencyEntity', 'code');
}
if (swapCurrencySymbolInt == null) {
if (swapCurrencySymbol == null) {
throw new BuiltValueNullFieldError(
'CurrencyEntity', 'swapCurrencySymbolInt');
'CurrencyEntity', 'swapCurrencySymbol');
}
}
@ -475,7 +475,7 @@ class _$CurrencyEntity extends CurrencyEntity {
thousandSeparator == other.thousandSeparator &&
decimalSeparator == other.decimalSeparator &&
code == other.code &&
swapCurrencySymbolInt == other.swapCurrencySymbolInt &&
swapCurrencySymbol == other.swapCurrencySymbol &&
exchangeRate == other.exchangeRate &&
id == other.id;
}
@ -493,7 +493,7 @@ class _$CurrencyEntity extends CurrencyEntity {
thousandSeparator.hashCode),
decimalSeparator.hashCode),
code.hashCode),
swapCurrencySymbolInt.hashCode),
swapCurrencySymbol.hashCode),
exchangeRate.hashCode),
id.hashCode));
}
@ -507,7 +507,7 @@ class _$CurrencyEntity extends CurrencyEntity {
..add('thousandSeparator', thousandSeparator)
..add('decimalSeparator', decimalSeparator)
..add('code', code)
..add('swapCurrencySymbolInt', swapCurrencySymbolInt)
..add('swapCurrencySymbol', swapCurrencySymbol)
..add('exchangeRate', exchangeRate)
..add('id', id))
.toString();
@ -544,10 +544,10 @@ class CurrencyEntityBuilder
String get code => _$this._code;
set code(String code) => _$this._code = code;
int _swapCurrencySymbolInt;
int get swapCurrencySymbolInt => _$this._swapCurrencySymbolInt;
set swapCurrencySymbolInt(int swapCurrencySymbolInt) =>
_$this._swapCurrencySymbolInt = swapCurrencySymbolInt;
bool _swapCurrencySymbol;
bool get swapCurrencySymbol => _$this._swapCurrencySymbol;
set swapCurrencySymbol(bool swapCurrencySymbol) =>
_$this._swapCurrencySymbol = swapCurrencySymbol;
double _exchangeRate;
double get exchangeRate => _$this._exchangeRate;
@ -567,7 +567,7 @@ class CurrencyEntityBuilder
_thousandSeparator = _$v.thousandSeparator;
_decimalSeparator = _$v.decimalSeparator;
_code = _$v.code;
_swapCurrencySymbolInt = _$v.swapCurrencySymbolInt;
_swapCurrencySymbol = _$v.swapCurrencySymbol;
_exchangeRate = _$v.exchangeRate;
_id = _$v.id;
_$v = null;
@ -598,7 +598,7 @@ class CurrencyEntityBuilder
thousandSeparator: thousandSeparator,
decimalSeparator: decimalSeparator,
code: code,
swapCurrencySymbolInt: swapCurrencySymbolInt,
swapCurrencySymbol: swapCurrencySymbol,
exchangeRate: exchangeRate,
id: id);
replace(_$result);

View File

@ -15,7 +15,7 @@ class AuthRepository {
final WebClient webClient;
Future<LoginResponseData> signUp({
Future<LoginResponse> signUp({
String firstName,
String lastName,
String email,
@ -37,7 +37,7 @@ class AuthRepository {
return sendRequest(url: url, data: credentials);
}
Future<LoginResponseData> login(
Future<LoginResponse> login(
{String email,
String password,
String url,
@ -57,7 +57,7 @@ class AuthRepository {
return sendRequest(url: url, data: credentials);
}
Future<LoginResponseData> oauthLogin(
Future<LoginResponse> oauthLogin(
{String token, String url, String secret, String platform}) async {
final credentials = {
'token_name': 'invoice-ninja-$platform-app',
@ -70,7 +70,7 @@ class AuthRepository {
return sendRequest(url: url, data: credentials);
}
Future<LoginResponseData> refresh(
Future<LoginResponse> refresh(
{String url, String token, String platform}) async {
final credentials = {
'token_name': 'invoice-ninja-$platform-app',
@ -81,7 +81,7 @@ class AuthRepository {
return sendRequest(url: url, data: credentials, token: token);
}
Future<LoginResponseData> sendRequest(
Future<LoginResponse> sendRequest(
{String url, dynamic data, String token}) async {
/*
url +=
@ -96,6 +96,6 @@ class AuthRepository {
final LoginResponse loginResponse =
serializers.deserializeWith(LoginResponse.serializer, response);
return loginResponse.data;
return loginResponse;
}
}

View File

@ -176,9 +176,6 @@ String _parseError(int code, String response) {
}
bool _isVersionSupported(String version) {
// TODO remove this
return true;
if (version == null || version.isEmpty) {
return false;
}

View File

@ -67,7 +67,7 @@ class LoadAccountSuccess {
{this.loginResponse, this.completer, this.loadCompanies = true});
final Completer completer;
final LoginResponseData loginResponse;
final LoginResponse loginResponse;
final bool loadCompanies;
}

View File

@ -317,12 +317,12 @@ Middleware<AppState> _createAccountLoaded() {
return (Store<AppState> store, dynamic dynamicAction,
NextDispatcher next) async {
final action = dynamicAction as LoadAccountSuccess;
final data = action.loginResponse;
store.dispatch(LoadStaticSuccess(data: data.static));
final response = action.loginResponse;
store.dispatch(LoadStaticSuccess(data: response.static));
if (action.loadCompanies) {
for (int i = 0; i < data.userCompanies.length; i++) {
final UserCompanyEntity userCompany = data.userCompanies[i];
for (int i = 0; i < response.userCompanies.length; i++) {
final UserCompanyEntity userCompany = response.userCompanies[i];
final SharedPreferences prefs = await SharedPreferences.getInstance();
prefs.setString(getCompanyTokenKey(i), userCompany.token.token);
@ -331,7 +331,7 @@ Middleware<AppState> _createAccountLoaded() {
store.dispatch(LoadCompanySuccess(userCompany));
}
store.dispatch(SelectCompany(1, data.userCompanies[0]));
store.dispatch(SelectCompany(1, response.userCompanies[0]));
store.dispatch(UserLoginSuccess());
}