mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 23:00:34 +00:00
feat(nestjs): migrate to NestJS
This commit is contained in:
32
packages/server/src/modules/Warehouses/WarehousesSettings.ts
Normal file
32
packages/server/src/modules/Warehouses/WarehousesSettings.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import { SettingsStore } from '../Settings/SettingsStore';
|
||||
import { SETTINGS_PROVIDER } from '../Settings/Settings.types';
|
||||
import { Features } from '@/common/types/Features';
|
||||
|
||||
@Injectable()
|
||||
export class WarehousesSettings {
|
||||
constructor(
|
||||
@Inject(SETTINGS_PROVIDER)
|
||||
private readonly settingsStore: () => SettingsStore,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Marks multi-warehouses as activated.
|
||||
*/
|
||||
public markMutliwarehoussAsActivated = async () => {
|
||||
const settings = await this.settingsStore();
|
||||
|
||||
settings.set({ group: 'features', key: Features.WAREHOUSES, value: 1 });
|
||||
};
|
||||
|
||||
/**
|
||||
* Determines multi-warehouses is active.
|
||||
* @param {number} tenantId
|
||||
* @returns {boolean}
|
||||
*/
|
||||
public isMultiWarehousesActive = async () => {
|
||||
const settings = await this.settingsStore();
|
||||
|
||||
return settings.get({ group: 'features', key: Features.WAREHOUSES });
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user