bouquins/lib/endpoint/library.js

45 lines
987 B
JavaScript
Raw Normal View History

2014-01-20 19:30:45 +00:00
/**
* Endpoint library.
*/
var Endpoint = require('./endpoint.js');
function Library() {
Endpoint.call(this);
}
Library.prototype = Object.create(Endpoint.prototype, {
2014-01-21 19:25:07 +00:00
bind: {
value: function(action, callback) {
if (action.name == 'show') {
action.resId = 'library';
action.loadResource = function(resId, callback) {
//TODO load from db
callback(null, {
name: 'Bibliothèque Meutel'
});
};
action.getRelated = function(res){
return new Array(
// authors list
{ type: 'authors', path: '/author/' },
// books list
{ type: 'books', path: '/books/' },
// tags list
{ type: 'tags', path: '/tags/' },
// series list
{ type: 'series', path: '/series/' },
// user favorites
{ type: 'favorites', path:'/favorites/'}
);
};
}
callback(null, action);
},
enumerable: true,
configurable: true,
writable: true
},
2014-01-20 19:30:45 +00:00
});
exports = module.exports = new Library();