{"size": 1071, "ext": "js", "max_stars_repo_path": "modules/mago/server/routes/webhook.server.routes.js", "max_stars_repo_name": "sajume/magoware", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "modules/mago/server/routes/webhook.server.routes.js", "max_issues_repo_name": "sajume/magoware", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "modules/mago/server/routes/webhook.server.routes.js", "max_forks_repo_name": "sajume/magoware", "max_forks_repo_forks_event_min_datetime": "2022-03-14T20:22:32.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-14T20:22:32.000Z"}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 29.75, "max_line_length": 101, "alphanum_fraction": 0.6470588235}
'use strict';
var passport = require('passport'),
    JwtStrategy = require('passport-jwt').Strategy,
    ExtractJwt = require('passport-jwt').ExtractJwt;

var path = require('path'),
    db = require(path.resolve('./config/lib/sequelize')).models,
    policy = require('../policies/mago.server.policy'),
    webhooks = require(path.resolve('./modules/mago/server/controllers/webhooks.server.controller')),
    webhookSystem = require(path.resolve('./config/lib/webhook'));

module.exports = function (app) {

    webhookSystem.initWebhooks(app);
    /* ===== webhooks ===== */

    app.route('/api/webhooks')
        .all(policy.Authenticate)
        .all(policy.isAllowed)
        .get(webhooks.list)
        .post(webhooks.create);

    app.route('/api/webhooks/event_types')
        .get(webhooks.getEventTypes);



    app.route('/api/webhooks/:webhooksId')
        .all(policy.Authenticate)
        .all(policy.isAllowed)
        .get(webhooks.read)
        .delete(webhooks.delete)
        .put(webhooks.update);

    app.param('webhooksId', webhooks.dataByID);
};