diff --git a/equipment_tracker/schema.yml b/equipment_tracker/schema.yml index 3dbb1ad..190c3e3 100644 --- a/equipment_tracker/schema.yml +++ b/equipment_tracker/schema.yml @@ -603,7 +603,6 @@ paths: - api security: - jwtAuth: [] - - {} responses: '200': content: @@ -631,7 +630,6 @@ paths: required: true security: - jwtAuth: [] - - {} responses: '201': content: @@ -652,7 +650,6 @@ paths: - api security: - jwtAuth: [] - - {} responses: '200': content: @@ -676,7 +673,6 @@ paths: - api security: - jwtAuth: [] - - {} responses: '200': content: @@ -709,7 +705,6 @@ paths: required: true security: - jwtAuth: [] - - {} responses: '200': content: @@ -741,7 +736,6 @@ paths: $ref: '#/components/schemas/PatchedEquipmentInstance' security: - jwtAuth: [] - - {} responses: '200': content: @@ -762,7 +756,6 @@ paths: - api security: - jwtAuth: [] - - {} responses: '204': description: No response body @@ -773,7 +766,6 @@ paths: - api security: - jwtAuth: [] - - {} responses: '200': content: @@ -790,7 +782,6 @@ paths: - api security: - jwtAuth: [] - - {} responses: '200': content: @@ -807,7 +798,6 @@ paths: - api security: - jwtAuth: [] - - {} responses: '200': content: @@ -824,7 +814,6 @@ paths: - api security: - jwtAuth: [] - - {} responses: '200': content: @@ -852,7 +841,6 @@ paths: required: true security: - jwtAuth: [] - - {} responses: '201': content: @@ -873,7 +861,6 @@ paths: - api security: - jwtAuth: [] - - {} responses: '200': content: @@ -897,7 +884,6 @@ paths: - api security: - jwtAuth: [] - - {} responses: '200': content: @@ -930,7 +916,6 @@ paths: required: true security: - jwtAuth: [] - - {} responses: '200': content: @@ -962,7 +947,6 @@ paths: $ref: '#/components/schemas/PatchedEquipment' security: - jwtAuth: [] - - {} responses: '200': content: @@ -983,7 +967,6 @@ paths: - api security: - jwtAuth: [] - - {} responses: '204': description: No response body @@ -994,7 +977,6 @@ paths: - api security: - jwtAuth: [] - - {} responses: '200': content: @@ -1011,7 +993,6 @@ paths: - api security: - jwtAuth: [] - - {} responses: '200': content: @@ -1296,7 +1277,7 @@ components: $ref: '#/components/schemas/StatusEnum' remarks: type: string - maxLength: 512 + nullable: true last_updated: type: string format: date-time @@ -1551,7 +1532,7 @@ components: $ref: '#/components/schemas/StatusEnum' remarks: type: string - maxLength: 512 + nullable: true last_updated: type: string format: date-time diff --git a/equipment_tracker/transactions/serializers.py b/equipment_tracker/transactions/serializers.py index eaad849..4eb567f 100644 --- a/equipment_tracker/transactions/serializers.py +++ b/equipment_tracker/transactions/serializers.py @@ -5,6 +5,7 @@ from .models import Transaction from breakages.models import BreakageReport from accounts.models import CustomUser from config.settings import DEBUG +from django.core.cache import cache class CustomUserSerializer(serializers.ModelSerializer): @@ -128,6 +129,7 @@ class TransactionSerializer(serializers.HyperlinkedModelSerializer): return transaction def update(self, instance, validated_data): + cache.delete('non_finalized_transactions') user = self.context['request'].user # User Validation @@ -248,6 +250,8 @@ class TransactionSerializer(serializers.HyperlinkedModelSerializer): # This updates the status field of all equipment instances in a single query EquipmentInstance.objects.filter( id__in=[equipment.id for equipment in equipments]).update(status='Available') + cache.delete('available_equipment_instances') + cache.delete('equipment_instances') return super().update(instance, validated_data) # If the transaction changes from Returned: Pending Checking to With Breakages, we create a Breakage Report instance