new procurement

This commit is contained in:
2025-10-23 09:49:04 +03:00
parent 99127c42e2
commit a6065dd95c
22 changed files with 1588 additions and 409 deletions

View File

@@ -1,4 +1,4 @@
const mongoose = require('mongoose')
const mongoose = require('mongoose');
const companySchema = new mongoose.Schema({
fullName: {
@@ -8,7 +8,6 @@ const companySchema = new mongoose.Schema({
shortName: String,
inn: {
type: String,
unique: true,
sparse: true
},
ogrn: String,
@@ -46,6 +45,10 @@ const companySchema = new mongoose.Schema({
productsNeeded: String,
partnerIndustries: [String],
partnerGeography: [String],
verified: {
type: Boolean,
default: false
},
createdAt: {
type: Date,
default: Date.now
@@ -54,11 +57,14 @@ const companySchema = new mongoose.Schema({
type: Date,
default: Date.now
}
})
}, {
collection: 'companies',
minimize: false
});
// Индексы для поиска
companySchema.index({ fullName: 'text', shortName: 'text', description: 'text' })
companySchema.index({ industry: 1 })
companySchema.index({ rating: -1 })
companySchema.index({ fullName: 'text', shortName: 'text', description: 'text' });
companySchema.index({ industry: 1 });
companySchema.index({ rating: -1 });
module.exports = mongoose.model('Company', companySchema)
module.exports = mongoose.model('Company', companySchema);