{"size": 1238, "ext": "js", "max_stars_repo_path": "dist/controller/exhibitController.js", "max_stars_repo_name": "fhstp/meeteux-god", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "dist/controller/exhibitController.js", "max_issues_repo_name": "fhstp/meeteux-god", "max_issues_repo_issues_event_min_datetime": "2017-08-28T12:18:16.000Z", "max_issues_repo_issues_event_max_datetime": "2018-08-07T09:09:59.000Z", "max_forks_repo_path": "dist/controller/exhibitController.js", "max_forks_repo_name": "fhstp/meeteux-god", "max_forks_repo_forks_event_min_datetime": "2019-01-14T12:31:04.000Z", "max_forks_repo_forks_event_max_datetime": "2019-01-14T12:31:04.000Z"}
{"max_stars_count": null, "max_issues_count": 10, "max_forks_count": 1, "avg_line_length": 51.5833333333, "max_line_length": 189, "alphanum_fraction": 0.6373182553}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const database_1 = require("../database");
const messages_1 = require("../messages");
const statusTypes = require("../config/statusTypes");
class ExhibitController {
    constructor() {
        this.database = database_1.Connection.getInstance();
    }
    loginExhibit(ipAddress) {
        // console.log("Logging in exhibit " + ipAddress);
        return this.database.location.findOne({ where: { ipAddress: ipAddress } }).then((exhibit) => {
            // console.log('Found exhibit: ' + exhibit.id);
            return this.database.location.update({ statusId: statusTypes.FREE }, { where: { [this.database.sequelize.Op.or]: [{ id: exhibit.id }, { parentId: exhibit.id }] } }).then(() => {
                // console.log('Updated exhibit: ' + exhibit.id);
                return { data: exhibit, message: new messages_1.Message(messages_1.SUCCESS_OK, "location data found") };
            });
        }).catch(() => {
            return { data: null, message: new messages_1.Message(messages_1.LOCATION_NOT_FOUND, "Could not find location") };
        });
    }
}
exports.ExhibitController = ExhibitController;
//# sourceMappingURL=exhibitController.js.map