centrailized db connection usage
add tests for api/login
fixed build warnings