full app
This commit is contained in:
24
models/AdPricingRuleModel.js
Normal file
24
models/AdPricingRuleModel.js
Normal file
@@ -0,0 +1,24 @@
|
||||
const mongoose = require('mongoose')
|
||||
const timestamp = require('mongoose-timestamp')
|
||||
|
||||
// قانونِ قیمتگذاریِ ادمین برای یه «سناریو»ی تبلیغ — هر فیلدِ null یعنی وایلدکارت
|
||||
// (روی هر مقداری از اون بعد صدق میکنه)؛ utils/adPricing.js دقیقترین قانونِ منطبق
|
||||
// (بیشترین فیلدِ غیرِnull) رو انتخاب میکنه
|
||||
const adPricingRuleSchema = new mongoose.Schema({
|
||||
ad_type: {
|
||||
type: String,
|
||||
enum: ['first_post', 'first_story', 'notification', 'project', 'product', 'shop', 'billboard'],
|
||||
required: true
|
||||
},
|
||||
province_id: { type: Number, default: null },
|
||||
gender: { type: String, enum: ['female', 'male'], default: null },
|
||||
expertise: { type: String, trim: true, default: null },
|
||||
sub_expertise: { type: String, trim: true, default: null },
|
||||
price: { type: Number, required: true }
|
||||
})
|
||||
|
||||
adPricingRuleSchema.index({ ad_type: 1 })
|
||||
|
||||
adPricingRuleSchema.plugin(timestamp)
|
||||
const AdPricingRuleModel = mongoose.model('AdPricingRule', adPricingRuleSchema)
|
||||
module.exports = AdPricingRuleModel
|
||||
Reference in New Issue
Block a user