Webpage Editor functionality
This commit is contained in:
@@ -111,7 +111,6 @@ const CircuitSchema = new Schema({
|
||||
},
|
||||
deperimento: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
freq_deper: { // H, D, W, M, Y
|
||||
type: String,
|
||||
@@ -735,6 +734,13 @@ CircuitSchema.statics.updateData = async function(idapp, circuitname) {
|
||||
|
||||
};
|
||||
|
||||
CircuitSchema.statics.setDeperimentoOff = async function() {
|
||||
|
||||
return await Circuit.updateMany({}, {$set: {'deperimento': false}},
|
||||
{new: false});
|
||||
|
||||
};
|
||||
|
||||
const Circuit = mongoose.model('Circuit', CircuitSchema);
|
||||
|
||||
module.exports = {Circuit};
|
||||
|
||||
@@ -2,6 +2,7 @@ const mongoose = require('mongoose').set('debug', false)
|
||||
const Schema = mongoose.Schema;
|
||||
|
||||
const tools = require('../tools/general');
|
||||
const {ObjectID} = require('mongodb');
|
||||
|
||||
mongoose.Promise = global.Promise;
|
||||
mongoose.level = "F";
|
||||
@@ -13,9 +14,18 @@ mongoose.plugin(schema => {
|
||||
});
|
||||
|
||||
const MyElemSchema = new Schema({
|
||||
_id: {
|
||||
type: ObjectID,
|
||||
default: function() {
|
||||
return new ObjectID();
|
||||
},
|
||||
},
|
||||
idapp: {
|
||||
type: String,
|
||||
},
|
||||
path: {
|
||||
type: String,
|
||||
},
|
||||
type: {
|
||||
type: Number,
|
||||
},
|
||||
@@ -98,6 +108,14 @@ const MyElemSchema = new Schema({
|
||||
],
|
||||
});
|
||||
|
||||
MyElemSchema.pre('save', async function(next) {
|
||||
if (this.isNew) {
|
||||
this._id = new ObjectID();
|
||||
}
|
||||
|
||||
next();
|
||||
});
|
||||
|
||||
MyElemSchema.statics.getFieldsForSearch = function () {
|
||||
return [{ field: 'title', type: tools.FieldType.string },
|
||||
{ field: 'content', type: tools.FieldType.string }]
|
||||
|
||||
@@ -332,7 +332,7 @@ router.post('/settable', authenticate, async (req, res) => {
|
||||
} else if (params.table === 'hours') {
|
||||
|
||||
} else {
|
||||
if ((mydata['_id'] === undefined || (mytablerec.isNew && mydata['_id'] === 0)) && (mytablerec._id === undefined)) {
|
||||
if ((mydata['_id'] === undefined || mydata['_id'] === '' || (mytablerec.isNew && mydata['_id'] === 0)) && (mytablerec._id === undefined)) {
|
||||
mytablerec._id = new ObjectID();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ require('./db/mongoose');
|
||||
|
||||
const {Settings} = require('./models/settings');
|
||||
|
||||
// test
|
||||
|
||||
const i18n = require('i18n');
|
||||
|
||||
@@ -85,6 +86,7 @@ const {CfgServer} = require('./models/cfgserver');
|
||||
const {ObjectID} = require('mongodb');
|
||||
|
||||
const populate = require('./populate/populate');
|
||||
const {Circuit} = require('./models/circuit');
|
||||
|
||||
const printf = require('util').format;
|
||||
|
||||
@@ -437,6 +439,12 @@ async function inizia() {
|
||||
|
||||
}
|
||||
|
||||
/*const {Circuit} = require('./models/circuit');
|
||||
|
||||
await Circuit.setDeperimentoOff();
|
||||
|
||||
*/
|
||||
|
||||
console.log(process.versions);
|
||||
|
||||
} catch (e) {
|
||||
|
||||
1
src/server/telegram/prova.txt
Normal file
1
src/server/telegram/prova.txt
Normal file
@@ -0,0 +1 @@
|
||||
http://localhost:8084/signup/paoloar77/SuryaArena/5356627050
|
||||
@@ -478,7 +478,8 @@ const txt = {
|
||||
MSG_SCEGLI_MENU: emoji.get('dizzy') + ' Scegli una voce di menu:' +
|
||||
emoji.get('dizzy'),
|
||||
MSG_ASK_USERNAME_BO: 'Scrivete nel messaggio l\'username (SENZA SPAZI) o la email con cui vi siete registrati sul sito di %s:',
|
||||
MSG_ASK_USERNAME_INVITANTE: 'Incolla (o scrivi) l\'username di chi ti ha invitato su %s (non inserire spazi)',
|
||||
MSG_ASK_USERNAME_INVITANTE: 'Scrivi <b>l\'username telegram</b> di chi ti ha invitato su %s (senza spazi)',
|
||||
MSG_NEW_REG: '<br>Se non ce l\'avete, entrate sul Canale (<a href="https://t.me/+pZ40VpmL1NhkZjE0">PROGETTO RISO</a>), trovate la vostra provincia e chiedete di entrare nel gruppo.',
|
||||
MSG_ERRORE_INVITANTE_NOT_FOUND: 'L\'username dell\'invitante appena digitato non sembra essere corretto! Ti ricordo che dev\'essere l\'username con cui si è registrato su RISO',
|
||||
MSG_ERRORE_USERNAME: 'Attenzione! Devi inserire solo lo username (40 caratteri massimo)',
|
||||
MSG_ERRORE_USERNAME_NOT_FOUND: 'Per Completare la Verifica Telegram BOT, dovete ora scrivere qui sotto nel messaggio l\'Username (senza spazi) OPPURE la email con cui vi siete registrati sul sito',
|
||||
@@ -2521,7 +2522,12 @@ class Telegram {
|
||||
|
||||
if (rec && !rec.aportador_solidario) {
|
||||
rec.status = Status.SET_USERNAME_INVITANTE;
|
||||
await this.sendMsg(msg.chat.id, getstr(this.getlang(msg), 'MSG_ASK_USERNAME_INVITANTE', tools.getNomeAppByIdApp(this.idapp), null));
|
||||
let mystr = getstr(this.getlang(msg), 'MSG_ASK_USERNAME_INVITANTE', tools.getNomeAppByIdApp(this.idapp), null);
|
||||
|
||||
if (this.idapp === tools.RISO) {
|
||||
mystr += getstr(this.getlang(msg), 'MSG_NEW_REG');
|
||||
}
|
||||
await this.sendMsg(msg.chat.id, mystr);
|
||||
} else {
|
||||
// if (linkreg)
|
||||
// this.asktoRegistrationByLink(msg);
|
||||
|
||||
9
src/server/test
Normal file
9
src/server/test
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user