【发布时间】:2020-09-29 01:00:51
【问题描述】:
对不起,我是 NestJs 的新手,我正在使用来自 github 的示例应用程序:
https://github.com/lujakob/nestjs-realworld-example-app
我的问题是关于如何正式对有权修改特定文章的用户进行验证。通常,这部分代码应该有一个验证:
@ApiOperation({ summary: 'Update article' })
@ApiResponse({ status: 201, description: 'The article has been successfully updated.'})
@ApiResponse({ status: 403, description: 'Forbidden.' })
@put(':slug')
async update(@param() params, @Body('article') articleData: CreateArticleDto) {
// Todo: update slug also when title gets changed
return this.articleService.update(params.slug, articleData);
}
所以不是每个人都可以修改别人的文章。
谢谢,
【问题讨论】:
标签: javascript typescript express nestjs