From 1bcff0e73a22e4eb8155b18dc1724068918bb75e Mon Sep 17 00:00:00 2001 From: Kaveh Hajinajaf Date: Sat, 3 May 2025 18:45:23 +0330 Subject: [PATCH] FIX: Belonging Bugs --- components/belonging/belongingModel.js | 10 +++++----- components/belonging/belongingService.js | 4 ++-- components/transaction/transactionService.js | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/components/belonging/belongingModel.js b/components/belonging/belongingModel.js index 36a11f1..2f51317 100644 --- a/components/belonging/belongingModel.js +++ b/components/belonging/belongingModel.js @@ -10,10 +10,10 @@ const belongingSchema = new mongoose.Schema( required: true, unique: true, }, - belongingCode: { - type: Number, - unique: true, - }, + // belongingCode: { + // type: Number, + // unique: true, + // }, category: { type: ObjectID, ref: 'Category', @@ -61,7 +61,7 @@ const belongingSchema = new mongoose.Schema( } ) -belongingSchema.plugin(AutoIncrement, { inc_field: 'belongingCode' }) +// belongingSchema.plugin(AutoIncrement, { inc_field: 'belongingCode' }) belongingSchema.methods.getDocumentsSignedUrls = function () { return getMultipleSignedUrls(this.documentUrls, 'belonging-documents') diff --git a/components/belonging/belongingService.js b/components/belonging/belongingService.js index 64368d8..6fb3051 100644 --- a/components/belonging/belongingService.js +++ b/components/belonging/belongingService.js @@ -107,7 +107,7 @@ const indexAllBelongings = async () => { const data = { _id: belonging._id, isActive: belonging.isActive, - belongingCode: belonging.belongingCode, + // belongingCode: belonging.belongingCode, name: belonging.name, category: belonging.category.englishName, nativeCategory: belonging.category.nativeName, @@ -136,7 +136,7 @@ const getTypeSenseSchema = () => { fields: [ { name: '_id', type: 'string', facet: false, infix: false }, { name: 'name', type: 'string', facet: false, infix: true }, - { name: 'belongingCode', type: 'int64', facet: false }, + // { name: 'belongingCode', type: 'int64', facet: false }, { name: 'category', type: 'string', facet: true, infix: true }, { name: 'nativeCategory', type: 'string', facet: false, infix: true }, { name: 'description', type: 'string', facet: false }, diff --git a/components/transaction/transactionService.js b/components/transaction/transactionService.js index ec5eae6..8db3d45 100644 --- a/components/transaction/transactionService.js +++ b/components/transaction/transactionService.js @@ -128,7 +128,7 @@ const getBelongingInventory = async (belongingId) => { }, ]) - return { belongingCode: belonging.belongingCode, ...result[0] } + return { ...result[0] } } const updateTransaction = async (transactionId, data) => {