Skip to content

Commit

Permalink
fix(blogs): fix the getAllBlogs method and add robust test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
sage-ali committed Mar 2, 2025
1 parent 29df060 commit 5088a03
Show file tree
Hide file tree
Showing 2 changed files with 386 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/modules/blogs/blogs.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,12 @@ export class BlogService {
...result.data,
blogs: includeDeleted
? result.data.blogs
: result.data.blogs.map(blog => {
const { deletedAt, ...rest } = blog;
return rest;
}),
: result.data.blogs
.filter(blog => !blog.deletedAt)
.map(blog => {
const { deletedAt, ...rest } = blog;
return rest;
}),
},
};
}
Expand Down
Loading

0 comments on commit 5088a03

Please sign in to comment.