my below code work fine and i can create some data on database with that, but after that i need to get latest inserted id from that to use in other place of code, but this function which exported return promise object and i can't assign variable as function result, for example:
module.exports = {
    createNewUser: function (model) {
        return new Promise((resolve, reject) => {
            return model.create(
                {
                    username: 'John'
                })
                .then(function (result) {
                    return result.userUniqueId;
                })
                .then(value => resolve(value));
        });
    },
};
return Promise object and i can't assign variable with returned result as
return result.userUniqueId;
i want to get result and print or assign variable as the result with this code:
console.log( controller.createNewUser( models.users ) );
 
    