Files
recipe-app/backend/src/help-texts/help-texts.controller.ts
T
Nils-Johan Gynther 3d9b124766
Test Suite / backend-pr-quick (push) Has been skipped
Test Suite / quick-import-pr-quick (push) Has been skipped
Test Suite / backend-full (push) Successful in 2m27s
Test Suite / flutter-quality (push) Successful in 1m47s
feat: add HelpText model, service, and controller for dynamic help text management
2026-05-13 16:20:04 +02:00

29 lines
886 B
TypeScript

import { Body, Controller, Get, Param, Put } from '@nestjs/common';
import { CurrentUser } from '../auth/decorators/current-user.decorator';
import { Roles } from '../auth/decorators/roles.decorator';
import { UpsertHelpTextDto } from './dto/upsert-help-text.dto';
import { HelpTextsService } from './help-texts.service';
@Controller('help-texts')
export class HelpTextsController {
constructor(private readonly helpTextsService: HelpTextsService) {}
@Get(':key')
getByKey(
@Param('key') key: string,
@CurrentUser() user: { role?: string },
) {
return this.helpTextsService.getResolvedByKey(key, user?.role);
}
@Roles('admin')
@Put(':key/:scope')
upsert(
@Param('key') key: string,
@Param('scope') scope: string,
@Body() dto: UpsertHelpTextDto,
) {
return this.helpTextsService.upsert(key, scope, dto);
}
}