<commit_before>/////////////
// Routing //
/////////////

'use strict';

var validators = require('./controllers/validators');
var validator  = require('validator');

module.exports = function (router, db, config) {
    var controllers = require('./controllers')(db, config);
    var auth       = require('./lib/auth')(config);

    // Tickets
    router.get(
        '/tickets',
        controllers.tickets.getAll
    );

    // Events
    router.route('/events').
        get(
            controllers.events.getAll
        )
        .post(
            auth.checkAuth,
            validators.createEvent,
            controllers.events.create
        )
        .put(
            validators.editEvent,
            controllers.events.edit
        );

    router.route('/events/:eventId')
        .delete(
            controllers.events.remove
        )
        .get(
            controllers.events.getOne
        );

    // Events ticket
    router.get(
        '/events/:eventId/tickets',
        controllers.tickets.getAllFromEvent
    );

    // Events prices
    router.put(
        '/events/:eventId/prices',
        validators.createPrice,
        controllers.events.createPrice
    );
    router.post(
        '/events/:eventId/prices/:priceId',
        validators.editPrice,
        controllers.events.editPrice
    );

    // Auth etu
    router.post(
        '/etu/auth',
        validators.etuAuth,
        controllers.etu.auth,
        auth.addAuth
    );

    // Search among users list
    router.get(
        '/etu/search/',
        controllers.etu.searchUsers
    );

    // Token demo
    router.get(
        '/token/:token',
        auth.checkAuth,
        function (req, res) {
            res.json(req.user);
        }
    );

    // School domains
    router.route('/domains/')
        .get(
            controllers.domains.getAll
        )
        .post(
            validators.createDomain,
            controllers.domains.create
        );
    router.route('/domains/:domainId')
        .delete(
            controllers.domains.remove
        );

    // Back Price
    router.route('/bankPrice/')
        .get(
            controllers.bankPrice.get
        )
        .post(
            validators.editBankprice,<commit_msg>New auth middleware : isEventAdmin + Rename auth to login<commit_after>/////////////
// Routing //
/////////////

'use strict';

var validators = require('./controllers/validators');
var validator  = require('validator');

module.exports = function (router, db, config) {
    var controllers = require('./controllers')(db, config);
    var auth       = require('./lib/auth')(db, config);

    // Tickets
    router.get(
        '/tickets',
        controllers.tickets.getAll
    );

    // Events
    router.route('/events').
        get(
            controllers.events.getAll
        )
        .post(
            auth.checkAuth,
            validators.createEvent,
            controllers.events.create
        )
        .put(
            validators.editEvent,
            controllers.events.edit
        );

    router.route('/events/:eventId')
        .delete(
            controllers.events.remove
        )
        .get(
            auth.checkAuth,
            auth.isEventAdmin,
            controllers.events.getOne
        );

    // Events ticket
    router.get(
        '/events/:eventId/tickets',
        controllers.tickets.getAllFromEvent
    );

    // Events prices
    router.put(
        '/events/:eventId/prices',
        validators.createPrice,
        controllers.events.createPrice
    );
    router.post(
        '/events/:eventId/prices/:priceId',
        validators.editPrice,
        controllers.events.editPrice
    );

    // Auth etu
    router.post(
        '/etu/login',
        validators.etuLogin,
        controllers.etu.login,
        auth.addAuth
    );

    // Search among users list
    router.get(
        '/etu/search/',
        controllers.etu.searchUsers
    );

    // School domains
    router.route('/domains/')
        .get(
            controllers.domains.getAll
        )
        .post(
            validators.createDomain,
            controllers.domains.create
        );
    router.route('/domains/:domainId')
        .delete(
            controllers.domains.remove
        );

    // Back Price
    router.route('/bankPrice/')
        .get(
            controllers.bankPrice.get
        )
        .post(
            validators.editBankprice,
{'fraction_non_alphanumeric': 0.13088533453480514, 'fraction_numerical': 0.0, 'mean_word_length': 1.484611080022384, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2701496', 'n_tokens_mistral': 1266, 'n_tokens_neox': 1247, 'n_words': 196}