a
This commit is contained in:
parent
4af14ffb22
commit
b61fd6cffb
@ -14,7 +14,6 @@ const citiesComposer = (city) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const commentComposer = (comment, context) => {
|
const commentComposer = (comment, context) => {
|
||||||
|
|
||||||
if (comment.user) {
|
if (comment.user) {
|
||||||
comment.user_name = comment.user.name + '---';
|
comment.user_name = comment.user.name + '---';
|
||||||
comment.profile_picture = cdnHelper.getCDNMediaUrl(comment.user.profile_picture);
|
comment.profile_picture = cdnHelper.getCDNMediaUrl(comment.user.profile_picture);
|
||||||
|
|||||||
@ -57,6 +57,16 @@ routes.get('/comments/speakers',
|
|||||||
*********************************************************************************************************
|
*********************************************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
routes.get('/admin/comments/events/:entityId',
|
||||||
|
isAdministratorUser,
|
||||||
|
// PaginateMiddleware.middleware(),
|
||||||
|
SortMiddleware.middleware({ default: "createdAt" }),
|
||||||
|
commentController.find({
|
||||||
|
scopes: ['defaultScope', 'onlyEvents'],
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// Borrado
|
// Borrado
|
||||||
routes.delete('/admin/comments/:id',
|
routes.delete('/admin/comments/:id',
|
||||||
isAdministratorUser,
|
isAdministratorUser,
|
||||||
|
|||||||
@ -475,9 +475,10 @@ console.log(mailOptions);
|
|||||||
getReservationsExcel: async (req, res, next) => {
|
getReservationsExcel: async (req, res, next) => {
|
||||||
const params = extractParamsFromRequest(req, res, {});
|
const params = extractParamsFromRequest(req, res, {});
|
||||||
const eventId = params.params.id;
|
const eventId = params.params.id;
|
||||||
|
const type = params.params.type;
|
||||||
const userId = req.user.id;
|
const userId = req.user.id;
|
||||||
|
|
||||||
const reservations = await eventReservationService._getReservationsExcel(req.user, eventId, null, function(result, status){
|
const reservations = await eventReservationService._getReservationsExcel(req.user, eventId, null, type, function(result, status){
|
||||||
if (result.messenger.code == "S99001") {
|
if (result.messenger.code == "S99001") {
|
||||||
console.log(result);
|
console.log(result);
|
||||||
res.setHeader('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
res.setHeader('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||||
|
|||||||
@ -337,12 +337,7 @@ routes.get('/admin/events/:id/reservations/excel',
|
|||||||
eventController.getReservationsExcel,
|
eventController.getReservationsExcel,
|
||||||
);
|
);
|
||||||
|
|
||||||
routes.get('/admin/events/:id/reservations/partners/excel',
|
routes.get('/admin/events/:id/reservations/:type/excel',
|
||||||
isAdministratorUser,
|
|
||||||
eventController.getReservationsExcel,
|
|
||||||
);
|
|
||||||
|
|
||||||
routes.get('/admin/events/:id/reservations/colleges/excel',
|
|
||||||
isAdministratorUser,
|
isAdministratorUser,
|
||||||
eventController.getReservationsExcel,
|
eventController.getReservationsExcel,
|
||||||
);
|
);
|
||||||
|
|||||||
@ -79,7 +79,15 @@ const extraMethods = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_getReservationsExcel: (user, eventId, partnerId, callback) => {
|
_getReservationsExcel: (user, eventId, partnerId, type, callback) => {
|
||||||
|
console.log('>>>>>>>>>>>>>>>>>>>><consulta con type:', type);
|
||||||
|
|
||||||
|
var whereType = {};
|
||||||
|
if (type == 'partners')
|
||||||
|
whereType = { alias: 'partner'}
|
||||||
|
else if (type == 'colleges')
|
||||||
|
whereType = { alias: 'college' };
|
||||||
|
|
||||||
models.EventReservation.findAll({
|
models.EventReservation.findAll({
|
||||||
where: {
|
where: {
|
||||||
eventId: eventId,
|
eventId: eventId,
|
||||||
@ -89,6 +97,7 @@ const extraMethods = {
|
|||||||
attributes: ['id', 'name'],
|
attributes: ['id', 'name'],
|
||||||
}, {
|
}, {
|
||||||
model: models.Entity,
|
model: models.Entity,
|
||||||
|
include: [{ model: models.EntityType, as: 'types', where: whereType }]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
model: models.EventInscription,
|
model: models.EventInscription,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user