feat: add MongoDB search method, endpoints, and settings module
deploy-chabokan / deploy (push) Canceled after 0s
deploy-chabokan / deploy (push) Canceled after 0s
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
const mongoose = require('mongoose')
|
||||
|
||||
const settingSchema = new mongoose.Schema(
|
||||
{
|
||||
key: {
|
||||
type: String,
|
||||
required: true,
|
||||
unique: true,
|
||||
trim: true,
|
||||
},
|
||||
category: {
|
||||
type: String,
|
||||
default: 'search',
|
||||
},
|
||||
pageKey: {
|
||||
type: String,
|
||||
required: true,
|
||||
trim: true,
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
},
|
||||
searchMethod: {
|
||||
type: String,
|
||||
enum: ['typesense', 'mongo'],
|
||||
default: 'mongo',
|
||||
},
|
||||
extraConfig: {
|
||||
type: mongoose.Schema.Types.Mixed,
|
||||
default: {},
|
||||
},
|
||||
},
|
||||
{
|
||||
timestamps: true,
|
||||
}
|
||||
)
|
||||
|
||||
settingSchema.index({ key: 1 }, { unique: true })
|
||||
settingSchema.index({ pageKey: 1 })
|
||||
|
||||
const Setting = mongoose.model('Setting', settingSchema)
|
||||
module.exports = Setting
|
||||
Reference in New Issue
Block a user