All files / src/global-config global-config.controller.ts

100% Statements 12/12
100% Branches 0/0
100% Functions 3/3
100% Lines 10/10

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 467x 7x 7x 7x                             7x 10x                 7x 2x                   7x     2x      
import { Controller, Get, Put, Body } from '@nestjs/common';
import { ApiTags, ApiOperation, ApiResponse } from '@nestjs/swagger';
import { GlobalConfigService, GlobalConfig } from './global-config.service';
import { UpdateGlobalConfigDto } from './dto/update-global-config.dto';
 
/**
 * Global configuration provides application-wide settings.
 *
 * This is a single configuration object that stores:
 * - LLM provider settings (API keys, model preferences)
 * - Default execution strategies
 * - Feature flags
 *
 * Changes here affect all sessions and projects.
 * For project-specific overrides, use application-state overrides.
 */
@ApiTags('global-config')
@Controller('global-config')
export class GlobalConfigController {
  constructor(private readonly globalConfigService: GlobalConfigService) {}
 
  @Get()
  @ApiOperation({
    summary: 'Get global configuration',
    description:
      'Returns the current global configuration object with all settings.',
  })
  @ApiResponse({ status: 200, description: 'Global configuration object' })
  getConfig(): GlobalConfig {
    return this.globalConfigService.getConfig();
  }
 
  @Put()
  @ApiOperation({
    summary: 'Update global configuration',
    description:
      'Update the global configuration. Changes affect all new sessions.',
  })
  @ApiResponse({ status: 200, description: 'Updated configuration' })
  async updateConfig(
    @Body() updateDto: UpdateGlobalConfigDto,
  ): Promise<GlobalConfig> {
    return this.globalConfigService.updateConfig(updateDto);
  }
}