Files
api-bashgah/apps/userprofile/selector.py
T
2026-06-15 10:57:28 +03:30

11 lines
398 B
Python

from apps.userprofile.models import UserProfile as UserProfileModel
from rest_framework.validators import ValidationError
def get_user_profile(user_id: int):
try:
return UserProfileModel.objects.get(cuser_id=user_id)
except UserProfileModel.DoesNotExist:
raise ValidationError("User profile does not exist")
except Exception as exp:
raise ValidationError(exp)