api: getuserstat

refactor large parts of userstat and make it accesible from api