ADD: API_URL to env

ADD: DocumentUrls and mainImageUrls field in belonging model
FIX: Indexing bugs for belonging
ADD: getImage endpoint to get private images
ADD: PrivateUrl field as virtual
FIX: Minor bug in bucketDeleteFile service
ADD: Word type to multer file checker
This commit is contained in:
2025-04-27 16:17:17 +03:30
parent d7d2d98b6d
commit 4fc323cd16
8 changed files with 100 additions and 29 deletions
+4 -10
View File
@@ -35,10 +35,8 @@ const belongingSchema = new mongoose.Schema(
required: false,
},
},
documentNames: [String],
imageNames: [String],
mainImageNames: [String],
mainImageUrl: String,
documentUrls: [String],
mainImageUrls: [String],
tags: [String],
isActive: {
type: Boolean,
@@ -66,15 +64,11 @@ const belongingSchema = new mongoose.Schema(
belongingSchema.plugin(AutoIncrement, { inc_field: 'belongingCode' })
belongingSchema.methods.getDocumentsSignedUrls = function () {
return getMultipleSignedUrls(this.documentNames, 'belonging-documents')
}
belongingSchema.methods.getImagesSignedUrls = function () {
return getMultipleSignedUrls(this.imageNames, 'belonging-images')
return getMultipleSignedUrls(this.documentUrls, 'belonging-documents')
}
belongingSchema.methods.getMainImagedSignedUrl = function () {
return getMultipleSignedUrls(this.mainImageNames, 'belonging-images')
return getMultipleSignedUrls(this.mainImageUrls, 'belonging-images')
}
belongingSchema.index({ location: '2dsphere' }) // Enable geospatial queries