Web Editor home made

This commit is contained in:
Surya Paolo
2022-11-17 08:09:48 +01:00
parent 60cf27c002
commit 745d4829bb
7 changed files with 52 additions and 9 deletions

View File

@@ -2,7 +2,7 @@ const mongoose = require('mongoose').set('debug', false)
const Schema = mongoose.Schema;
const tools = require('../tools/general');
const {ObjectID, ObjectId} = require('mongodb');
const { ObjectID, ObjectId } = require('mongodb');
mongoose.Promise = global.Promise;
mongoose.level = "F";
@@ -16,7 +16,7 @@ mongoose.plugin(schema => {
const MyElemSchema = new Schema({
_id: {
type: ObjectId,
default: function() {
default: function () {
return new ObjectId();
},
},
@@ -108,6 +108,9 @@ const MyElemSchema = new Schema({
class2: {
type: String,
},
class3: {
type: String,
},
styleadd: {
type: String,
},
@@ -125,6 +128,9 @@ const MyElemSchema = new Schema({
description: {
type: String,
},
style: {
type: String,
},
size: {
type: String,
},
@@ -137,7 +143,7 @@ const MyElemSchema = new Schema({
colorsub: {
type: String
},
},
}
],
list: [
{
@@ -157,7 +163,7 @@ const MyElemSchema = new Schema({
],
});
MyElemSchema.pre('save', async function(next) {
MyElemSchema.pre('save', async function (next) {
if (this.isNew) {
this._id = new ObjectID();
}
@@ -167,7 +173,7 @@ MyElemSchema.pre('save', async function(next) {
MyElemSchema.statics.getFieldsForSearch = function () {
return [{ field: 'title', type: tools.FieldType.string },
{ field: 'content', type: tools.FieldType.string }]
{ field: 'content', type: tools.FieldType.string }]
};
MyElemSchema.statics.executeQueryTable = function (idapp, params, user) {