You want the session to refresh automatically on the frontend after updating the userType in the database. The problem is that the navbar doesn't update until the user logs out and logs back in.
In your backend code, the session callback is updating the session correctly when the user logs in (after token creation), so no issues here.
On the frontend side, you tried refreshing the session manually on the client side using useSession() with update() to fetch the updated session after changing the userType and therefore updite the UI immediately. This is a good approach, and the issue you had was likely not calling update() after the database change or not handling the update correctly.