cartodb-4.42/lib/assets/javascripts/dashboard/data/asset-model.js

28 lines
606 B
JavaScript
Raw Normal View History

2024-04-06 13:25:13 +08:00
const Backbone = require('backbone');
const checkAndBuildOpts = require('builder/helpers/required-opts');
/**
* Model that let user upload files
* to our endpoints
*/
require('backbone-model-file-upload');
const REQUIRED_OPTS = [
'configModel',
'userId'
];
module.exports = Backbone.Model.extend({
url: function (method) {
var version = this._configModel.urlVersion('asset', method);
return `/api/${version}/users/${this._userId}/assets`;
},
fileAttribute: 'filename',
initialize: function (attributes, options) {
checkAndBuildOpts(options, REQUIRED_OPTS, this);
}
});