Shuo/lib/models.js

43 lines
654 B
JavaScript
Raw Normal View History

2014-03-06 18:02:43 +00:00
var _ = require("lodash");
2014-03-06 15:11:25 +00:00
var models = exports;
var id = 0;
models.Network = function() {
this.id = id++;
this.address = "";
this.nick = "";
this.channels = [];
};
2014-03-06 18:02:43 +00:00
models.Network.prototype.toJSON = function() {
return _.omit(this, "irc");
};
2014-03-06 15:11:25 +00:00
models.Channel = function() {
this.id = id++;
this.name = "";
this.type = "channel";
this.topic = "";
this.users = [];
this.messages = [];
};
models.User = function() {
this.id = id++;
this.name = "";
};
models.Message = function() {
this.text = "";
this.time = "";
this.user = "";
};
models.Event = function() {
this.action = "";
this.data = "";
this.target = "";
this.type = "";
};