let express = require('express')
let router = express.Router()
var Recaptcha = require('express-recaptcha').RecaptchaV3;
const Errors = require('../lib/errors')

let {
    StaffApplications
} = require('../models')

router.post('/', async (req, res, next) => {
    try {
        throw Errors.noLongerHiring
        let userParams = {
            username: req.autosan.body.username,
            dob: req.autosan.body.dob,
            email: req.autosan.body.email,
            whyWork: req.autosan.body.whyWork,
            otherForm: req.autosan.body.otherForm,
            experience: req.autosan.body.experience,
            suggestions: req.autosan.body.suggestions,
            selectedOption: req.autosan.body.selectedOption,
        }
        await StaffApplications.create(userParams)
        res.json({ success: true })
    } catch (e) { next(e) }
})

module.exports = router;