mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 12:50:38 +00:00
refactoring: custom views service.
fix: constraints of delete item from storage. fix: constraints of delete item category from storage. fix: localize database seeds files. fix: view meta data in accounts list response.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Router, Request, Response } from 'express';
|
||||
import { Router, Request, Response, NextFunction } from 'express';
|
||||
import { check, param, query, matchedData } from 'express-validator';
|
||||
import { difference } from 'lodash';
|
||||
import { raw } from 'objection';
|
||||
@@ -7,7 +7,8 @@ import BaseController from '../BaseController';
|
||||
import asyncMiddleware from 'api/middleware/asyncMiddleware';
|
||||
import SaleInvoiceService from 'services/Sales/SalesInvoices';
|
||||
import ItemsService from 'services/Items/ItemsService';
|
||||
import { ISaleInvoiceOTD } from 'interfaces';
|
||||
import DynamicListingService from 'services/DynamicListing/DynamicListService';
|
||||
import { ISaleInvoiceOTD, ISalesInvoicesFilter } from 'interfaces';
|
||||
|
||||
@Service()
|
||||
export default class SaleInvoicesController extends BaseController{
|
||||
@@ -17,6 +18,9 @@ export default class SaleInvoicesController extends BaseController{
|
||||
@Inject()
|
||||
saleInvoiceService: SaleInvoiceService;
|
||||
|
||||
@Inject()
|
||||
dynamicListService: DynamicListingService;
|
||||
|
||||
/**
|
||||
* Router constructor.
|
||||
*/
|
||||
@@ -412,7 +416,21 @@ export default class SaleInvoicesController extends BaseController{
|
||||
* @param {Response} res
|
||||
* @param {Function} next
|
||||
*/
|
||||
async getSalesInvoices(req, res) {
|
||||
|
||||
public async getSalesInvoices(req: Request, res: Response, next: NextFunction) {
|
||||
const { tenantId } = req.params;
|
||||
const salesInvoicesFilter: ISalesInvoicesFilter = req.query;
|
||||
|
||||
try {
|
||||
const { salesInvoices, filterMeta, pagination } = await this.saleInvoiceService.salesInvoicesList(
|
||||
tenantId, salesInvoicesFilter,
|
||||
);
|
||||
return res.status(200).send({
|
||||
sales_invoices: salesInvoices,
|
||||
pagination: this.transfromToResponse(pagination),
|
||||
filter_meta: this.transfromToResponse(filterMeta),
|
||||
});
|
||||
} catch (error) {
|
||||
next(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user