cartodb/lib/assets/javascripts/dashboard/components/dashboard-header/notifications/organization-notification-model.js
2020-06-15 10:58:47 +08:00

31 lines
631 B
JavaScript

const UserNotificationModel = require('./user-notification-model');
const checkAndBuildOpts = require('builder/helpers/required-opts');
const REQUIRED_OPTS = [
'userId',
'configModel',
'apiKey'
];
/**
* User notification default model
*/
module.exports = UserNotificationModel.extend({
url: function () {
return `/api/v3/users/${this._userId}/notifications/${this.id}?api_key=${this._apiKey}`;
},
initialize: function (attrs, opts) {
checkAndBuildOpts(opts, REQUIRED_OPTS, this);
},
markAsRead: function () {
this.save({
notification: {
read_at: new Date()
}
});
}
});