From debd1b773d61513c4b80689d3c4002bf463ab26d Mon Sep 17 00:00:00 2001 From: Innei Date: Mon, 25 Apr 2022 13:11:00 +0800 Subject: [PATCH] fix: slug validate --- src/modules/post/post.service.ts | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/modules/post/post.service.ts b/src/modules/post/post.service.ts index b1cabec6..9440dc2f 100644 --- a/src/modules/post/post.service.ts +++ b/src/modules/post/post.service.ts @@ -114,11 +114,6 @@ export class PostService { if (data.slug) { data.slug = slugify(data.slug) - const validSlug = await this.isAvailableSlug(data.slug) - - if (!validSlug) { - throw new BusinessException(ErrorCodeEnum.SlugNotAvailable) - } } const updated = await this.postModel.findOneAndUpdate( @@ -165,10 +160,6 @@ export class PostService { } async isAvailableSlug(slug: string) { - if (slug.includes('/')) { - return false - } - return (await this.postModel.countDocuments({ slug })) === 0 } }