feat: inventory adjustment service.

This commit is contained in:
a.bouhuolia
2021-01-09 21:56:09 +02:00
parent 30a7552b22
commit 4d9ff02b50
10 changed files with 498 additions and 1 deletions

View 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',
},
},
};
}
}

View 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',
},
},
};
}
}