FIX: Belonging Bugs

This commit is contained in:
2025-05-03 18:45:23 +03:30
parent 2e11c65b11
commit 1bcff0e73a
3 changed files with 8 additions and 8 deletions
+5 -5
View File
@@ -10,10 +10,10 @@ const belongingSchema = new mongoose.Schema(
required: true, required: true,
unique: true, unique: true,
}, },
belongingCode: { // belongingCode: {
type: Number, // type: Number,
unique: true, // unique: true,
}, // },
category: { category: {
type: ObjectID, type: ObjectID,
ref: 'Category', 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 () { belongingSchema.methods.getDocumentsSignedUrls = function () {
return getMultipleSignedUrls(this.documentUrls, 'belonging-documents') return getMultipleSignedUrls(this.documentUrls, 'belonging-documents')
+2 -2
View File
@@ -107,7 +107,7 @@ const indexAllBelongings = async () => {
const data = { const data = {
_id: belonging._id, _id: belonging._id,
isActive: belonging.isActive, isActive: belonging.isActive,
belongingCode: belonging.belongingCode, // belongingCode: belonging.belongingCode,
name: belonging.name, name: belonging.name,
category: belonging.category.englishName, category: belonging.category.englishName,
nativeCategory: belonging.category.nativeName, nativeCategory: belonging.category.nativeName,
@@ -136,7 +136,7 @@ const getTypeSenseSchema = () => {
fields: [ fields: [
{ name: '_id', type: 'string', facet: false, infix: false }, { name: '_id', type: 'string', facet: false, infix: false },
{ name: 'name', type: 'string', facet: false, infix: true }, { 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: 'category', type: 'string', facet: true, infix: true },
{ name: 'nativeCategory', type: 'string', facet: false, infix: true }, { name: 'nativeCategory', type: 'string', facet: false, infix: true },
{ name: 'description', type: 'string', facet: false }, { name: 'description', type: 'string', facet: false },
+1 -1
View File
@@ -128,7 +128,7 @@ const getBelongingInventory = async (belongingId) => {
}, },
]) ])
return { belongingCode: belonging.belongingCode, ...result[0] } return { ...result[0] }
} }
const updateTransaction = async (transactionId, data) => { const updateTransaction = async (transactionId, data) => {