Closed Azimjonm2333 closed 1 month ago
Hi @Azimjonm2333,
Thank you for your suggestion! Your idea of creating a BaseAPIView
to reduce code duplication for CRUD operations is excellent. This approach would indeed simplify the code and make it more maintainable.
This class will handle the common CRUD logic for all models.
It will use generics and dynamic attributes to allow customization for each specific model.
CurrencyAPIView
to use BaseAPIView
:BaseAPIView
and set the required serializers and use cases.With these changes, any new API view for CRUD operations can inherit from BaseAPIView and define its own serializers, use cases, and input DTOs, significantly reducing code duplication.
Please let me know if you have any questions or further suggestions!
Best regards, @azizjon-aliev
I would like to suggest making one BaseAPIView at least for CRUD models For example you can see it in CurrencyAPIView If there are many models, there will be a lot of code duplication Why not do it like this
After that, we don't have to write a CRUD for the models every time like this: