feat: add HelpText model, service, and controller for dynamic help text management
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user