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: {
|
2014-01-22 21:08:21 +00:00
|
|
|
value: function(action, params, callback) {
|
2014-01-21 19:25:07 +00:00
|
|
|
if (action.name == 'show') {
|
|
|
|
action.resId = 'library';
|
|
|
|
action.loadResource = function(resId, callback) {
|
|
|
|
//TODO load from db
|
|
|
|
callback(null, {
|
|
|
|
name: 'Bibliothèque Meutel'
|
|
|
|
});
|
|
|
|
};
|
2014-01-22 21:08:21 +00:00
|
|
|
action.getRelated = function(res, relcback){
|
|
|
|
relcback(null, new Array(
|
2014-01-21 19:25:07 +00:00
|
|
|
// 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/'}
|
2014-01-22 21:08:21 +00:00
|
|
|
));
|
2014-01-21 19:25:07 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
callback(null, action);
|
|
|
|
},
|
|
|
|
enumerable: true,
|
|
|
|
configurable: true,
|
|
|
|
writable: true
|
|
|
|
},
|
|
|
|
|
|
|
|
|
2014-01-20 19:30:45 +00:00
|
|
|
});
|
|
|
|
exports = module.exports = new Library();
|