mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 05:40:31 +00:00
feat: wip migrate to nestjs
This commit is contained in:
@@ -124,121 +124,121 @@ export class ItemEntry extends BaseModel {
|
||||
/**
|
||||
* Item entry relations.
|
||||
*/
|
||||
static get relationMappings() {
|
||||
const Item = require('models/Item');
|
||||
const BillLandedCostEntry = require('models/BillLandedCostEntry');
|
||||
const SaleInvoice = require('models/SaleInvoice');
|
||||
const Bill = require('models/Bill');
|
||||
const SaleReceipt = require('models/SaleReceipt');
|
||||
const SaleEstimate = require('models/SaleEstimate');
|
||||
const ProjectTask = require('models/Task');
|
||||
const Expense = require('models/Expense');
|
||||
const TaxRate = require('models/TaxRate');
|
||||
// static get relationMappings() {
|
||||
// const Item = require('models/Item');
|
||||
// const BillLandedCostEntry = require('models/BillLandedCostEntry');
|
||||
// const SaleInvoice = require('models/SaleInvoice');
|
||||
// const Bill = require('models/Bill');
|
||||
// const SaleReceipt = require('models/SaleReceipt');
|
||||
// const SaleEstimate = require('models/SaleEstimate');
|
||||
// const ProjectTask = require('models/Task');
|
||||
// const Expense = require('models/Expense');
|
||||
// const TaxRate = require('models/TaxRate');
|
||||
|
||||
return {
|
||||
item: {
|
||||
relation: Model.BelongsToOneRelation,
|
||||
modelClass: Item.default,
|
||||
join: {
|
||||
from: 'items_entries.itemId',
|
||||
to: 'items.id',
|
||||
},
|
||||
},
|
||||
allocatedCostEntries: {
|
||||
relation: Model.HasManyRelation,
|
||||
modelClass: BillLandedCostEntry.default,
|
||||
join: {
|
||||
from: 'items_entries.referenceId',
|
||||
to: 'bill_located_cost_entries.entryId',
|
||||
},
|
||||
},
|
||||
// return {
|
||||
// item: {
|
||||
// relation: Model.BelongsToOneRelation,
|
||||
// modelClass: Item.default,
|
||||
// join: {
|
||||
// from: 'items_entries.itemId',
|
||||
// to: 'items.id',
|
||||
// },
|
||||
// },
|
||||
// allocatedCostEntries: {
|
||||
// relation: Model.HasManyRelation,
|
||||
// modelClass: BillLandedCostEntry.default,
|
||||
// join: {
|
||||
// from: 'items_entries.referenceId',
|
||||
// to: 'bill_located_cost_entries.entryId',
|
||||
// },
|
||||
// },
|
||||
|
||||
invoice: {
|
||||
relation: Model.BelongsToOneRelation,
|
||||
modelClass: SaleInvoice.default,
|
||||
join: {
|
||||
from: 'items_entries.referenceId',
|
||||
to: 'sales_invoices.id',
|
||||
},
|
||||
},
|
||||
// invoice: {
|
||||
// relation: Model.BelongsToOneRelation,
|
||||
// modelClass: SaleInvoice.default,
|
||||
// join: {
|
||||
// from: 'items_entries.referenceId',
|
||||
// to: 'sales_invoices.id',
|
||||
// },
|
||||
// },
|
||||
|
||||
bill: {
|
||||
relation: Model.BelongsToOneRelation,
|
||||
modelClass: Bill.default,
|
||||
join: {
|
||||
from: 'items_entries.referenceId',
|
||||
to: 'bills.id',
|
||||
},
|
||||
},
|
||||
// bill: {
|
||||
// relation: Model.BelongsToOneRelation,
|
||||
// modelClass: Bill.default,
|
||||
// join: {
|
||||
// from: 'items_entries.referenceId',
|
||||
// to: 'bills.id',
|
||||
// },
|
||||
// },
|
||||
|
||||
estimate: {
|
||||
relation: Model.BelongsToOneRelation,
|
||||
modelClass: SaleEstimate.default,
|
||||
join: {
|
||||
from: 'items_entries.referenceId',
|
||||
to: 'sales_estimates.id',
|
||||
},
|
||||
},
|
||||
// estimate: {
|
||||
// relation: Model.BelongsToOneRelation,
|
||||
// modelClass: SaleEstimate.default,
|
||||
// join: {
|
||||
// from: 'items_entries.referenceId',
|
||||
// to: 'sales_estimates.id',
|
||||
// },
|
||||
// },
|
||||
|
||||
/**
|
||||
* Sale receipt reference.
|
||||
*/
|
||||
receipt: {
|
||||
relation: Model.BelongsToOneRelation,
|
||||
modelClass: SaleReceipt.default,
|
||||
join: {
|
||||
from: 'items_entries.referenceId',
|
||||
to: 'sales_receipts.id',
|
||||
},
|
||||
},
|
||||
// /**
|
||||
// * Sale receipt reference.
|
||||
// */
|
||||
// receipt: {
|
||||
// relation: Model.BelongsToOneRelation,
|
||||
// modelClass: SaleReceipt.default,
|
||||
// join: {
|
||||
// from: 'items_entries.referenceId',
|
||||
// to: 'sales_receipts.id',
|
||||
// },
|
||||
// },
|
||||
|
||||
/**
|
||||
* Project task reference.
|
||||
*/
|
||||
projectTaskRef: {
|
||||
relation: Model.HasManyRelation,
|
||||
modelClass: ProjectTask.default,
|
||||
join: {
|
||||
from: 'items_entries.projectRefId',
|
||||
to: 'tasks.id',
|
||||
},
|
||||
},
|
||||
// /**
|
||||
// * Project task reference.
|
||||
// */
|
||||
// projectTaskRef: {
|
||||
// relation: Model.HasManyRelation,
|
||||
// modelClass: ProjectTask.default,
|
||||
// join: {
|
||||
// from: 'items_entries.projectRefId',
|
||||
// to: 'tasks.id',
|
||||
// },
|
||||
// },
|
||||
|
||||
/**
|
||||
* Project expense reference.
|
||||
*/
|
||||
projectExpenseRef: {
|
||||
relation: Model.HasManyRelation,
|
||||
modelClass: Expense.default,
|
||||
join: {
|
||||
from: 'items_entries.projectRefId',
|
||||
to: 'expenses_transactions.id',
|
||||
},
|
||||
},
|
||||
// /**
|
||||
// * Project expense reference.
|
||||
// */
|
||||
// projectExpenseRef: {
|
||||
// relation: Model.HasManyRelation,
|
||||
// modelClass: Expense.default,
|
||||
// join: {
|
||||
// from: 'items_entries.projectRefId',
|
||||
// to: 'expenses_transactions.id',
|
||||
// },
|
||||
// },
|
||||
|
||||
/**
|
||||
* Project bill reference.
|
||||
*/
|
||||
projectBillRef: {
|
||||
relation: Model.HasManyRelation,
|
||||
modelClass: Bill.default,
|
||||
join: {
|
||||
from: 'items_entries.projectRefId',
|
||||
to: 'bills.id',
|
||||
},
|
||||
},
|
||||
// /**
|
||||
// * Project bill reference.
|
||||
// */
|
||||
// projectBillRef: {
|
||||
// relation: Model.HasManyRelation,
|
||||
// modelClass: Bill.default,
|
||||
// join: {
|
||||
// from: 'items_entries.projectRefId',
|
||||
// to: 'bills.id',
|
||||
// },
|
||||
// },
|
||||
|
||||
/**
|
||||
* Tax rate reference.
|
||||
*/
|
||||
tax: {
|
||||
relation: Model.HasOneRelation,
|
||||
modelClass: TaxRate.default,
|
||||
join: {
|
||||
from: 'items_entries.taxRateId',
|
||||
to: 'tax_rates.id',
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
// /**
|
||||
// * Tax rate reference.
|
||||
// */
|
||||
// tax: {
|
||||
// relation: Model.HasOneRelation,
|
||||
// modelClass: TaxRate.default,
|
||||
// join: {
|
||||
// from: 'items_entries.taxRateId',
|
||||
// to: 'tax_rates.id',
|
||||
// },
|
||||
// },
|
||||
// };
|
||||
// }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user