Skip to content

Commit

Permalink
feat: update bookmark
Browse files Browse the repository at this point in the history
  • Loading branch information
BabakScript committed Jul 11, 2021
1 parent c239031 commit 53d2fb5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/bookmarks/bookmarks.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
Delete,
Get,
Param,
Patch,
Post,
Query,
} from '@nestjs/common';
Expand Down Expand Up @@ -39,4 +40,12 @@ export class BookmarksController {
deleteBookmark(@Param('id') id: string): void {
return this.bookmarksService.deleteBookmark(id);
}

@Patch('/:id/description')
updateBookmarkDescription(
@Param('id') id: string,
@Body('description') description: string,
): Bookmark {
return this.bookmarksService.updateBookmarkDescription(id, description);
}
}
6 changes: 6 additions & 0 deletions src/bookmarks/bookmarks.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,10 @@ export class BookmarksService {
deleteBookmark(id: string): void {
this.bookmarks = this.bookmarks.filter((bookmark) => bookmark.id !== id);
}

updateBookmarkDescription(id: string, description: string): Bookmark {
const bookmark = this.findById(id);
bookmark.description = description;
return bookmark;
}
}

0 comments on commit 53d2fb5

Please sign in to comment.