You can check this documentation. It explains well about Class Based Views in Fast API. And I guess it's official documentation, so this will gonna be correct way to use Classes for routers.
https://fastapi-utils.davidmontague.xyz/user-guide/class-based-views/