Add pledges
This commit is contained in:
@@ -7,6 +7,14 @@ module.exports = function (options) {
|
||||
router.route('/')
|
||||
.get(function(request, response, next) {
|
||||
db.Pledge.findAll({
|
||||
include: [
|
||||
{
|
||||
association: db.Pledge.TranslationArtifactVersionPledges
|
||||
},
|
||||
{
|
||||
association: db.Pledge.Entity
|
||||
}
|
||||
]
|
||||
}).then(pledges => {
|
||||
if (pledges) {
|
||||
response.display("pledges", {
|
||||
@@ -20,6 +28,47 @@ module.exports = function (options) {
|
||||
}).catch(error => {
|
||||
next(error)
|
||||
})
|
||||
})
|
||||
|
||||
router.route('/:id')
|
||||
.get(function(request, response, next) {
|
||||
db.Pledge.findByPk(request.params.id, {
|
||||
include: [
|
||||
{
|
||||
association: db.Pledge.Entity
|
||||
},
|
||||
{
|
||||
association: db.Pledge.TranslationArtifactVersionPledges,
|
||||
include: [
|
||||
{
|
||||
association: db.TranslationArtifactVersionPledge.TranslationArtifactVersion,
|
||||
include: [
|
||||
{
|
||||
association: db.TranslationArtifactVersion.ArtifactVersion,
|
||||
include: [
|
||||
{
|
||||
association: db.ArtifactVersion.Artifact
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}).then(pledge => {
|
||||
if (pledge) {
|
||||
response.display("pledge", {
|
||||
user: request.user,
|
||||
pageTitle: "Pledge - Mantra",
|
||||
pledge: pledge
|
||||
})
|
||||
} else {
|
||||
next()
|
||||
}
|
||||
}).catch(error => {
|
||||
next(error)
|
||||
})
|
||||
|
||||
})
|
||||
return router;
|
||||
|
||||
Reference in New Issue
Block a user