Bulk Import (#55)

Bulk Import
This commit is contained in:
Qstick
2017-08-23 21:39:27 -04:00
committed by GitHub
parent 0da6f6e3c7
commit de5e0871cf
31 changed files with 900 additions and 209 deletions
@@ -0,0 +1,49 @@
var _ = require('underscore');
var PageableCollection = require('backbone.pageable');
var ArtistModel = require('../../Artist/ArtistModel');
var AsSortedCollection = require('../../Mixins/AsSortedCollection');
var AsPageableCollection = require('../../Mixins/AsPageableCollection');
var AsPersistedStateCollection = require('../../Mixins/AsPersistedStateCollection');
var BulkImportCollection = PageableCollection.extend({
url : window.NzbDrone.ApiRoot + '/artist/bulkimport',
model : ArtistModel,
tableName : 'bulkimport',
state : {
pageSize : 100000,
sortKey: 'sortName',
firstPage: 1
},
fetch : function(options) {
options = options || {};
var data = options.data || {};
if (!data.id || !data.folder) {
data.id = this.folderId;
data.folder = this.folder;
}
options.data = data;
return PageableCollection.prototype.fetch.call(this, options);
},
parseLinks : function(options) {
return {
first : this.url,
next: this.url,
last : this.url
};
}
});
BulkImportCollection = AsSortedCollection.call(BulkImportCollection);
BulkImportCollection = AsPageableCollection.call(BulkImportCollection);
BulkImportCollection = AsPersistedStateCollection.call(BulkImportCollection);
module.exports = BulkImportCollection;