refactor: warehouses to nestjs

This commit is contained in:
Ahmed Bouhuolia
2024-12-21 15:07:01 +02:00
parent cb8fd68d46
commit 8a12caf48d
29 changed files with 348 additions and 100 deletions

View File

@@ -1,29 +1,23 @@
import { Service, Inject } from 'typedi';
import { Features } from '@/interfaces';
import HasTenancyService from '@/services/Tenancy/TenancyService';
@Service()
export class BranchesSettings {
@Inject()
private tenancy: HasTenancyService;
import { Injectable } from '@nestjs/common';
@Injectable()
export class BranchesSettingsService {
/**
* Marks multi-branches as activated.
* @param {number} tenantId -
*/
public markMultiBranchesAsActivated = (tenantId: number) => {
const settings = this.tenancy.settings(tenantId);
public markMultiBranchesAsActivated = () => {
// const settings = this.tenancy.settings(tenantId);
settings.set({ group: 'features', key: Features.BRANCHES, value: 1 });
// settings.set({ group: 'features', key: Features.BRANCHES, value: 1 });
};
/**
* Retrieves whether multi-branches is active.
* @param {number} tenantId
*/
public isMultiBranchesActive = (tenantId: number) => {
const settings = this.tenancy.settings(tenantId);
public isMultiBranchesActive = () => {
// const settings = this.tenancy.settings(tenantId);
return settings.get({ group: 'features', key: Features.BRANCHES });
// return settings.get({ group: 'features', key: Features.BRANCHES });
return false;
};
}