Add field description to the currency_exchange_retrieve API call (#7147)

* Add field description to the currency_exchange_retrieve API call

* Bump API version

* Do not call constuctor for the serializer exposed for extend schema in the CurrencyExchangeView
This commit is contained in:
Miklós Márton 2024-05-03 05:54:52 +02:00 committed by GitHub
parent 66c208c328
commit 60ddbe980e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 1 deletions

View File

@ -1,11 +1,14 @@
"""InvenTree API version information."""
# InvenTree API version
INVENTREE_API_VERSION = 193
INVENTREE_API_VERSION = 194
"""Increment this API version number whenever there is a significant change to the API that any clients need to know about."""
INVENTREE_API_TEXT = """
v194 - 2024-05-01 : https://github.com/inventree/InvenTree/pull/7147
- Adds field description to the currency_exchange_retrieve API call
v193 - 2024-04-30 : https://github.com/inventree/InvenTree/pull/7144
- Adds "assigned_to" filter to PurchaseOrder / SalesOrder / ReturnOrder API endpoints

View File

@ -127,6 +127,7 @@ class CurrencyExchangeView(APIView):
permission_classes = [permissions.IsAuthenticated]
serializer_class = None
@extend_schema(responses={200: common.serializers.CurrencyExchangeSerializer})
def get(self, request, format=None):
"""Return information on available currency conversions."""
# Extract a list of all available rates

View File

@ -125,6 +125,17 @@ class UserSettingsSerializer(SettingsSerializer):
user = serializers.PrimaryKeyRelatedField(read_only=True)
class CurrencyExchangeSerializer(serializers.Serializer):
"""Serializer for a Currency Exchange request.
It's only purpose is describing the results correctly in the API schema right now.
"""
base_currency = serializers.CharField(read_only=True)
exchange_rates = serializers.DictField(child=serializers.FloatField())
updated = serializers.DateTimeField(read_only=True)
class GenericReferencedSettingSerializer(SettingsSerializer):
"""Serializer for a GenericReferencedSetting model.