22 lines
856 B
TypeScript
22 lines
856 B
TypeScript
import { Controller, Get } from '@nestjs/common';
|
|
import { ApiOperation, ApiTags } from '@nestjs/swagger';
|
|
import { map } from 'rxjs';
|
|
import { CoreGrpcService } from '../core-grpc.service';
|
|
|
|
@ApiTags('Публичные настройки')
|
|
@Controller('settings')
|
|
export class PublicSettingsController {
|
|
constructor(private readonly core: CoreGrpcService) {}
|
|
|
|
@Get('public')
|
|
@ApiOperation({ summary: 'Публичные настройки', description: 'Возвращает несекретные настройки для интерфейса без авторизации.' })
|
|
listPublic() {
|
|
return this.core.settings.ListPublicSettings({}).pipe(
|
|
map((response) => {
|
|
const payload = response as { settings?: Array<{ key: string; value: string }> };
|
|
return { settings: payload.settings ?? [] };
|
|
})
|
|
);
|
|
}
|
|
}
|