Skip to content

Commit

Permalink
feat: return sold and available of product
Browse files Browse the repository at this point in the history
  • Loading branch information
daihiep-swe committed Aug 12, 2023
1 parent d992ba2 commit 114c54d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/batches/batches.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,12 @@ export class BatchesService {
0,
);

return available;
const sold = batches.reduce((prev, curr) => prev + curr.sold, 0);

return {
available,
sold,
};
}

async getAvailableQuantity2(branch_id: string, product_ids: string[]) {
Expand Down

0 comments on commit 114c54d

Please sign in to comment.