This commit is contained in:
David Arranz 2019-07-29 19:17:28 +02:00
parent 1373b3ab05
commit ce74a5981b
2 changed files with 9 additions and 15 deletions

View File

@ -13,20 +13,6 @@ const citiesComposer = (city) => {
else return city;
}
const commentsComposer = (comments) => {
if (comments) {
return comments.map(comment => ({
...comment,
userId: undefined,
user: {
...comment.user,
profile_picture: cdnHelper.getCDNMediaUrl(comment.user.profile_picture)
}
}));
}
else return comments;
};
const commentComposer = (comment, context) => {
if (comment.user) {
@ -45,6 +31,14 @@ const commentComposer = (comment, context) => {
comment);
};
const commentsComposer = (comments) => {
if (comments) {
return comments.map(comment => ({
...commentComposer(comment)
}));
}
else return comments;
};
const multimediaComposer = (multimedias) => {

View File

@ -108,7 +108,7 @@ const extraControllers = {
const inscription = await eventInscriptionService._getInscriptionById(inscriptionId);
console.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>><Inscripcion a borrar:');
console.log(inscription);
if (!inscription)
if (!inscription || (inscription.userId !== user.id))
return handleResultResponse("Inscription no encontrada", null, params, res, httpStatus.NOT_FOUND);
//Borramos inscripcion y descontamos asistentes