43 lines
1.5 KiB
JavaScript
43 lines
1.5 KiB
JavaScript
"use strict";
|
|
var user_class_1 = require("./user.class");
|
|
var plane_class_1 = require("./plane.class");
|
|
var Flight = (function () {
|
|
function Flight(id, flightday_id, starttime, endtime, type, comment, plane, users) {
|
|
this.id = id;
|
|
this.flightday_id = flightday_id;
|
|
this.plane = plane;
|
|
this.starttime = starttime;
|
|
this.endtime = endtime;
|
|
this.type = type;
|
|
this.comment = comment;
|
|
this.users = users;
|
|
}
|
|
Flight.prototype.equals = function (other) {
|
|
if (other) {
|
|
var keySet1 = Object.keys(this);
|
|
var keySet2 = Object.keys(other);
|
|
var j = 0;
|
|
var isTheSame = true;
|
|
for (j; j < keySet1.length; j++) {
|
|
if (this[keySet1[j]] !== other[keySet2[j]]) {
|
|
// Shit is not the same
|
|
isTheSame = false;
|
|
}
|
|
}
|
|
return isTheSame;
|
|
}
|
|
return false;
|
|
};
|
|
Flight.toFlight = function (r) {
|
|
var users = new Array();
|
|
var plane = plane_class_1.Plane.toPlane(r.PLANE);
|
|
for (var i = 0; i < r.USERS.length; i++) {
|
|
users.push(user_class_1.User.toUser(r.USERS[i]));
|
|
}
|
|
var flight = new Flight(r.ID, r.FLIGHTDAY_ID, r.DATETIME_START, r.DATETIME_END, r.TYPE, r.COMMENT, plane, users);
|
|
return flight;
|
|
};
|
|
return Flight;
|
|
}());
|
|
exports.Flight = Flight;
|
|
//# sourceMappingURL=flight.class.js.map
|