Skip to content

Commit

Permalink
fix(api): return nothing in put or patch method
Browse files Browse the repository at this point in the history
  • Loading branch information
wibus-wee committed Jul 26, 2022
1 parent 0cf2b28 commit 83eb628
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/modules/category/category.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ export class CategoryController {
// 合并分类
await this.categoryService.mergeCategory(from, to);
}
return { message: "success" };
}

@Put("/:id")
Expand All @@ -200,7 +201,7 @@ export class CategoryController {
async patch(@Param() params: MongoIdDto, @Body() body: PartialCategoryModel) {
const { id } = params;
await this.categoryService.model.updateOne({ _id: id }, body);
return;
return await this.categoryService.model.findById(id);
}

@Delete("/:id")
Expand Down
4 changes: 1 addition & 3 deletions src/modules/comment/comment.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,14 +263,12 @@ export class CommentController {
}

try {
await this.commentService.model.updateOne(
return await this.commentService.model.updateOne(
{
_id: id,
},
updateResult
);

return;
} catch {
throw new CannotFindException();
}
Expand Down
2 changes: 1 addition & 1 deletion src/modules/page/page.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export class PageController {
// body.text = await this.pluginService.usePlugins('page', 'update', body.text)
await this.pageService.updateById(id, body);

return;
return await this.pageService.model.findById(id).lean();
}

@Delete("/:id")
Expand Down

0 comments on commit 83eb628

Please sign in to comment.