This commit is contained in:
@@ -20,7 +20,7 @@ class CategoryRepository extends BaseRepository<ICategory> {
|
|||||||
super(CategoryModel);
|
super(CategoryModel);
|
||||||
}
|
}
|
||||||
async findByTitle(title_en: string, id?: string) {
|
async findByTitle(title_en: string, id?: string) {
|
||||||
const query: Record<string, any> = { title_en };
|
const query: Record<string, any> = { title_en, deleted: false };
|
||||||
|
|
||||||
if (id) {
|
if (id) {
|
||||||
query._id = { $ne: id };
|
query._id = { $ne: id };
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { ICategory } from "./Abstraction/ICategory";
|
|||||||
const categorySchema = new Schema<ICategory>(
|
const categorySchema = new Schema<ICategory>(
|
||||||
{
|
{
|
||||||
title_fa: { type: String, required: true },
|
title_fa: { type: String, required: true },
|
||||||
title_en: { type: String, unique: true, required: true },
|
title_en: { type: String, false: true, required: true },
|
||||||
icon: { type: String, default: "/images/icons/default.png" },
|
icon: { type: String, default: "/images/icons/default.png" },
|
||||||
imageUrl: { type: String, required: true },
|
imageUrl: { type: String, required: true },
|
||||||
description: { type: String, required: true },
|
description: { type: String, required: true },
|
||||||
|
|||||||
Reference in New Issue
Block a user