mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 21:30:31 +00:00
feat: Schedule to compute items cost.
This commit is contained in:
@@ -4,13 +4,14 @@ import InventoryService from '@/services/Inventory/Inventory';
|
||||
export default class ComputeItemCostJob {
|
||||
public async handler(job, done: Function): Promise<void> {
|
||||
const Logger = Container.get('logger');
|
||||
const { startingDate, itemId, costMethod } = job.attrs.data;
|
||||
const { startingDate, itemId, costMethod = 'FIFO' } = job.attrs.data;
|
||||
|
||||
try {
|
||||
await InventoryService.computeItemCost(startingDate, itemId, costMethod);
|
||||
Logger.log(`Compute item cost: ${job.attrs.data}`);
|
||||
done();
|
||||
} catch(e) {
|
||||
console.log(e);
|
||||
Logger.error(`Compute item cost: ${job.attrs.data}, error: ${e}`);
|
||||
done(e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user