mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 12:50:38 +00:00
feat: inventory adjustment service.
This commit is contained in:
29
server/src/models/InventoryAdjustment.js
Normal file
29
server/src/models/InventoryAdjustment.js
Normal file
@@ -0,0 +1,29 @@
|
||||
import { Model } from 'objection';
|
||||
import TenantModel from 'models/TenantModel';
|
||||
|
||||
export default class InventoryAdjustment extends TenantModel {
|
||||
/**
|
||||
* Table name
|
||||
*/
|
||||
static get tableName() {
|
||||
return 'inventory_adjustments';
|
||||
}
|
||||
|
||||
/**
|
||||
* Relationship mapping.
|
||||
*/
|
||||
static get relationMappings() {
|
||||
const Account = require('models/InventoryAdjustmentEntry');
|
||||
|
||||
return {
|
||||
entries: {
|
||||
relation: Model.BelongsToOneRelation,
|
||||
modelClass: Account.default,
|
||||
join: {
|
||||
from: 'inventory_adjustments.id',
|
||||
to: 'inventory_adjustments_entries.adjustmentId',
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
29
server/src/models/InventoryAdjustmentEntry.js
Normal file
29
server/src/models/InventoryAdjustmentEntry.js
Normal file
@@ -0,0 +1,29 @@
|
||||
import { Model } from 'objection';
|
||||
import TenantModel from 'models/TenantModel';
|
||||
|
||||
export default class InventoryAdjustmentEntry extends TenantModel {
|
||||
/**
|
||||
* Table name
|
||||
*/
|
||||
static get tableName() {
|
||||
return 'inventory_adjustments_entries';
|
||||
}
|
||||
|
||||
/**
|
||||
* Relationship mapping.
|
||||
*/
|
||||
static get relationMappings() {
|
||||
const Account = require('models/InventoryAdjustment');
|
||||
|
||||
return {
|
||||
entries: {
|
||||
relation: Model.BelongsToOneRelation,
|
||||
modelClass: Account.default,
|
||||
join: {
|
||||
from: 'inventory_adjustments_entries.adjustmentId',
|
||||
to: 'inventory_adjustments.id',
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user