update : category update
This commit is contained in:
@@ -64,7 +64,7 @@ class BlogService {
|
||||
|
||||
if (updateDto.slug) {
|
||||
updateDto.slug = slugify(updateDto.slug);
|
||||
const existTitle = await this.blogCategoryRepo.findBySlug(updateDto.slug);
|
||||
const existTitle = await this.blogCategoryRepo.model.findOne({ slug: updateDto.slug, _id: { $ne: catId } });
|
||||
if (existTitle) throw new BadRequestError(CategoryMessage.DuplicateSlug);
|
||||
}
|
||||
const UpdatedCategory = await this.blogCategoryRepo.model.findByIdAndUpdate(catId, updateDto, { new: true });
|
||||
|
||||
Reference in New Issue
Block a user