.
This commit is contained in:
parent
4267e3a8c8
commit
42a6eefa48
@ -117,7 +117,8 @@ console.log('paraaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaams');
|
||||
delete: (config) => {
|
||||
return async (req, res, next) => {
|
||||
try {
|
||||
const result = await service.delete(req.params, buildContext(req, config));
|
||||
const params = extractParamsFromRequest(req, res, _options.params.delete);
|
||||
const result = await service.delete(params, buildContext(req, config));
|
||||
return handleResultResponse(result, null, req.params, res, httpStatus.NO_CONTENT);
|
||||
} catch (error) {
|
||||
return handleErrorResponse(_options.MODULE_NAME, 'delete', error, res)
|
||||
|
||||
@ -346,7 +346,7 @@ routes.put('/admin/reservations/:id',
|
||||
eventReservationController.update(),
|
||||
);
|
||||
|
||||
// Borrar ponente
|
||||
// Borrar reserva
|
||||
routes.delete('/admin/reservations/:id',
|
||||
// isAdministratorUser,
|
||||
eventReservationController.delete()
|
||||
|
||||
@ -72,7 +72,7 @@ module.exports = function (sequelize, DataTypes) {
|
||||
|
||||
EventInscription.associate = function (models) {
|
||||
EventInscription.Event = EventInscription.belongsTo(models.Event, { foreignKey: 'eventId', as: 'event' });
|
||||
EventInscription.Reservation = EventInscription.belongsTo(models.EventReservation, { foreignKey: 'reservationId', as: 'reservation' });
|
||||
EventInscription.Reservation = EventInscription.belongsTo(models.EventReservation, { foreignKey: 'reservationId', as: 'reservation', onDelete: 'set null' });
|
||||
EventInscription.User = EventInscription.belongsTo(models.User, { foreignKey: 'userId', as: 'user' });
|
||||
EventInscription.UserValidate = EventInscription.belongsTo(models.User, { foreignKey: 'validateUserId' });
|
||||
};
|
||||
|
||||
@ -101,23 +101,24 @@ module.exports = function (sequelize, DataTypes) {
|
||||
foreignKey: 'overflow_reservationId' });
|
||||
EventReservation.Entity = EventReservation.belongsTo(models.Entity, { foreignKey: 'entityId' });
|
||||
EventReservation.Event = EventReservation.belongsTo(models.Event, { foreignKey: 'eventId' });
|
||||
EventReservation.Inscriptions = EventReservation.hasMany(models.EventInscription, { foreignKey: 'reservationId' });
|
||||
EventReservation.Inscriptions = EventReservation.hasMany(models.EventInscription, { foreignKey: 'reservationId', as: 'inscriptions' });
|
||||
EventReservation.UserCreate = EventReservation.belongsTo(models.User, { foreignKey: 'userId' });
|
||||
};
|
||||
|
||||
EventReservation.addScope('includeEvent', () => {
|
||||
return {
|
||||
include: [
|
||||
{ model: sequelize.models.Event}
|
||||
]
|
||||
include: [{
|
||||
model: sequelize.models.Event
|
||||
}]
|
||||
}
|
||||
});
|
||||
|
||||
EventReservation.addScope('includeInscriptions', () => {
|
||||
return {
|
||||
include: [
|
||||
{ model: sequelize.models.EventInscription }
|
||||
]
|
||||
include: [{
|
||||
model: sequelize.models.EventInscription,
|
||||
as: 'inscriptions'
|
||||
}]
|
||||
}
|
||||
});
|
||||
return EventReservation;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user