Skip to content

Commit

Permalink
fix(hybrid-cloud): Resubmission: adds defaults to provisioning model …
Browse files Browse the repository at this point in the history
…fields, lost_password_hash model (#74766)

This reverts commit bb82492.
  • Loading branch information
GabeVillalobos committed Jul 24, 2024
1 parent be5e515 commit 858eae3
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pydantic
from sentry.hybridcloud.rpc import RpcModel


class RpcOrganizationSlugReservation(pydantic.BaseModel):
class RpcOrganizationSlugReservation(RpcModel):
id: int
organization_id: int
user_id: int | None
Expand Down
4 changes: 2 additions & 2 deletions src/sentry/services/organization/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class OrganizationOptions(pydantic.BaseModel):


class PostProvisionOptions(pydantic.BaseModel):
sentry_options: Any | None # Placeholder for any sentry post-provisioning data
getsentry_options: Any | None # Reserved for getsentry post-provisioning data
sentry_options: Any | None = None # Placeholder for any sentry post-provisioning data
getsentry_options: Any | None = None # Reserved for getsentry post-provisioning data


class OrganizationProvisioningOptions(pydantic.BaseModel):
Expand Down
7 changes: 5 additions & 2 deletions src/sentry/users/services/lost_password_hash/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
# in modules such as this one where hybrid cloud data models or service classes are
# defined, because we want to reflect on type annotations and avoid forward references.

import datetime
from datetime import datetime

from django.utils import timezone
from pydantic import Field

from sentry.hybridcloud.rpc import RpcModel
from sentry.models.lostpasswordhash import LostPasswordHash
Expand All @@ -13,7 +16,7 @@ class RpcLostPasswordHash(RpcModel):
id: int = -1
user_id: int = -1
hash: str = ""
date_added = datetime.datetime
date_added: datetime = Field(default_factory=timezone.now)

def get_absolute_url(self, mode: str = "recover") -> str:
return LostPasswordHash.get_lostpassword_url(self.user_id, self.hash, mode)
2 changes: 1 addition & 1 deletion tests/sentry/api/endpoints/test_event_ai_suggested_fix.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def dummy_response(*args, **kwargs):
finish_reason="stop",
)
],
created=time.time(),
created=int(time.time()),
model="gpt3.5-trubo",
object="chat.completion",
)
Expand Down
2 changes: 1 addition & 1 deletion tests/sentry/feedback/usecases/test_create_feedback.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def create_dummy_response(*args, **kwargs):
finish_reason="stop",
)
],
created=time.time(),
created=int(time.time()),
model="gpt3.5-trubo",
object="chat.completion",
)
Expand Down

0 comments on commit 858eae3

Please sign in to comment.