mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-26 09:39:49 +00:00
- Add AccountsSettingsService for managing account-related settings - Update validators, create and edit services to use settings - Add constants for account configuration - Update frontend utils and translations Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
34 lines
937 B
TypeScript
34 lines
937 B
TypeScript
import { Inject, Injectable } from '@nestjs/common';
|
|
import { SettingsStore } from '../Settings/SettingsStore';
|
|
import { SETTINGS_PROVIDER } from '../Settings/Settings.types';
|
|
|
|
export interface IAccountsSettings {
|
|
accountCodeRequired: boolean;
|
|
accountCodeUnique: boolean;
|
|
}
|
|
|
|
@Injectable()
|
|
export class AccountsSettingsService {
|
|
constructor(
|
|
@Inject(SETTINGS_PROVIDER)
|
|
private readonly settingsStore: () => SettingsStore,
|
|
) {}
|
|
|
|
/**
|
|
* Retrieves account settings (account code required, account code unique).
|
|
*/
|
|
public async getAccountsSettings(): Promise<IAccountsSettings> {
|
|
const settingsStore = await this.settingsStore();
|
|
return {
|
|
accountCodeRequired: settingsStore.get(
|
|
{ group: 'accounts', key: 'account_code_required' },
|
|
false,
|
|
),
|
|
accountCodeUnique: settingsStore.get(
|
|
{ group: 'accounts', key: 'account_code_unique' },
|
|
true,
|
|
),
|
|
};
|
|
}
|
|
}
|