let express = require('express')
let router = express.Router()
const auth = require('../lib/auth')

const Errors = require('../lib/errors.js')
let AdminToken = require('../models').AdminToken
let AuditLog = require('../models').AuditLog

router.post('/', auth, async(req, res, next) => {
	try {
		AuditLog.create({UserId: req.userData.UserId, action: req.userData.username + ' attempted to use a deprecated administration route (admin token)'})
		if(!req.userData.loggedIn && !req.userData.admin) {
			throw Errors.requestNotAuthorized
		} else {
			throw Errors.requestNotAuthorized
		}
	} catch (err) { next(err) }
})

module.exports = router
