Skip to content

Commit

Permalink
Serialize the kind's name
Browse files Browse the repository at this point in the history
Previously it was serializing as the value, which is the integer we're
using in the database.
  • Loading branch information
jonathansick committed May 22, 2024
1 parent f54a9e2 commit e9cc584
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
10 changes: 10 additions & 0 deletions keeper/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1012,6 +1012,16 @@ def mode_name(self) -> str:
else:
return self.default_mode_name

@property
def kind_name(self) -> str:
"""Name of the kind (`str`).
See also
--------
EditionKind
"""
return self.kind.name

def update_slug(self, new_slug: str) -> None:
"""Update the edition's slug by migrating files on S3.
Expand Down
6 changes: 3 additions & 3 deletions keeper/v2api/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from keeper.editiontracking import EditionTrackingModes
from keeper.exceptions import ValidationError
from keeper.models import EditionKind, OrganizationLayoutMode
from keeper.models import OrganizationLayoutMode
from keeper.utils import (
format_utc_datetime,
validate_path_slug,
Expand Down Expand Up @@ -575,7 +575,7 @@ class EditionResponse(BaseModel):
mode: str
"""The edition tracking mode."""

kind: EditionKind
kind: str
"""The edition kind."""

@classmethod
Expand Down Expand Up @@ -611,7 +611,7 @@ def from_edition(
"date_rebuilt": edition.date_rebuilt,
"date_ended": edition.date_ended,
"mode": edition.mode_name,
"kind": edition.kind,
"kind": edition.kind_name,
"tracked_ref": tracked_ref,
"pending_rebuild": edition.pending_rebuild,
"surrogate_key": edition.surrogate_key,
Expand Down

0 comments on commit e9cc584

Please sign in to comment.