index.js
//Asks the questions to add a role, and adds it to the database
Asks the questions to add a role, and adds it to the database
Asks the questions to add a role and adds it to the database
function handleRoleAdd() {
    inquirer.prompt([
        {
            type: "input",
            message: enquiries.roleAdd.titleQuestion,
            name: "title"
        },
        {
            type: "input",
            message: enquiries.roleAdd.salaryQuestion,
            name: "salary",
            validate: function (salary) {
                checkNumber(salary)
                return /[1-9]/gi.test(salary);
            }
        },
        {
            type: "input",
            message: enquiries.roleAdd.departmentQuestion,
            name: "department",
            validate: function (department) {
                checkNumber(department)
                return /[1-9]/gi.test(department);
            }
        },
    ]
    )
        .then(function (response) {
            database.addRole(response.title, response.salary, response.department);
            console.log('\n')
            console.log('\n')
            console.log('Role added')
            startQuestioning();
        })
}
function handleRoleAdd ( ) { inquirer . prompt ( [ { type : "input" , message : enquiries . roleAdd . titleQuestion , name : "title" } , { type : "input" , message : enquiries . roleAdd . salaryQuestion , name : "salary" , validate : function ( salary ) { checkNumber ( salary ) return / [1-9] / gi . test ( salary ) ; } } , { type : "input" , message : enquiries . roleAdd . departmentQuestion , name : "department" , validate : function ( department ) { checkNumber ( department ) return / [1-9] / gi . test ( department ) ; } } , ] ) . then ( function ( response ) { database . addRole ( response . title , response . salary , response . department ) ; console . log ( '\n' ) console . log ( '\n' ) console . log ( 'Role added' ) startQuestioning ( ) ; } ) }
Asks the questions to add a role, and adds it to the database
Asks the questions to add a role and adds it to the database