Skip to content

Commit f85aa24

Browse files
committed
Expose the integer IDs in graphql as a separate databaseId field on all types
1 parent 522fcd1 commit f85aa24

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

aiarena/graphql/common.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ def resolve_total_count(self, *_) -> int:
4848

4949

5050
class DjangoObjectTypeWithUID(DjangoObjectType):
51+
database_id = graphene.Int(required=True, description="The underlying database primary key, for display purposes")
52+
5153
@classmethod
5254
def __init_subclass_with_meta__(
5355
cls,
@@ -62,6 +64,10 @@ def __init_subclass_with_meta__(
6264
**options,
6365
)
6466

67+
@staticmethod
68+
def resolve_database_id(root, info, **args):
69+
return root.id
70+
6571
class Meta:
6672
abstract = True
6773

0 commit comments

Comments
 (0)