mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 15:20:34 +00:00
fix: remove relation bind knex.
This commit is contained in:
@@ -63,7 +63,7 @@ export default class Account extends TenantModel {
|
|||||||
*/
|
*/
|
||||||
type: {
|
type: {
|
||||||
relation: Model.BelongsToOneRelation,
|
relation: Model.BelongsToOneRelation,
|
||||||
modelClass: this.relationBindKnex(AccountType.default),
|
modelClass: AccountType.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'accounts.accountTypeId',
|
from: 'accounts.accountTypeId',
|
||||||
to: 'account_types.id',
|
to: 'account_types.id',
|
||||||
@@ -75,7 +75,7 @@ export default class Account extends TenantModel {
|
|||||||
*/
|
*/
|
||||||
transactions: {
|
transactions: {
|
||||||
relation: Model.HasManyRelation,
|
relation: Model.HasManyRelation,
|
||||||
modelClass: this.relationBindKnex(AccountTransaction.default),
|
modelClass: AccountTransaction.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'accounts.id',
|
from: 'accounts.id',
|
||||||
to: 'accounts_transactions.accountId',
|
to: 'accounts_transactions.accountId',
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ export default class AccountTransaction extends TenantModel {
|
|||||||
return {
|
return {
|
||||||
account: {
|
account: {
|
||||||
relation: Model.BelongsToOneRelation,
|
relation: Model.BelongsToOneRelation,
|
||||||
modelClass: this.relationBindKnex(Account.default),
|
modelClass: Account.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'accounts_transactions.accountId',
|
from: 'accounts_transactions.accountId',
|
||||||
to: 'accounts.id',
|
to: 'accounts.id',
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export default class AccountType extends TenantModel {
|
|||||||
*/
|
*/
|
||||||
accounts: {
|
accounts: {
|
||||||
relation: Model.HasManyRelation,
|
relation: Model.HasManyRelation,
|
||||||
modelClass: this.relationBindKnex(Account.default),
|
modelClass: Account.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'account_types.id',
|
from: 'account_types.id',
|
||||||
to: 'accounts.accountTypeId',
|
to: 'accounts.accountTypeId',
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ export default class Bill extends TenantModel {
|
|||||||
return {
|
return {
|
||||||
vendor: {
|
vendor: {
|
||||||
relation: Model.BelongsToOneRelation,
|
relation: Model.BelongsToOneRelation,
|
||||||
modelClass: this.relationBindKnex(Vendor.default),
|
modelClass: Vendor.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'bills.vendorId',
|
from: 'bills.vendorId',
|
||||||
to: 'vendors.id',
|
to: 'vendors.id',
|
||||||
@@ -51,7 +51,7 @@ export default class Bill extends TenantModel {
|
|||||||
|
|
||||||
entries: {
|
entries: {
|
||||||
relation: Model.HasManyRelation,
|
relation: Model.HasManyRelation,
|
||||||
modelClass: this.relationBindKnex(ItemEntry.default),
|
modelClass: ItemEntry.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'bills.id',
|
from: 'bills.id',
|
||||||
to: 'items_entries.referenceId',
|
to: 'items_entries.referenceId',
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export default class BillPayment extends TenantModel {
|
|||||||
return {
|
return {
|
||||||
entries: {
|
entries: {
|
||||||
relation: Model.HasManyRelation,
|
relation: Model.HasManyRelation,
|
||||||
modelClass: this.relationBindKnex(BillPaymentEntry.default),
|
modelClass: BillPaymentEntry.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'bills_payments.id',
|
from: 'bills_payments.id',
|
||||||
to: 'bills_payments_entries.billPaymentId',
|
to: 'bills_payments_entries.billPaymentId',
|
||||||
@@ -37,7 +37,7 @@ export default class BillPayment extends TenantModel {
|
|||||||
|
|
||||||
vendor: {
|
vendor: {
|
||||||
relation: Model.BelongsToOneRelation,
|
relation: Model.BelongsToOneRelation,
|
||||||
modelClass: this.relationBindKnex(Vendor.default),
|
modelClass: Vendor.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'bills_payments.vendorId',
|
from: 'bills_payments.vendorId',
|
||||||
to: 'vendors.id',
|
to: 'vendors.id',
|
||||||
@@ -46,7 +46,7 @@ export default class BillPayment extends TenantModel {
|
|||||||
|
|
||||||
paymentAccount: {
|
paymentAccount: {
|
||||||
relation: Model.BelongsToOneRelation,
|
relation: Model.BelongsToOneRelation,
|
||||||
modelClass: this.relationBindKnex(Account.default),
|
modelClass: Account.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'bills_payments.paymentAccountId',
|
from: 'bills_payments.paymentAccountId',
|
||||||
to: 'accounts.id',
|
to: 'accounts.id',
|
||||||
@@ -55,7 +55,7 @@ export default class BillPayment extends TenantModel {
|
|||||||
|
|
||||||
transactions: {
|
transactions: {
|
||||||
relation: Model.HasManyRelation,
|
relation: Model.HasManyRelation,
|
||||||
modelClass: this.relationBindKnex(AccountTransaction.default),
|
modelClass: AccountTransaction.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'bills_payments.id',
|
from: 'bills_payments.id',
|
||||||
to: 'accounts_transactions.referenceId'
|
to: 'accounts_transactions.referenceId'
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ export default class Contact extends TenantModel {
|
|||||||
return {
|
return {
|
||||||
salesInvoices: {
|
salesInvoices: {
|
||||||
relation: Model.HasManyRelation,
|
relation: Model.HasManyRelation,
|
||||||
modelClass: this.relationBindKnex(SaleInvoice.default),
|
modelClass: SaleInvoice.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'contacts.id',
|
from: 'contacts.id',
|
||||||
to: 'sales_invoices.customerId',
|
to: 'sales_invoices.customerId',
|
||||||
@@ -54,7 +54,7 @@ export default class Contact extends TenantModel {
|
|||||||
|
|
||||||
bills: {
|
bills: {
|
||||||
relation: Model.HasManyRelation,
|
relation: Model.HasManyRelation,
|
||||||
modelClass: this.relationBindKnex(Bill.default),
|
modelClass: Bill.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'contacts.id',
|
from: 'contacts.id',
|
||||||
to: 'bills.vendorId',
|
to: 'bills.vendorId',
|
||||||
|
|||||||
@@ -72,11 +72,12 @@ export default class Expense extends TenantModel {
|
|||||||
static get relationMappings() {
|
static get relationMappings() {
|
||||||
const Account = require('models/Account');
|
const Account = require('models/Account');
|
||||||
const ExpenseCategory = require('models/ExpenseCategory');
|
const ExpenseCategory = require('models/ExpenseCategory');
|
||||||
|
const SystemUser = require('system/models/SystemUser');
|
||||||
|
|
||||||
return {
|
return {
|
||||||
paymentAccount: {
|
paymentAccount: {
|
||||||
relation: Model.BelongsToOneRelation,
|
relation: Model.BelongsToOneRelation,
|
||||||
modelClass: this.relationBindKnex(Account.default),
|
modelClass: Account.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'expenses_transactions.paymentAccountId',
|
from: 'expenses_transactions.paymentAccountId',
|
||||||
to: 'accounts.id',
|
to: 'accounts.id',
|
||||||
@@ -84,12 +85,20 @@ export default class Expense extends TenantModel {
|
|||||||
},
|
},
|
||||||
categories: {
|
categories: {
|
||||||
relation: Model.HasManyRelation,
|
relation: Model.HasManyRelation,
|
||||||
modelClass: this.relationBindKnex(ExpenseCategory.default),
|
modelClass: ExpenseCategory.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'expenses_transactions.id',
|
from: 'expenses_transactions.id',
|
||||||
to: 'expense_transaction_categories.expenseId',
|
to: 'expense_transaction_categories.expenseId',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
user: {
|
||||||
|
relation: Model.BelongsToOneRelation,
|
||||||
|
modelClass: SystemUser.default,
|
||||||
|
join: {
|
||||||
|
from: 'expenses_transactions.userId',
|
||||||
|
to: 'users.id',
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export default class ExpenseCategory extends TenantModel {
|
|||||||
return {
|
return {
|
||||||
expenseAccount: {
|
expenseAccount: {
|
||||||
relation: Model.BelongsToOneRelation,
|
relation: Model.BelongsToOneRelation,
|
||||||
modelClass: this.relationBindKnex(Account.default),
|
modelClass: Account.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'expense_transaction_categories.expenseAccountId',
|
from: 'expense_transaction_categories.expenseAccountId',
|
||||||
to: 'accounts.id',
|
to: 'accounts.id',
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ export default class InventoryCostLotTracker extends TenantModel {
|
|||||||
return {
|
return {
|
||||||
item: {
|
item: {
|
||||||
relation: Model.BelongsToOneRelation,
|
relation: Model.BelongsToOneRelation,
|
||||||
modelClass: this.relationBindKnex(Item.default),
|
modelClass: Item.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'inventory_cost_lot_tracker.itemId',
|
from: 'inventory_cost_lot_tracker.itemId',
|
||||||
to: 'items.id',
|
to: 'items.id',
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ export default class InventoryTransaction extends TenantModel {
|
|||||||
return {
|
return {
|
||||||
item: {
|
item: {
|
||||||
relation: Model.BelongsToOneRelation,
|
relation: Model.BelongsToOneRelation,
|
||||||
modelClass: this.relationBindKnex(Item.default),
|
modelClass: Item.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'inventory_transactions.itemId',
|
from: 'inventory_transactions.itemId',
|
||||||
to: 'items.id',
|
to: 'items.id',
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ export default class Item extends TenantModel {
|
|||||||
*/
|
*/
|
||||||
category: {
|
category: {
|
||||||
relation: Model.BelongsToOneRelation,
|
relation: Model.BelongsToOneRelation,
|
||||||
modelClass: this.relationBindKnex(ItemCategory.default),
|
modelClass: ItemCategory.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'items.categoryId',
|
from: 'items.categoryId',
|
||||||
to: 'items_categories.id',
|
to: 'items_categories.id',
|
||||||
@@ -58,7 +58,7 @@ export default class Item extends TenantModel {
|
|||||||
|
|
||||||
costAccount: {
|
costAccount: {
|
||||||
relation: Model.BelongsToOneRelation,
|
relation: Model.BelongsToOneRelation,
|
||||||
modelClass: this.relationBindKnex(Account.default),
|
modelClass: Account.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'items.costAccountId',
|
from: 'items.costAccountId',
|
||||||
to: 'accounts.id',
|
to: 'accounts.id',
|
||||||
@@ -67,7 +67,7 @@ export default class Item extends TenantModel {
|
|||||||
|
|
||||||
sellAccount: {
|
sellAccount: {
|
||||||
relation: Model.BelongsToOneRelation,
|
relation: Model.BelongsToOneRelation,
|
||||||
modelClass: this.relationBindKnex(Account.default),
|
modelClass: Account.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'items.sellAccountId',
|
from: 'items.sellAccountId',
|
||||||
to: 'accounts.id',
|
to: 'accounts.id',
|
||||||
@@ -76,7 +76,7 @@ export default class Item extends TenantModel {
|
|||||||
|
|
||||||
inventoryAccount: {
|
inventoryAccount: {
|
||||||
relation: Model.BelongsToOneRelation,
|
relation: Model.BelongsToOneRelation,
|
||||||
modelClass: this.relationBindKnex(Account.default),
|
modelClass: Account.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'items.inventoryAccountId',
|
from: 'items.inventoryAccountId',
|
||||||
to: 'accounts.id',
|
to: 'accounts.id',
|
||||||
@@ -85,7 +85,7 @@ export default class Item extends TenantModel {
|
|||||||
|
|
||||||
media: {
|
media: {
|
||||||
relation: Model.ManyToManyRelation,
|
relation: Model.ManyToManyRelation,
|
||||||
modelClass: this.relationBindKnex(Media.default),
|
modelClass: Media.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'items.id',
|
from: 'items.id',
|
||||||
through: {
|
through: {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export default class ItemCategory extends TenantModel {
|
|||||||
*/
|
*/
|
||||||
items: {
|
items: {
|
||||||
relation: Model.HasManyRelation,
|
relation: Model.HasManyRelation,
|
||||||
modelClass: this.relationBindKnex(Item.default),
|
modelClass: Item.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'items_categories.id',
|
from: 'items_categories.id',
|
||||||
to: 'items.categoryId',
|
to: 'items.categoryId',
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ export default class ItemEntry extends TenantModel {
|
|||||||
return {
|
return {
|
||||||
item: {
|
item: {
|
||||||
relation: Model.BelongsToOneRelation,
|
relation: Model.BelongsToOneRelation,
|
||||||
modelClass: this.relationBindKnex(Item.default),
|
modelClass: Item.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'items_entries.itemId',
|
from: 'items_entries.itemId',
|
||||||
to: 'items.id',
|
to: 'items.id',
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export default class ManualJournal extends TenantModel {
|
|||||||
return {
|
return {
|
||||||
entries: {
|
entries: {
|
||||||
relation: Model.HasManyRelation,
|
relation: Model.HasManyRelation,
|
||||||
modelClass: this.relationBindKnex(AccountTransaction.default),
|
modelClass: AccountTransaction.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'manual_journals.id',
|
from: 'manual_journals.id',
|
||||||
to: 'accounts_transactions.referenceId',
|
to: 'accounts_transactions.referenceId',
|
||||||
@@ -38,7 +38,7 @@ export default class ManualJournal extends TenantModel {
|
|||||||
},
|
},
|
||||||
media: {
|
media: {
|
||||||
relation: Model.ManyToManyRelation,
|
relation: Model.ManyToManyRelation,
|
||||||
modelClass: this.relationBindKnex(Media.default),
|
modelClass: Media.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'manual_journals.id',
|
from: 'manual_journals.id',
|
||||||
through: {
|
through: {
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export default class PaymentReceive extends TenantModel {
|
|||||||
return {
|
return {
|
||||||
customer: {
|
customer: {
|
||||||
relation: Model.BelongsToOneRelation,
|
relation: Model.BelongsToOneRelation,
|
||||||
modelClass: this.relationBindKnex(Customer.default),
|
modelClass: Customer.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'payment_receives.customerId',
|
from: 'payment_receives.customerId',
|
||||||
to: 'customers.id',
|
to: 'customers.id',
|
||||||
@@ -37,7 +37,7 @@ export default class PaymentReceive extends TenantModel {
|
|||||||
|
|
||||||
depositAccount: {
|
depositAccount: {
|
||||||
relation: Model.BelongsToOneRelation,
|
relation: Model.BelongsToOneRelation,
|
||||||
modelClass: this.relationBindKnex(Account.default),
|
modelClass: Account.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'payment_receives.depositAccountId',
|
from: 'payment_receives.depositAccountId',
|
||||||
to: 'accounts.id',
|
to: 'accounts.id',
|
||||||
@@ -46,7 +46,7 @@ export default class PaymentReceive extends TenantModel {
|
|||||||
|
|
||||||
entries: {
|
entries: {
|
||||||
relation: Model.HasManyRelation,
|
relation: Model.HasManyRelation,
|
||||||
modelClass: this.relationBindKnex(PaymentReceiveEntry.default),
|
modelClass: PaymentReceiveEntry.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'payment_receives.id',
|
from: 'payment_receives.id',
|
||||||
to: 'payment_receives_entries.paymentReceiveId',
|
to: 'payment_receives_entries.paymentReceiveId',
|
||||||
@@ -55,7 +55,7 @@ export default class PaymentReceive extends TenantModel {
|
|||||||
|
|
||||||
transactions: {
|
transactions: {
|
||||||
relation: Model.HasManyRelation,
|
relation: Model.HasManyRelation,
|
||||||
modelClass: this.relationBindKnex(AccountTransaction.default),
|
modelClass: AccountTransaction.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'payment_receives.id',
|
from: 'payment_receives.id',
|
||||||
to: 'accounts_transactions.referenceId'
|
to: 'accounts_transactions.referenceId'
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export default class PaymentReceiveEntry extends TenantModel {
|
|||||||
*/
|
*/
|
||||||
entries: {
|
entries: {
|
||||||
relation: Model.HasManyRelation,
|
relation: Model.HasManyRelation,
|
||||||
modelClass: this.relationBindKnex(PaymentReceive.default),
|
modelClass: PaymentReceive.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'payment_receives_entries.payment_receive_id',
|
from: 'payment_receives_entries.payment_receive_id',
|
||||||
to: 'payment_receives.id',
|
to: 'payment_receives.id',
|
||||||
@@ -40,7 +40,7 @@ export default class PaymentReceiveEntry extends TenantModel {
|
|||||||
*/
|
*/
|
||||||
invoice: {
|
invoice: {
|
||||||
relation: Model.BelongsToOneRelation,
|
relation: Model.BelongsToOneRelation,
|
||||||
modelClass: this.relationBindKnex(SaleInvoice.default),
|
modelClass: SaleInvoice.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'payment_receives_entries.invoiceId',
|
from: 'payment_receives_entries.invoiceId',
|
||||||
to: 'sales_invoices.id',
|
to: 'sales_invoices.id',
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export default class SaleEstimate extends TenantModel {
|
|||||||
return {
|
return {
|
||||||
customer: {
|
customer: {
|
||||||
relation: Model.BelongsToOneRelation,
|
relation: Model.BelongsToOneRelation,
|
||||||
modelClass: this.relationBindKnex(Customer.default),
|
modelClass: Customer.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'sales_estimates.customerId',
|
from: 'sales_estimates.customerId',
|
||||||
to: 'customers.id',
|
to: 'customers.id',
|
||||||
@@ -35,7 +35,7 @@ export default class SaleEstimate extends TenantModel {
|
|||||||
|
|
||||||
entries: {
|
entries: {
|
||||||
relation: Model.HasManyRelation,
|
relation: Model.HasManyRelation,
|
||||||
modelClass: this.relationBindKnex(ItemEntry.default),
|
modelClass: ItemEntry.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'sales_estimates.id',
|
from: 'sales_estimates.id',
|
||||||
to: 'items_entries.referenceId',
|
to: 'items_entries.referenceId',
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export default class SaleEstimateEntry extends TenantModel {
|
|||||||
return {
|
return {
|
||||||
estimate: {
|
estimate: {
|
||||||
relation: Model.BelongsToOneRelation,
|
relation: Model.BelongsToOneRelation,
|
||||||
modelClass: this.relationBindKnex(SaleEstimate.default),
|
modelClass: SaleEstimate.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'sales_estimates.id',
|
from: 'sales_estimates.id',
|
||||||
to: 'sales_estimate_entries.estimate_id',
|
to: 'sales_estimate_entries.estimate_id',
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ export default class SaleInvoice extends TenantModel {
|
|||||||
return {
|
return {
|
||||||
entries: {
|
entries: {
|
||||||
relation: Model.HasManyRelation,
|
relation: Model.HasManyRelation,
|
||||||
modelClass: this.relationBindKnex(ItemEntry.default),
|
modelClass: ItemEntry.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'sales_invoices.id',
|
from: 'sales_invoices.id',
|
||||||
to: 'items_entries.referenceId',
|
to: 'items_entries.referenceId',
|
||||||
@@ -75,7 +75,7 @@ export default class SaleInvoice extends TenantModel {
|
|||||||
|
|
||||||
customer: {
|
customer: {
|
||||||
relation: Model.BelongsToOneRelation,
|
relation: Model.BelongsToOneRelation,
|
||||||
modelClass: this.relationBindKnex(Customer.default),
|
modelClass: Customer.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'sales_invoices.customerId',
|
from: 'sales_invoices.customerId',
|
||||||
to: 'customers.id',
|
to: 'customers.id',
|
||||||
@@ -84,7 +84,7 @@ export default class SaleInvoice extends TenantModel {
|
|||||||
|
|
||||||
transactions: {
|
transactions: {
|
||||||
relation: Model.HasManyRelation,
|
relation: Model.HasManyRelation,
|
||||||
modelClass: this.relationBindKnex(AccountTransaction.default),
|
modelClass: AccountTransaction.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'sales_invoices.id',
|
from: 'sales_invoices.id',
|
||||||
to: 'accounts_transactions.referenceId'
|
to: 'accounts_transactions.referenceId'
|
||||||
@@ -96,7 +96,7 @@ export default class SaleInvoice extends TenantModel {
|
|||||||
|
|
||||||
costTransactions: {
|
costTransactions: {
|
||||||
relation: Model.HasManyRelation,
|
relation: Model.HasManyRelation,
|
||||||
modelClass: this.relationBindKnex(InventoryCostLotTracker.default),
|
modelClass: InventoryCostLotTracker.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'sales_invoices.id',
|
from: 'sales_invoices.id',
|
||||||
to: 'inventory_cost_lot_tracker.transactionId'
|
to: 'inventory_cost_lot_tracker.transactionId'
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export default class SaleInvoiceEntry extends TenantModel {
|
|||||||
return {
|
return {
|
||||||
saleInvoice: {
|
saleInvoice: {
|
||||||
relation: Model.BelongsToOneRelation,
|
relation: Model.BelongsToOneRelation,
|
||||||
modelClass: this.relationBindKnex(SaleInvoice.default),
|
modelClass: SaleInvoice.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'sales_invoices_entries.sale_invoice_id',
|
from: 'sales_invoices_entries.sale_invoice_id',
|
||||||
to: 'sales_invoices.id',
|
to: 'sales_invoices.id',
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export default class SaleReceipt extends TenantModel {
|
|||||||
return {
|
return {
|
||||||
customer: {
|
customer: {
|
||||||
relation: Model.BelongsToOneRelation,
|
relation: Model.BelongsToOneRelation,
|
||||||
modelClass: this.relationBindKnex(Customer.default),
|
modelClass: Customer.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'sales_receipts.customerId',
|
from: 'sales_receipts.customerId',
|
||||||
to: 'customers.id',
|
to: 'customers.id',
|
||||||
@@ -37,7 +37,7 @@ export default class SaleReceipt extends TenantModel {
|
|||||||
|
|
||||||
depositAccount: {
|
depositAccount: {
|
||||||
relation: Model.BelongsToOneRelation,
|
relation: Model.BelongsToOneRelation,
|
||||||
modelClass: this.relationBindKnex(Account.default),
|
modelClass: Account.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'sales_receipts.depositAccountId',
|
from: 'sales_receipts.depositAccountId',
|
||||||
to: 'accounts.id',
|
to: 'accounts.id',
|
||||||
@@ -46,7 +46,7 @@ export default class SaleReceipt extends TenantModel {
|
|||||||
|
|
||||||
entries: {
|
entries: {
|
||||||
relation: Model.HasManyRelation,
|
relation: Model.HasManyRelation,
|
||||||
modelClass: this.relationBindKnex(ItemEntry.default),
|
modelClass: ItemEntry.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'sales_receipts.id',
|
from: 'sales_receipts.id',
|
||||||
to: 'items_entries.referenceId',
|
to: 'items_entries.referenceId',
|
||||||
@@ -58,7 +58,7 @@ export default class SaleReceipt extends TenantModel {
|
|||||||
|
|
||||||
transactions: {
|
transactions: {
|
||||||
relation: Model.HasManyRelation,
|
relation: Model.HasManyRelation,
|
||||||
modelClass: this.relationBindKnex(AccountTransaction.default),
|
modelClass: AccountTransaction.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'sales_receipts.id',
|
from: 'sales_receipts.id',
|
||||||
to: 'accounts_transactions.referenceId'
|
to: 'accounts_transactions.referenceId'
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export default class SaleReceiptEntry extends TenantModel {
|
|||||||
return {
|
return {
|
||||||
saleReceipt: {
|
saleReceipt: {
|
||||||
relation: Model.BelongsToOneRelation,
|
relation: Model.BelongsToOneRelation,
|
||||||
modelClass: this.relationBindKnex(SaleReceipt.default),
|
modelClass: SaleReceipt.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'sales_receipt_entries.sale_receipt_id',
|
from: 'sales_receipt_entries.sale_receipt_id',
|
||||||
to: 'sales_receipts.id',
|
to: 'sales_receipts.id',
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ export default class View extends TenantModel {
|
|||||||
*/
|
*/
|
||||||
columns: {
|
columns: {
|
||||||
relation: Model.HasManyRelation,
|
relation: Model.HasManyRelation,
|
||||||
modelClass: this.relationBindKnex(ViewColumn.default),
|
modelClass: ViewColumn.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'views.id',
|
from: 'views.id',
|
||||||
to: 'view_has_columns.viewId',
|
to: 'view_has_columns.viewId',
|
||||||
@@ -61,7 +61,7 @@ export default class View extends TenantModel {
|
|||||||
*/
|
*/
|
||||||
roles: {
|
roles: {
|
||||||
relation: Model.HasManyRelation,
|
relation: Model.HasManyRelation,
|
||||||
modelClass: this.relationBindKnex(ViewRole.default),
|
modelClass: ViewRole.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'views.id',
|
from: 'views.id',
|
||||||
to: 'view_roles.viewId',
|
to: 'view_roles.viewId',
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export default class ViewRole extends TenantModel {
|
|||||||
*/
|
*/
|
||||||
view: {
|
view: {
|
||||||
relation: Model.BelongsToOneRelation,
|
relation: Model.BelongsToOneRelation,
|
||||||
modelClass: this.relationBindKnex(View.default),
|
modelClass: View.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'view_roles.viewId',
|
from: 'view_roles.viewId',
|
||||||
to: 'views.id',
|
to: 'views.id',
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ export default class PlanSubscription extends mixin(SystemModel) {
|
|||||||
*/
|
*/
|
||||||
tenant: {
|
tenant: {
|
||||||
relation: Model.BelongsToOneRelation,
|
relation: Model.BelongsToOneRelation,
|
||||||
modelClass: this.relationBindKnex(Tenant.default),
|
modelClass: Tenant.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'subscription_plan_subscriptions.tenantId',
|
from: 'subscription_plan_subscriptions.tenantId',
|
||||||
to: 'tenants.id'
|
to: 'tenants.id'
|
||||||
@@ -88,7 +88,7 @@ export default class PlanSubscription extends mixin(SystemModel) {
|
|||||||
*/
|
*/
|
||||||
plan: {
|
plan: {
|
||||||
relation: Model.BelongsToOneRelation,
|
relation: Model.BelongsToOneRelation,
|
||||||
modelClass: this.relationBindKnex(Plan.default),
|
modelClass: Plan.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'subscription_plan_subscriptions.planId',
|
from: 'subscription_plan_subscriptions.planId',
|
||||||
to: 'subscription_plans.id',
|
to: 'subscription_plans.id',
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ export default class Tenant extends BaseModel {
|
|||||||
return {
|
return {
|
||||||
subscriptions: {
|
subscriptions: {
|
||||||
relation: Model.HasManyRelation,
|
relation: Model.HasManyRelation,
|
||||||
modelClass: this.relationBindKnex(PlanSubscription.default),
|
modelClass: PlanSubscription.default,
|
||||||
join: {
|
join: {
|
||||||
from: 'tenants.id',
|
from: 'tenants.id',
|
||||||
to: 'subscription_plan_subscriptions.tenantId',
|
to: 'subscription_plan_subscriptions.tenantId',
|
||||||
|
|||||||
Reference in New Issue
Block a user