mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 12:50:38 +00:00
feat: rewrite repositories with base entity repository class.
feat: sales and purchases status. feat: sales and purchases auto-increment number. fix: settings find query with extra columns.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { Request, Response, NextFunction } from 'express';
|
||||
import { Container } from 'typedi';
|
||||
import SettingsStore from 'services/Settings/SettingsStore';
|
||||
|
||||
|
||||
export default async (req: Request, res: Response, next: NextFunction) => {
|
||||
const { tenantId } = req.user;
|
||||
const { knex } = req;
|
||||
@@ -10,16 +10,19 @@ export default async (req: Request, res: Response, next: NextFunction) => {
|
||||
const tenantContainer = Container.of(`tenant-${tenantId}`);
|
||||
|
||||
if (tenantContainer && !tenantContainer.has('settings')) {
|
||||
const { settingRepository } = tenantContainer.get('repositories');
|
||||
|
||||
Logger.info('[settings_middleware] initialize settings store.');
|
||||
const settings = new SettingsStore(knex);
|
||||
|
||||
Logger.info('[settings_middleware] load settings from storage or cache.');
|
||||
await settings.load();
|
||||
|
||||
const settings = new SettingsStore(settingRepository);
|
||||
tenantContainer.set('settings', settings);
|
||||
}
|
||||
Logger.info('[settings_middleware] get settings instance from container.');
|
||||
const settings = tenantContainer.get('settings');
|
||||
|
||||
Logger.info('[settings_middleware] load settings from storage or cache.');
|
||||
await settings.load();
|
||||
|
||||
req.settings = settings;
|
||||
|
||||
res.on('finish', async () => {
|
||||
|
||||
Reference in New Issue
Block a user