Fixed: le reactions devono stare in una tabella a parte (reactions).

- cambiata la gestione dei seen, fav, book, attend
This commit is contained in:
Surya Paolo
2023-09-27 18:38:57 +02:00
parent ad6b4c2bfa
commit 142dcadca9
15 changed files with 826 additions and 264 deletions

View File

@@ -5,6 +5,7 @@ const router = express.Router();
const tools = require('../tools/general');
var server_constants = require('../tools/server_constants');
var {authenticate, auth_default} = require('../middleware/authenticate');
@@ -15,6 +16,7 @@ const Subscription = mongoose.model('subscribers');
const _ = require('lodash');
const {MyBacheca} = require('../models/mybacheca');
var {User} = require('../models/user');
const { Reaction } = require('../models/reaction');
const globalTables = require('../tools/globalTables');
@@ -41,10 +43,19 @@ router.post('/page', authenticate, function(req, res, next) {
mytable = globalTables.getTableByTableName(table);
}
if (mytable) {
return mytable.getMyRecById(idapp, id).
then((ris) => {
then(async (ris) => {
// Se è un record singolo di tipo Reaction,
// allora gli devo passare anche le liste degli utenti :
/*if (globalTables.isTableReaction(table)) {
// ...
const myreaction = await Reaction.find({idapp, idrec: id}).lean();
ris.myreaction = myreaction;
};*/
if (ris) {
res.send(ris);