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