fix: check slug length

Signed-off-by: Innei <i@innei.in>
This commit is contained in:
Innei
2024-05-31 11:44:08 +08:00
parent 65953710a9
commit 6a5826248c

View File

@@ -344,7 +344,9 @@ export class PostService {
}
async isAvailableSlug(slug: string) {
return (await this.postModel.countDocuments({ slug })) === 0
return (
slug.length > 0 && (await this.postModel.countDocuments({ slug })) === 0
)
}
async checkRelated<