-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #67 from Saca-la-Bici/feat/0.1.5/actividades
Feat/0.1.5/actividades: Cambios y HU45
- Loading branch information
Showing
10 changed files
with
91 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const Rodada = require('./rodada.model'); | ||
const Taller = require('./taller.model'); | ||
const Evento = require('./evento.model'); | ||
|
||
async function encontrarEvento(id) { | ||
|
||
// Encontrar el tipo de evento por colección | ||
let event = await Rodada.findById(id); | ||
if (event) return { model: Rodada, event }; | ||
|
||
event = await Taller.findById(id); | ||
if (event) return { model: Taller, event }; | ||
|
||
event = await Evento.findById(id); | ||
if (event) return { model: Evento, event }; | ||
|
||
|
||
throw new Error('No se encontró ninguna actividad con este ID.'); | ||
} | ||
|
||
async function consultarActividadIndividual(id) { | ||
const { model } = await encontrarEvento(id); | ||
|
||
const actividad = await model.findById(id); | ||
return actividad; | ||
} | ||
|
||
module.exports = { consultarActividadIndividual }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const mongoose = require('mongoose'); | ||
const Schema = mongoose.Schema; | ||
const comentarioSchema = require('../foro/comentario.model'); | ||
|
||
const foroSchema = new Schema({ | ||
comentarios: { | ||
type: [comentarioSchema], | ||
default: [] | ||
} | ||
}, { | ||
collection: 'Foro' | ||
}); | ||
|
||
module.exports = mongoose.model('Foro', foroSchema); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
const express = require('express'); | ||
const router = express.Router(); | ||
const verifyUserToken = require('../../../util/verifyUserToken') | ||
const verifyUserPermissions = require('../../../util/verifyUserPermissions'); | ||
|
||
// Importar el controlador que maneja la creación de actividades | ||
const registrarActividadController = require('../controllers/registrarActividad.controller'); | ||
|
||
// Definir la ruta para crear una actividad | ||
router.post('/rodada', verifyUserToken, verifyUserPermissions, registrarActividadController.postRodada); | ||
router.post('/taller', verifyUserToken, verifyUserPermissions, registrarActividadController.postTaller); | ||
router.post('/evento', verifyUserToken, verifyUserPermissions, registrarActividadController.postEvento); | ||
router.post('/rodada', verifyUserToken, registrarActividadController.postRodada); | ||
router.post('/taller', verifyUserToken, registrarActividadController.postTaller); | ||
router.post('/evento', verifyUserToken, registrarActividadController.postEvento); | ||
|
||
module.exports = router; |