Skip to content

Commit

Permalink
Add field description to the currency_exchange_retrieve API call (#7147)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
martonmiklos authored May 3, 2024
1 parent 66c208c commit 60ddbe9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/backend/InvenTree/InvenTree/api_version.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions src/backend/InvenTree/common/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions src/backend/InvenTree/common/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,17 @@ class Meta:
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.
Expand Down

0 comments on commit 60ddbe9

Please sign in to comment.