Add full ability to add/delete attendees
This commit is contained in:
58
js/models.js
58
js/models.js
@ -101,6 +101,33 @@ Attendee.prototype.isAttendee = function() {
|
||||
this.Name != empty_attendee.Name;
|
||||
}
|
||||
|
||||
function PopularAttendee() {
|
||||
this.Name = "";
|
||||
this.Popularity = 0;
|
||||
}
|
||||
|
||||
PopularAttendee.prototype.toJSON = function() {
|
||||
var json_obj = {};
|
||||
json_obj.Name = this.Name;
|
||||
json_obj.Popularity = this.Popularity;
|
||||
return JSON.stringify(json_obj);
|
||||
}
|
||||
|
||||
PopularAttendee.prototype.fromJSON = function(json_input) {
|
||||
var json_obj = getJSONObj(json_input);
|
||||
|
||||
if (json_obj.hasOwnProperty("Popularity"))
|
||||
this.Popularity = json_obj.Popularity;
|
||||
if (json_obj.hasOwnProperty("Name"))
|
||||
this.Name = json_obj.Name;
|
||||
}
|
||||
|
||||
PopularAttendee.prototype.isPopularAttendee = function() {
|
||||
var empty_attendee = new PopularAttendee();
|
||||
return this.Popularity != empty_attendee.Popularity ||
|
||||
this.Name != empty_attendee.Name;
|
||||
}
|
||||
|
||||
function Suggestion() {
|
||||
this.SuggestionId = -1;
|
||||
this.VetoingId = -1;
|
||||
@ -134,6 +161,33 @@ Suggestion.prototype.isSuggestion = function() {
|
||||
this.RestaurantName != empty_suggestion.RestaurantName;
|
||||
}
|
||||
|
||||
function PopularSuggestion() {
|
||||
this.RestaurantName = "";
|
||||
this.Popularity = 0;
|
||||
}
|
||||
|
||||
PopularSuggestion.prototype.toJSON = function() {
|
||||
var json_obj = {};
|
||||
json_obj.RestaurantName = this.RestaurantName;
|
||||
json_obj.Popularity = this.Popularity;
|
||||
return JSON.stringify(json_obj);
|
||||
}
|
||||
|
||||
PopularSuggestion.prototype.fromJSON = function(json_input) {
|
||||
var json_obj = getJSONObj(json_input);
|
||||
|
||||
if (json_obj.hasOwnProperty("RestaurantName"))
|
||||
this.RestaurantName = json_obj.RestaurantName;
|
||||
if (json_obj.hasOwnProperty("Popularity"))
|
||||
this.Popularity = json_obj.Popularity;
|
||||
}
|
||||
|
||||
PopularSuggestion.prototype.isPopularSuggestion = function() {
|
||||
var empty_suggestion = new PopularSuggestion();
|
||||
return this.RestaurantName != empty_suggestion.RestaurantName &&
|
||||
this.Popularity != empty_suggestion.Popularity;
|
||||
}
|
||||
|
||||
function Error() {
|
||||
this.ErrorId = -1;
|
||||
this.ErrorString = "";
|
||||
@ -167,6 +221,10 @@ module.exports = models = {
|
||||
User: User,
|
||||
Session: Session,
|
||||
Error: Error,
|
||||
Attendee: Attendee,
|
||||
PopularAttendee: PopularAttendee,
|
||||
Suggestion: Suggestion,
|
||||
PopularSuggestion: PopularSuggestion,
|
||||
|
||||
// Constants
|
||||
BogusPassword: "password"
|
||||
|
Reference in New Issue
Block a user