Merge pull request #29 from Danakcorp/mrtz

update : category update
This commit is contained in:
morteza-mortezai
2025-10-28 12:13:23 +03:30
committed by GitHub
+1 -1
View File
@@ -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 });