Project e Todos sistemati...

aggiunti Gruppi
This commit is contained in:
Paolo Arena
2021-02-03 01:33:30 +01:00
parent 5493953b58
commit 25096e862f
28 changed files with 2962 additions and 65 deletions

View File

@@ -13,6 +13,9 @@ const CartSchema = new Schema({
userId: { type: Schema.Types.ObjectId, ref: 'User' },
totalQty: { type: Number, default: 0 },
totalPrice: { type: Number, default: 0 },
department: {
type: String, ref: 'Department'
},
items: [
{
order:

45
src/server/models/department.js Executable file
View File

@@ -0,0 +1,45 @@
mongoose = require('mongoose');
const Schema = mongoose.Schema;
const tools = require('../tools/general');
mongoose.Promise = global.Promise;
mongoose.level = "F";
// Resolving error Unknown modifier: $pushAll
mongoose.plugin(schema => {
schema.options.usePushEach = true
});
const departmentSchema = new Schema({
idapp: {
type: String,
},
name: {
type: String,
},
username: {
type: String,
},
});
var Department = module.exports = mongoose.model('Department', departmentSchema);
module.exports.getFieldsForSearch = function () {
return [{ field: 'name', type: tools.FieldType.string },
{ field: 'username', type: tools.FieldType.string }
]
};
module.exports.executeQueryTable = function (idapp, params) {
params.fieldsearch = this.getFieldsForSearch();
return tools.executeQueryTable(this, idapp, params);
};
module.exports.findAllIdApp = async function (idapp) {
const myfind = { idapp };
return await Department.find(myfind);
};

49
src/server/models/group.js Executable file
View File

@@ -0,0 +1,49 @@
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const tools = require('../tools/general');
mongoose.Promise = global.Promise;
mongoose.level = "F";
// Resolving error Unknown modifier: $pushAll
mongoose.plugin(schema => {
schema.options.usePushEach = true
});
const GroupSchema = new Schema({
idapp: {
type: String,
},
descr: {
type: String,
},
resp: {
type: String,
},
viceResp: {
type: String,
},
assignedToUsers: [
{ type: String }
],
});
var Group = module.exports = mongoose.model('Group', GroupSchema);
module.exports.getFieldsForSearch = function () {
return [{field: 'descr', type: tools.FieldType.string}]
};
module.exports.executeQueryTable = function (idapp, params) {
params.fieldsearch = this.getFieldsForSearch();
return tools.executeQueryTable(this, idapp, params);
};
module.exports.findAllIdApp = async function (idapp) {
const myfind = { idapp };
return await Group.find(myfind);
};

View File

@@ -5,6 +5,8 @@ const shared_consts = require('../tools/shared_nodejs');
const Order = require('../models/order');
const tools = require('../tools/general');
const { ObjectID } = require('mongodb');
const OrdersCartSchema = new Schema({
@@ -15,6 +17,9 @@ const OrdersCartSchema = new Schema({
userId: { type: Schema.Types.ObjectId, ref: 'User' },
totalQty: { type: Number, default: 0 },
totalPrice: { type: Number, default: 0 },
department: {
type: String, ref: 'Department'
},
items: [
{
order:
@@ -22,7 +27,8 @@ const OrdersCartSchema = new Schema({
}
],
status: {
type: Number
type: Number,
Default: 0,
},
note: {
type: String
@@ -40,7 +46,16 @@ var OrdersCart = module.exports = mongoose.model('OrdersCart', OrdersCartSchema)
module.exports.findAllIdApp = async function (idapp, userId) {
const myfind = { idapp, userId };
return await OrdersCart.findOne(myfind);
return await OrdersCart.find(myfind);
};
module.exports.executeQueryTable = function (idapp, params) {
params.fieldsearch = this.getFieldsForSearch();
return tools.executeQueryTable(this, idapp, params);
};
module.exports.getFieldsForSearch = function () {
return [{field: 'note', type: tools.FieldType.string}]
};
@@ -64,7 +79,7 @@ module.exports.getNewNumOrder = async function (uid, idapp) {
};
module.exports.getOrdersCartByUserId = async function (uid, idapp) {
let query = { userId: uid, idapp, status: { $gte: shared_consts.OrderStatus.CHECKOUT_CONFIRMED } }
let query = { userId: uid, idapp, status: { $gte: shared_consts.OrderStatus.CHECKOUT_SENT } }
const myorderscart = await OrdersCart.find(query);
for (let ind = 0; ind < myorderscart.length; ind++) {
@@ -107,6 +122,32 @@ module.exports.getOrdersCartByUserId = async function (uid, idapp) {
// return null;
}
module.exports.getOrdersCartByDepartmentId = async function (depId, idapp) {
let query = { idapp, status: { $gte: shared_consts.OrderStatus.CHECKOUT_SENT } }
const myorderscart = await OrdersCart.find(query);
for (let ind = 0; ind < myorderscart.length; ind++) {
for (const idkey in myorderscart[ind].items) {
try {
idorder = myorderscart[ind].items[idkey]._id.toString();
const myorder = myorderscart[ind].items[idkey].order;
if (!!myorder) {
idorder = myorderscart[ind].items[idkey].order._id.toString();
}
const myord = await Order.getTotalOrderById(idorder);
if (myord.length > 0) {
myorderscart[ind].items[idkey]._doc.order = myord[0];
}
} catch (e) {
console.log('err', e);
}
}
}
return myorderscart
// return null;
}
module.exports.updateOrdersCartById = function (id, newOrdersCart, callback) {
let query = { id: id }
OrdersCart.find(query, function (err, c) {

View File

@@ -54,6 +54,12 @@ const productSchema = new Schema({
quantityAvailable: {
type: Number
},
quantityLow: { //Soglia disponibilità bassa
type: Number
},
visibilityProductOutOfStock: { // Visibilità prodotto "esaurito"
type: Boolean
},
canBeShipped: { // è spedibile
type: Boolean
},

View File

@@ -19,6 +19,9 @@ mongoose.plugin(schema => {
mongoose.set('debug', process.env.DEBUG);
var ProjectSchema = new mongoose.Schema({
idapp: {
type: String,
},
userId: {
type: String,
},
@@ -39,6 +42,15 @@ var ProjectSchema = new mongoose.Schema({
priority: {
type: Number,
},
groupId: {
type: String,
},
respUsername: {
type: String,
},
viceRespUsername: {
type: String,
},
statusproj: {
type: Number,
default: 0
@@ -59,7 +71,6 @@ var ProjectSchema = new mongoose.Schema({
type: Boolean,
default: false
},
id_prev: mongoose.Schema.Types.ObjectId,
modified: {
type: Boolean,
},
@@ -119,7 +130,11 @@ var ProjectSchema = new mongoose.Schema({
},
privacywrite: {
type: String
}
},
deleted: {
type: Boolean,
default: false,
},
});
@@ -164,11 +179,20 @@ ProjectSchema.statics.findProjectByUserId = function (userId, idproj) {
};
ProjectSchema.statics.findAllProjByUserId = async function (userId) {
ProjectSchema.statics.findAllProjByUserId = async function (userId, idapp) {
var Project = this;
return Project.aggregate([
{ $match: { $or: [{ privacyread: server_constants.Privacy.all }, { userId: userId }] } },
const query = [
{
$match:
{
$and: [
{ idapp }, {
$or: [{ privacyread: server_constants.Privacy.all }, { userId: userId }],
}],
$or: [{ deleted: { $exists: false } }, { deleted: { $exists: true, $eq: false } }],
}
},
{
$graphLookup: {
from: "projects",
@@ -176,7 +200,13 @@ ProjectSchema.statics.findAllProjByUserId = async function (userId) {
connectFromField: "id_main_project",
connectToField: "_id",
as: "ris",
restrictSearchWithMatch: { $or: [{ privacyread: server_constants.Privacy.all }, { userId: userId }] }
/* restrictSearchWithMatch: {
$or: [
{ privacyread: server_constants.Privacy.all }, { userId: userId }
]
}
*/
}
},
{ $match: { "ris.privacyread": { $exists: true } } },
@@ -188,7 +218,9 @@ ProjectSchema.statics.findAllProjByUserId = async function (userId) {
// "id_main_project": 1,
// }
// }
]).then(ris1 => {
]
return Project.aggregate(query).then(ris1 => {
// console.log('findAllProjByUserId', ris1);
@@ -211,7 +243,13 @@ ProjectSchema.statics.findAllProjByUserId = async function (userId) {
ProjectSchema.statics.getArrIdParentInTable = function (userId) {
var Project = this;
return Project.find({ 'userId': userId }).distinct("id_parent")
return Project.find(
{
'userId': userId,
$or:
[{ deleted: { $exists: false } }, { deleted: { $exists: true, $eq: false } }]
}
).distinct("id_parent")
};
@@ -233,9 +271,10 @@ ProjectSchema.statics.getIdParentByIdProj = function (idProj) {
};
ProjectSchema.statics.creaProjMain = async function () {
ProjectSchema.statics.creaProjMain = async function (idapp) {
const projmain = {
idapp,
descr: process.env.PROJECT_DESCR_MAIN,
longdescr: process.env.PROJECT_DESCR_MAIN,
typeproj: 1,
@@ -255,13 +294,19 @@ ProjectSchema.statics.creaProjMain = async function () {
};
ProjectSchema.statics.getAllProjects = async function (userId) {
ProjectSchema.statics.getAllProjects = async function (userId, idapp) {
var Project = this;
// console.log('getAllProjects');
let obj = [];
const projbase = await Project.findOne( { descr: process.env.PROJECT_DESCR_MAIN })
const projbase = await Project.findOne(
{
idapp,
descr: process.env.PROJECT_DESCR_MAIN,
$or: [{ deleted: { $exists: false } }, { deleted: { $exists: true, $eq: false } }],
})
.then(ris => {
if (!!ris) {
// console.log('ris', ris);
@@ -269,14 +314,16 @@ ProjectSchema.statics.getAllProjects = async function (userId) {
return ris._doc;
else
return null;
}else {
return Project.creaProjMain();
} else {
return Project.creaProjMain(idapp);
}
});
obj.arrproj = await Project.findAllProjByUserId(userId);
obj.arrproj = await Project.findAllProjByUserId(userId, idapp);
obj.arrproj.push(projbase);
//obj.arrproj = [...arrmap];
return obj;
};
@@ -289,8 +336,8 @@ ProjectSchema.statics.enabletoModify = async function (userId, idProj) {
return Project.findOne({
'_id': idProj,
$or: [{
'privacywrite': server_constants.Privacy.all,
'userId': userId
privacywrite: server_constants.Privacy.all,
userId: userId
}]
}).then(ris => {
return (!!ris);
@@ -308,7 +355,7 @@ ProjectSchema.statics.updateCalc = async function (userId, idproj, objdatacalc,
}
}).then((myproj) => {
if (!!myproj) {
console.log('objdatacalc progressCalc', objdatacalc.mydata.progressCalc);
// console.log('objdatacalc progressCalc', objdatacalc.mydata.progressCalc);
objdatacalc.setValuesToRecord(myproj);

View File

@@ -55,13 +55,15 @@ var TodoSchema = new mongoose.Schema({
type: Boolean,
default: false
},
id_prev: mongoose.Schema.Types.ObjectId,
progress: {
type: Number,
},
phase: {
type: Number,
},
assignedToUsers: [
{ type: String }
],
assigned_to_userId: {
type: String,
},
@@ -81,6 +83,10 @@ var TodoSchema = new mongoose.Schema({
modified: {
type: Boolean,
},
deleted: {
type: Boolean,
default: false,
},
});
TodoSchema.methods.toJSON = function () {
@@ -115,10 +121,24 @@ TodoSchema.statics.findByUserIdAndIdParent = function (userId, category, phase =
// User.find({ admin: true }).where('created_at').gt(monthAgo).exec(function(err, users) {
// if (err) throw err;
function getQueryFilterTodo(userId) {
let myobj = [
{ userId: userId },
{
$or:
[{ deleted: { $exists: false } }, { deleted: { $exists: true, $eq: false } }]
}
]
;
return myobj;
}
/*
function getQueryFilterTodo(userId) {
myobj = [{ privacyread: server_constants.Privacy.all }, { userId: userId }];
return myobj;
}
*/
function getQueryTodo(filterMatchBefore = {}, userId) {
@@ -150,7 +170,14 @@ function getQueryTodo(filterMatchBefore = {}, userId) {
TodoSchema.statics.findAllByUserIdAndCat = function (userId) {
var Todo = this;
const query = getQueryTodo({}, userId);
const query = getQueryTodo({
$or: [{ deleted: { $exists: false } }, {
deleted: {
$exists: true,
$eq: false
}
}]
}, userId);
return Todo.aggregate(query)
.then(ris => {
@@ -222,8 +249,8 @@ TodoSchema.statics.getAllTodo = async function (userId) {
if (!!arralltodo) {
const arrfiltrato = arralltodo.filter(item => item.category.toString() === mycat.toString());
if (arrfiltrato.length > 0) {
const arrmap = tools.mapSort(arrfiltrato);
arrtodos.push(arrmap);
// const arrmap = tools.mapSort(arrfiltrato);
arrtodos.push(arrfiltrato);
// console.log('AGGIUNGI RECORDS TODO! cat: ', mycat, 'da aggiungere:', arrfiltrato.length, 'attuali', arrtodos.length);
// console.log(arrtodos)
} else {
@@ -335,7 +362,7 @@ class CalcTodo {
if (this.mydata.numitem > 0) {
this.mydata.progressCalc = Math.round(this.mydata.progressCalc / this.mydata.numitem);
}
console.log('this.mydata.progressCalc', this.mydata.progressCalc)
// console.log('this.mydata.progressCalc', this.mydata.progressCalc)
}
getData() {

View File

@@ -383,6 +383,14 @@ UserSchema.statics.isZoomeri = function (perm) {
}
};
UserSchema.statics.isDepartment = function (perm) {
try {
return ((perm & shared_consts.Permissions.Zoomeri) === shared_consts.Permissions.Department);
} catch (e) {
return false
}
};
UserSchema.statics.isTutor = function (perm) {
try {
return ((perm & shared_consts.Permissions.Tutor) === shared_consts.Permissions.Tutor);

View File

@@ -23,6 +23,7 @@ class Cart {
const mynewcart = new Cart(null);
mynewcart.idapp = cart.idapp || 0;
mynewcart.items = cart.items;
mynewcart.department = cart.department;
mynewcart.userId = cart.userId || "";
mynewcart.modify_at = new Date();
@@ -77,6 +78,7 @@ class Cart {
totalQty: this.totalQty,
totalPrice: this.totalPrice,
userId: this.userId,
department: this.department,
note: this.note,
modify_at: this.modify_at
})

View File

@@ -56,7 +56,9 @@ const Producer = require('../models/producer');
const Cart = require('../models/cart');
const OrdersCart = require('../models/orderscart');
const Storehouse = require('../models/storehouse');
const Department = require('../models/department');
const ShareWithUs = require('../models/sharewithus');
const Group = require('../models/group');
const Order = require('../models/order');
const tools = require('../tools/general');
@@ -202,14 +204,20 @@ function getTableByTableName(tablename) {
mytable = Product;
else if (tablename === 'storehouses')
mytable = Storehouse;
else if (tablename === 'departments')
mytable = Department;
else if (tablename === 'sharewithus')
mytable = ShareWithUs;
else if (tablename === 'groups')
mytable = Group;
else if (tablename === 'orders')
mytable = Order;
else if (tablename === 'producers')
mytable = Producer;
else if (tablename === 'carts')
mytable = Cart;
else if (tablename === 'orderscart')
mytable = OrdersCart;
else if (tablename === 'sendmsgs')
mytable = SendMsg;
else if (tablename === 'wheres')
@@ -1111,7 +1119,9 @@ router.get('/loadsite/:userId/:idapp/:sall', authenticate_noerror, (req, res) =>
let calzoom = CalZoom.findAllIdApp(idapp);
let gallery = Gallery.findAllIdApp(idapp);
let producers = Producer.findAllIdApp(idapp);
let groups = Group.findAllIdApp(idapp);
let storehouses = Storehouse.findAllIdApp(idapp);
let departments = Department.findAllIdApp(idapp);
let cart = null;
let orderscart = null;
if (sall) {
@@ -1126,7 +1136,7 @@ router.get('/loadsite/:userId/:idapp/:sall', authenticate_noerror, (req, res) =>
}
return Promise.all([bookedevent, eventlist, operators, wheres, contribtype, settings, permissions, disciplines, newstosent, mailinglist, mypage, gallery, paymenttype, calcstat, calzoom, producers, cart, storehouses, orderscart])
return Promise.all([bookedevent, eventlist, operators, wheres, contribtype, settings, permissions, disciplines, newstosent, mailinglist, mypage, gallery, paymenttype, calcstat, calzoom, producers, cart, storehouses, departments, orderscart, groups])
.then((arrdata) => {
// console.table(arrdata);
const myuser = req.user;
@@ -1153,7 +1163,9 @@ router.get('/loadsite/:userId/:idapp/:sall', authenticate_noerror, (req, res) =>
producers: arrdata[15],
cart: arrdata[16],
storehouses: arrdata[17],
orders: arrdata[18],
departments: arrdata[18],
orders: arrdata[19],
groups: arrdata[20],
myuser,
});
})

View File

@@ -0,0 +1,43 @@
const shared_consts = require('../tools/shared_nodejs');
const express = require('express');
const router = express.Router();
const tools = require('../tools/general');
var server_constants = require('../tools/server_constants');
var { Project } = require('../models/project');
var { authenticate, auth_default } = require('../middleware/authenticate');
var mongoose = require('mongoose');
const Subscription = mongoose.model('subscribers');
const _ = require('lodash');
const { ObjectID } = require('mongodb');
const Product = require('../models/product');
const Order = require('../models/order');
const Variant = require('../models/variant');
const CartClass = require('../modules/Cart')
const Cart = require('../models/cart');
const OrdersCart = require('../models/orderscart');
//GET orders
router.get('/:userId', authenticate, function (req, res, next) {
let userId = req.body.userId
let idapp = req.body.idapp
OrdersCart.getOrdersCartByUserId(userId, idapp, function (err, cart) {
if (err) return next(err)
if (cart)
res.send({ code: server_constants.RIS_CODE_OK, cart });
else
res.status(400).send(e);
})
})
module.exports = router;

View File

@@ -47,6 +47,9 @@ router.post('/', authenticate, (req, res) => {
.then(record => {
// tools.mylog('REC SAVED :', record.descr);
res.send({ record });
/*
tools.sendNotificationToUser(project.userId, 'Project: ' + record.descr, record.descr, '/project/' + project.category, '', 'project', [])
.then(ris => {
if (ris) {
@@ -55,6 +58,8 @@ router.post('/', authenticate, (req, res) => {
// already sent the error on calling sendNotificationToUser
}
})
*/
})
}).catch((e) => {
console.log('ERRORE in PROJECT POST', e.message);
@@ -119,8 +124,9 @@ router.patch('/:id', authenticate, (req, res) => {
router.get('/', (req, res) => {
tools.mylog('GET ALL PROJECTS: ');
const idapp = req.query.idapp;
return Project.getAllProjects('').then((objprojects) => {
return Project.getAllProjects('', idapp).then((objprojects) => {
if (!!objprojects.arrproj)
tools.mylog('projects', objprojects.arrproj.length);
@@ -135,6 +141,7 @@ router.get('/', (req, res) => {
router.get('/:userId', authenticate, (req, res) => {
const userId = req.params.userId;
const idapp = req.query.idapp;
tools.mylog('GET PROJECTS : ', req.params);
@@ -148,7 +155,7 @@ router.get('/:userId', authenticate, (req, res) => {
}
// Extract all the projects of the userId only
return Project.getAllProjects(userId).then((objprojects) => {
return Project.getAllProjects(userId, idapp).then((objprojects) => {
if (!!objprojects.arrproj)
tools.mylog('projects', objprojects.arrproj.length);
@@ -202,21 +209,36 @@ async function calcSingleProject(userId, myproj) {
router.delete('/:id', authenticate, (req, res) => {
var id = req.params.id;
let hide = true;
if (!ObjectID.isValid(id)) {
return res.status(404).send();
}
Project.findByIdAndRemove(id).then((project) => {
if (!project) {
return res.status(404).send();
}
if (hide) {
Project.findByIdAndUpdate(id, { $set: { deleted: true } }).then((project) => {
if (!project) {
return res.status(404).send();
}
res.send({ project });
}).catch((e) => {
res.status(400).send();
});
tools.mylog('DELETED ', project.descr, project._id);
} else {
res.send({ project });
}).catch((e) => {
res.status(400).send();
});
Project.findByIdAndRemove(id).then((project) => {
if (!project) {
return res.status(404).send();
}
tools.mylog('DELETED ', project.descr, project._id);
res.send({ project });
}).catch((e) => {
res.status(400).send();
});
}
});

View File

@@ -30,7 +30,6 @@ router.get('/', (req, res) => {
descr: "Primo Task Esempio",
enableExpiring: false,
expiring_at: new Date(),
id_prev: null,
modified: false,
modify_at: new Date(),
pos: 1,

View File

@@ -152,7 +152,6 @@ router.get('/test', (req, res) => {
descr: "Primo Task Esempio",
enableExpiring: false,
expiring_at: new Date(),
id_prev: null,
modified: false,
modify_at: new Date(),
pos: 1,
@@ -193,22 +192,38 @@ router.get('/', (req, res) => {
router.delete('/:id', authenticate, (req, res) => {
var id = req.params.id;
// var hide = req.params.hide;
let hide = true;
if (!ObjectID.isValid(id)) {
return res.status(404).send();
}
Todo.findByIdAndRemove(id).then((todo) => {
if (!todo) {
return res.status(404).send();
}
if (hide) {
Todo.findByIdAndUpdate(id, { $set: { deleted: true } }).then((todo) => {
if (!todo) {
return res.status(404).send();
}
res.send({ todo });
}).catch((e) => {
res.status(400).send();
});
// tools.mylog('DELETED ', todo.descr, todo._id);
} else {
Todo.findByIdAndRemove(id).then((todo) => {
if (!todo) {
return res.status(404).send();
}
// tools.mylog('DELETED ', todo.descr, todo._id);
res.send({ todo });
}).catch((e) => {
res.status(400).send();
});
}
res.send({ todo });
}).catch((e) => {
res.status(400).send();
});
});

View File

@@ -63,6 +63,7 @@ const site_router = require('./router/site_router');
const admin_router = require('./router/admin_router');
const products_router = require('./router/products_router');
const cart_router = require('./router/cart_router');
const orders_router = require('./router/orders_router');
const { ListaIngresso } = require('./models/listaingresso');
@@ -132,6 +133,7 @@ app.use('/site', site_router);
app.use('/admin', admin_router);
app.use('/products', products_router);
app.use('/cart', cart_router);
app.use('/orders', orders_router);
// catch 404 and forward to error handler
// app.use(function (req, res, next) {

View File

@@ -87,7 +87,6 @@ const todos = [{
descr: "Primo Task Esempio",
enableExpiring: false,
expiring_at: new Date(),
id_prev: null,
modified: false,
modify_at: new Date(),
pos: 1,
@@ -103,7 +102,6 @@ const todos = [{
descr: "Secondo Task Esempio",
enableExpiring: false,
expiring_at: new Date(),
// id_prev: "1",
modified: false,
modify_at: new Date(),
pos: 2,
@@ -119,7 +117,6 @@ const todos = [{
descr: "Terzo Task Esempio",
enableExpiring: false,
expiring_at: new Date(),
// id_prev: "1",
modified: false,
modify_at: new Date(),
pos: 3,
@@ -134,7 +131,6 @@ const todos = [{
descr: "Nuovo Quarto Task Esempio da Inserire",
enableExpiring: false,
expiring_at: new Date(),
// id_prev: "2",
modified: false,
modify_at: new Date(),
pos: 4,

View File

@@ -596,8 +596,8 @@ module.exports = {
},
allfieldTodo: function () {
return ['userId', 'pos', 'category', 'descr', 'priority', 'statustodo', 'created_at', 'modify_at',
'completed_at', 'expiring_at', 'enableExpiring', 'id_prev', 'progress', 'modified', 'phase', 'assigned_to_userId', 'hoursplanned', 'hoursworked', 'start_date', 'themecolor', 'themebgcolor']
return ['userId', 'pos', 'category', 'descr', 'priority', 'statustodo', 'assignedToUsers', 'created_at', 'groupId', 'modify_at',
'completed_at', 'expiring_at', 'enableExpiring', 'progress', 'modified', 'phase', 'assigned_to_userId', 'hoursplanned', 'hoursworked', 'start_date', 'themecolor', 'themebgcolor']
},
allfieldMyEvent: function () {
@@ -610,8 +610,8 @@ module.exports = {
// #TODO Projects++ Add fields ...
allfieldProject: function () {
return ['userId', 'pos', 'typeproj', 'id_main_project', 'id_parent', 'descr', 'longdescr', 'hoursplanned', 'hoursleft', 'themecolor', 'themebgcolor', 'hoursworked', 'priority', 'statusproj', 'created_at', 'modify_at',
'completed_at', 'expiring_at', 'enableExpiring', 'id_prev', 'progressCalc', 'modified', 'live_url', 'test_url', 'begin_development', 'begin_test', 'totalphases', 'actualphase', 'hoursweeky_plannedtowork', 'endwork_estimate'
return ['idapp', 'userId', 'respUsername', 'viceRespUsername', 'pos', 'typeproj', 'id_main_project', 'id_parent', 'descr', 'longdescr', 'groupId', 'hoursplanned', 'hoursleft', 'themecolor', 'themebgcolor', 'hoursworked', 'priority', 'statusproj', 'created_at', 'modify_at',
'completed_at', 'expiring_at', 'enableExpiring', 'progressCalc', 'modified', 'live_url', 'test_url', 'begin_development', 'begin_test', 'totalphases', 'actualphase', 'hoursweeky_plannedtowork', 'endwork_estimate'
, 'privacyread', 'privacywrite']
},
@@ -769,7 +769,7 @@ module.exports = {
// **********************
// SORT WITH PREV_ID
// **********************
mapSort: function (linkedList) {
/* mapSort: function (linkedList) {
let sortedList = [];
let remainingList = [];
var map = new Map();
@@ -782,11 +782,11 @@ module.exports = {
var item = linkedList[i];
if (item.id_prev === server_constants.LIST_START) {
// first item
currentId = String(item._id);
currentId = item._id.toString();
// console.log('currentId', currentId);
sortedList.push(item);
} else {
map.set(String(item.id_prev), i);
map.set(item.id_prev.toString(), i);
}
}
@@ -798,7 +798,7 @@ module.exports = {
} else {
sortedList.push(nextItem);
currentId = String(nextItem._id);
currentId = nextItem._id.toString();
}
conta++;
}
@@ -818,6 +818,9 @@ module.exports = {
return sortedList;
},
*/
checkUserOk(userpassed, userauth, res) {
this.mylog('checkUserOk', userpassed, userauth);

View File

@@ -31,6 +31,7 @@ module.exports = {
Tutor: 8,
Traduttrici: 16,
Zoomeri: 32,
Department: 64,
},
MessageOptions: {
@@ -64,10 +65,11 @@ module.exports = {
OrderStatus: {
NONE: 0,
IN_CART: 1,
CHECKOUT_CONFIRMED: 2,
PAYED: 3,
DELIVEDED: 4,
RECEIVED: 5,
CHECKOUT_SENT: 2,
ORDER_CONFIRMED: 3,
PAYED: 4,
DELIVEDED: 5,
RECEIVED: 6,
CANCELED: 10,
},