ozserver
Version:
API for OZ
43 lines (33 loc) • 1.46 kB
JavaScript
var Delete, EventEmitter, Schema, exports, validate,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
validate = require('validate');
EventEmitter = require('events').EventEmitter;
Schema = require(global.home + '/script/views/validate/post');
Delete = (function(_super) {
__extends(Delete, _super);
function Delete(model) {
var _this = this;
this.model = model != null ? model : {};
this.on('success', function() {
_this.model.success = true;
return _this.model.notice = 'Сообщение успешно удалено';
});
this.on('userNotFound', function() {
_this.model.success = false;
return _this.model.notice = 'Не удалось найти информацию об авторе данного поста';
});
this.on('postNotFound', function() {
_this.model.success = false;
return _this.model.notice = 'Не удалось найти пост, который требуется изменить';
});
}
return Delete;
})(EventEmitter);
exports = module.exports = function(model) {
if (model == null) {
model = {};
}
return new Delete(model);
};
exports.Delete = Delete;