refactor database connection and implement upload album rights