Skip to content

Commit

Permalink
Expose organization user created timestamp in members endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
rajpatel24 committed Dec 5, 2024
1 parent 6cac659 commit 68f1a8b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
6 changes: 2 additions & 4 deletions kobo/apps/organizations/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@


class OrganizationUserSerializer(serializers.ModelSerializer):
created = serializers.DateTimeField(format='%Y-%m-%dT%H:%M:%SZ')
user = serializers.HyperlinkedRelatedField(
queryset=get_user_model().objects.all(),
lookup_field='username',
Expand All @@ -25,9 +26,6 @@ class OrganizationUserSerializer(serializers.ModelSerializer):
source='has_mfa_enabled', read_only=True
)
url = serializers.SerializerMethodField()
date_joined = serializers.DateTimeField(
source='user.date_joined', format='%Y-%m-%dT%H:%M:%SZ'
)
user__username = serializers.ReadOnlyField(source='user.username')
user__extra_details__name = serializers.ReadOnlyField(
source='user.extra_details.data.name'
Expand All @@ -45,7 +43,7 @@ class Meta:
'user__extra_details__name',
'role',
'user__has_mfa_enabled',
'date_joined',
'created',
'user__is_active'
]

Expand Down
8 changes: 4 additions & 4 deletions kobo/apps/organizations/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ class OrganizationMemberViewSet(viewsets.ModelViewSet):
> "user__name": "Foo Bar",
> "role": "owner",
> "user__has_mfa_enabled": true,
> "date_joined": "2024-08-11T12:36:32Z",
> "created": "2024-08-11T12:36:32Z",
> "user__is_active": true
> },
> {
Expand All @@ -324,7 +324,7 @@ class OrganizationMemberViewSet(viewsets.ModelViewSet):
> "user__name": "John Doe",
> "role": "admin",
> "user__has_mfa_enabled": false,
> "date_joined": "2024-10-21T06:38:45Z",
> "created": "2024-10-21T06:38:45Z",
> "user__is_active": true
> }
> ]
Expand Down Expand Up @@ -353,7 +353,7 @@ class OrganizationMemberViewSet(viewsets.ModelViewSet):
> "user__name": "Foo Bar",
> "role": "owner",
> "user__has_mfa_enabled": true,
> "date_joined": "2024-08-11T12:36:32Z",
> "created": "2024-08-11T12:36:32Z",
> "user__is_active": true
> }
Expand Down Expand Up @@ -389,7 +389,7 @@ class OrganizationMemberViewSet(viewsets.ModelViewSet):
> "user__name": "Foo Bar",
> "role": "admin",
> "user__has_mfa_enabled": true,
> "date_joined": "2024-08-11T12:36:32Z",
> "created": "2024-08-11T12:36:32Z",
> "user__is_active": true
> }
Expand Down

0 comments on commit 68f1a8b

Please sign in to comment.