update : category update

This commit is contained in:
morteza-mortezai
2025-10-28 12:11:37 +03:30
parent afadc8179d
commit 640ad6e91c
+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 });