Refactor user ID handling to use UUIDs; update related components and serializers for consistency
This commit is contained in:
10
backend/server/main/utils.py
Normal file
10
backend/server/main/utils.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from rest_framework import serializers
|
||||
|
||||
def get_user_uuid(user):
|
||||
return str(user.uuid)
|
||||
|
||||
class CustomModelSerializer(serializers.ModelSerializer):
|
||||
def to_representation(self, instance):
|
||||
representation = super().to_representation(instance)
|
||||
representation['user_id'] = get_user_uuid(instance.user_id)
|
||||
return representation
|
||||
Reference in New Issue
Block a user