mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-07-21 22:09:36 +02:00
Refactor user ID handling to use UUIDs; update related components and serializers for consistency
This commit is contained in:
parent
129c76078e
commit
86d213bb8b
18 changed files with 78 additions and 46 deletions
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
|
Loading…
Add table
Add a link
Reference in a new issue