- Add New Record directly by the QSelect
This commit is contained in:
@@ -22,6 +22,9 @@ const MySkillSchema = new Schema({
|
||||
required: true,
|
||||
},
|
||||
userId: {type: Schema.Types.ObjectId, ref: 'User'},
|
||||
idSector: {
|
||||
type: Number,
|
||||
},
|
||||
idSkill: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
@@ -65,6 +68,9 @@ const MySkillSchema = new Schema({
|
||||
subTitle: {
|
||||
type: String,
|
||||
},
|
||||
descr: {
|
||||
type: String,
|
||||
},
|
||||
date_created: {
|
||||
type: Date,
|
||||
default: Date.now,
|
||||
@@ -209,6 +215,7 @@ MySkillSchema.statics.getMySkillByIdkill = function (idapp, idSkill) {
|
||||
"$project": {
|
||||
"recSkill": 1,
|
||||
"sector": 1,
|
||||
"idSector": 1,
|
||||
"idSkill": 1,
|
||||
"idSubSkill": 1,
|
||||
"idStatusSkill": 1,
|
||||
@@ -257,6 +264,7 @@ MySkillSchema.statics.getMySkillByIdkill = function (idapp, idSkill) {
|
||||
"$project": {
|
||||
"recSkill": 1,
|
||||
"sector": 1,
|
||||
"idSector": 1,
|
||||
"idSkill": 1,
|
||||
"idSubSkill": 1,
|
||||
"idStatusSkill": 1,
|
||||
@@ -305,6 +313,7 @@ MySkillSchema.statics.getMySkillByIdkill = function (idapp, idSkill) {
|
||||
"$project": {
|
||||
"recSkill": 1,
|
||||
"sector": 1,
|
||||
"idSector": 1,
|
||||
"idSkill": 1,
|
||||
"idSubSkill": 1,
|
||||
"idStatusSkill": 1,
|
||||
@@ -353,6 +362,7 @@ MySkillSchema.statics.getMySkillByIdkill = function (idapp, idSkill) {
|
||||
"$project": {
|
||||
"recSkill": 1,
|
||||
"sector": 1,
|
||||
"idSector": 1,
|
||||
"idSkill": 1,
|
||||
"idSubSkill": 1,
|
||||
"idStatusSkill": 1,
|
||||
@@ -401,6 +411,7 @@ MySkillSchema.statics.getMySkillByIdkill = function (idapp, idSkill) {
|
||||
"$project": {
|
||||
"recSkill": 1,
|
||||
"sector": 1,
|
||||
"idSector": 1,
|
||||
"idSkill": 1,
|
||||
"idSubSkill": 1,
|
||||
"idStatusSkill": 1,
|
||||
|
||||
@@ -41,12 +41,6 @@ module.exports = {
|
||||
"__v" : 0,
|
||||
"label" : "Scambio di Lavoro"
|
||||
},
|
||||
{
|
||||
"_id" : ObjectID("61cae7da4c7b5931a5f367c9"),
|
||||
"idapp" : "1",
|
||||
"__v" : 0,
|
||||
"label" : "Sardex"
|
||||
},
|
||||
{
|
||||
"_id" : ObjectID("615a353c002c8298f4495bf7"),
|
||||
"idapp" : "12",
|
||||
@@ -86,11 +80,5 @@ module.exports = {
|
||||
"__v" : 0,
|
||||
"label" : "Scambio di Lavoro"
|
||||
},
|
||||
{
|
||||
"_id" : ObjectID("61cae7da4c7b5931a5f36712"),
|
||||
"idapp" : "12",
|
||||
"__v" : 0,
|
||||
"label" : "Sardex"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
@@ -25,7 +25,8 @@ module.exports = {
|
||||
},
|
||||
|
||||
popolaTabelleNuove() {
|
||||
const abilita = false;
|
||||
const abilita = true;
|
||||
const scrivi_citta = false;
|
||||
|
||||
let ris = null;
|
||||
if (abilita) {
|
||||
@@ -41,13 +42,15 @@ module.exports = {
|
||||
const { SubSkill } = require('../models/subskill');
|
||||
this.insertIntoDb('subskills', SubSkill)
|
||||
|
||||
if (scrivi_citta) {
|
||||
// Cities
|
||||
const {City} = require('../models/city');
|
||||
this.insertIntoDb('cities', City)
|
||||
|
||||
// Province
|
||||
const { Province } = require('../models/province');
|
||||
const {Province} = require('../models/province');
|
||||
this.insertIntoDb('provinces', Province)
|
||||
}
|
||||
|
||||
// Contribtypes
|
||||
const { Contribtype } = require('../models/contribtype');
|
||||
|
||||
@@ -6,31 +6,51 @@ module.exports = {
|
||||
},
|
||||
{
|
||||
_id: 2,
|
||||
descr: "Arte",
|
||||
},
|
||||
{
|
||||
_id: 3,
|
||||
descr: "Alimentazione",
|
||||
},
|
||||
{
|
||||
_id: 1,
|
||||
_id: 4,
|
||||
descr: "Artigianato",
|
||||
},
|
||||
{
|
||||
_id: 5,
|
||||
descr: "Assistenza Legale",
|
||||
},
|
||||
{
|
||||
_id: 6,
|
||||
descr: "Benessere e Salute",
|
||||
},
|
||||
{
|
||||
_id: 7,
|
||||
descr: "Gruppi Locali",
|
||||
},
|
||||
{
|
||||
_id: 1,
|
||||
_id: 8,
|
||||
descr: "Istruzione",
|
||||
},
|
||||
{
|
||||
_id: 1,
|
||||
_id: 9,
|
||||
descr: "Mobilità",
|
||||
},
|
||||
{
|
||||
_id: 1,
|
||||
descr: "Salute",
|
||||
},
|
||||
{
|
||||
_id: 1,
|
||||
_id: 10,
|
||||
descr: "Sport",
|
||||
},
|
||||
{
|
||||
_id: 1,
|
||||
_id: 11,
|
||||
descr: "Servizi",
|
||||
},
|
||||
{
|
||||
_id: 12,
|
||||
descr: "Tecnologia",
|
||||
},
|
||||
{
|
||||
_id: 13,
|
||||
descr: "Turismo",
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
@@ -339,6 +339,14 @@ router.post('/settable', authenticate, (req, res) => {
|
||||
|
||||
mydata.idapp = req.user.idapp;
|
||||
|
||||
let consentito = false;
|
||||
|
||||
try {
|
||||
if (User.isAdmin(req.user.perm) || User.isManager(req.user.perm) ||
|
||||
User.isEditor(req.user.perm) || User.isTutor(req.user.perm)) {
|
||||
consentito = true;
|
||||
}
|
||||
|
||||
if ((!User.isAdmin(req.user.perm) && !User.isManager(req.user.perm) &&
|
||||
!User.isEditor(req.user.perm) && !User.isTutor(req.user.perm)) &&
|
||||
!tools.ModificheConsentite(params.table, fieldsvalue)) {
|
||||
@@ -351,6 +359,12 @@ router.post('/settable', authenticate, (req, res) => {
|
||||
mydata.userId = req.user._id;
|
||||
}
|
||||
|
||||
if (shared_consts.TABLES_PERM_NEWREC.includes(params.table)) {
|
||||
if (!consentito) {
|
||||
mydata.verifyrec = false;
|
||||
}
|
||||
}
|
||||
|
||||
delete mydata['__v'];
|
||||
delete mydata['__proto__'];
|
||||
|
||||
@@ -397,6 +411,10 @@ router.post('/settable', authenticate, (req, res) => {
|
||||
}
|
||||
});
|
||||
|
||||
}catch (e) {
|
||||
return res.status(400).send(e);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
router.post('/setsubrec', authenticate, (req, res) => {
|
||||
@@ -1653,13 +1671,19 @@ function uploadFile(req, res, version) {
|
||||
|
||||
// Salva le immagini in formato compresso
|
||||
(async () => {
|
||||
await resizer(newname, setup_image_compress);
|
||||
try {
|
||||
const ris = await resizer(newname, setup_image_compress);
|
||||
|
||||
if (ris) {
|
||||
tools.delete(newname, false, () => {})
|
||||
|
||||
tools.move(resized_img, newname, (err) => {
|
||||
|
||||
})
|
||||
}
|
||||
}catch (e) {
|
||||
console.error('newname', e);
|
||||
}
|
||||
|
||||
})();
|
||||
res.end();
|
||||
|
||||
@@ -2090,6 +2090,9 @@ module.exports = {
|
||||
if (shared_consts.TABLES_PERM_CHANGE_FOR_USERS.includes(table)) {
|
||||
return true;
|
||||
}
|
||||
if (shared_consts.TABLES_PERM_NEWREC.includes(table)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
@@ -73,6 +73,7 @@ module.exports = {
|
||||
TABLES_UPDATE_LASTMODIFIED: ['myskills', 'mybots'],
|
||||
|
||||
TABLES_PERM_CHANGE_FOR_USERS: ['myskills'],
|
||||
TABLES_PERM_NEWREC: ['skills', 'subskills'],
|
||||
|
||||
VISIB_ALL: 0,
|
||||
VISIB_ONLYIF_VERIFIED: 1,
|
||||
|
||||
Reference in New Issue
Block a user