mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 22:01:09 +02:00
- Project detail page (/projects/[id]): stats, budget progress, inline edit, full entry list with billing value calculation - Client detail page (/clients/[id]): stats, project cards, entry list, billing value summary - Duration rounding: configurable increment (1-15 min) and method (up/down/nearest), applied automatically when timer stops - ConfirmDialog component: reusable modal for destructive actions - Confirmation required before deleting entries, projects, and clients - 18 new rounding tests (67 total, all passing) - i18n: added deleteConfirm keys for DE and EN Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
83 lines
1.9 KiB
TypeScript
83 lines
1.9 KiB
TypeScript
import { DynamicModule, Module, Global, Provider } from '@nestjs/common';
|
|
import {
|
|
ManaCoreModuleOptions,
|
|
ManaCoreModuleAsyncOptions,
|
|
ManaCoreOptionsFactory,
|
|
} from './interfaces/mana-core-options.interface';
|
|
import { AuthGuard } from './guards/auth.guard';
|
|
import { CreditClientService } from './services/credit-client.service';
|
|
|
|
export const MANA_CORE_OPTIONS = 'MANA_CORE_OPTIONS';
|
|
|
|
@Global()
|
|
@Module({})
|
|
export class ManaCoreModule {
|
|
static forRoot(options: ManaCoreModuleOptions): DynamicModule {
|
|
return {
|
|
module: ManaCoreModule,
|
|
providers: [
|
|
{
|
|
provide: MANA_CORE_OPTIONS,
|
|
useValue: options,
|
|
},
|
|
AuthGuard,
|
|
CreditClientService,
|
|
],
|
|
exports: [MANA_CORE_OPTIONS, AuthGuard, CreditClientService],
|
|
};
|
|
}
|
|
|
|
static forRootAsync(options: ManaCoreModuleAsyncOptions): DynamicModule {
|
|
const asyncProviders = this.createAsyncProviders(options);
|
|
|
|
return {
|
|
module: ManaCoreModule,
|
|
imports: options.imports || [],
|
|
providers: [...asyncProviders, AuthGuard, CreditClientService],
|
|
exports: [MANA_CORE_OPTIONS, AuthGuard, CreditClientService],
|
|
};
|
|
}
|
|
|
|
private static createAsyncProviders(options: ManaCoreModuleAsyncOptions): Provider[] {
|
|
if (options.useFactory) {
|
|
return [
|
|
{
|
|
provide: MANA_CORE_OPTIONS,
|
|
useFactory: options.useFactory,
|
|
inject: options.inject || [],
|
|
},
|
|
];
|
|
}
|
|
|
|
const useClass = options.useClass;
|
|
const useExisting = options.useExisting;
|
|
|
|
if (useClass) {
|
|
return [
|
|
{
|
|
provide: MANA_CORE_OPTIONS,
|
|
useFactory: async (optionsFactory: ManaCoreOptionsFactory) =>
|
|
await optionsFactory.createManaCoreOptions(),
|
|
inject: [useClass],
|
|
},
|
|
{
|
|
provide: useClass,
|
|
useClass,
|
|
},
|
|
];
|
|
}
|
|
|
|
if (useExisting) {
|
|
return [
|
|
{
|
|
provide: MANA_CORE_OPTIONS,
|
|
useFactory: async (optionsFactory: ManaCoreOptionsFactory) =>
|
|
await optionsFactory.createManaCoreOptions(),
|
|
inject: [useExisting],
|
|
},
|
|
];
|
|
}
|
|
|
|
return [];
|
|
}
|
|
}
|