remote_server_post_analytics: Change RealmDataForAnalytics.uuid type.

pydantic allows us to use UUID4 as a more accurate type.
This commit is contained in:
Mateusz Mandera 2023-11-22 18:22:22 +01:00 committed by Tim Abbott
parent c79f667116
commit 8695ffba49
2 changed files with 4 additions and 4 deletions

View File

@ -7,7 +7,7 @@ import requests
from django.conf import settings
from django.forms.models import model_to_dict
from django.utils.translation import gettext as _
from pydantic import BaseModel, ConfigDict
from pydantic import UUID4, BaseModel, ConfigDict
from analytics.models import InstallationCount, RealmCount
from version import ZULIP_VERSION
@ -39,7 +39,7 @@ class RealmDataForAnalytics(BaseModel):
date_created: float
deactivated: bool
uuid: str
uuid: UUID4
uuid_owner_secret: str
@ -191,7 +191,7 @@ def get_realms_info_for_push_bouncer() -> List[RealmDataForAnalytics]:
realm_info_list = [
RealmDataForAnalytics(
id=realm.id,
uuid=str(realm.uuid),
uuid=realm.uuid,
uuid_owner_secret=realm.uuid_owner_secret,
host=realm.host,
url=realm.uri,

View File

@ -531,7 +531,7 @@ def update_remote_realm_data_for_server(
uuids = [realm["uuid"] for realm in server_realms_info]
already_registered_remote_realms = RemoteRealm.objects.filter(uuid__in=uuids, server=server)
already_registered_uuids = {
str(remote_realm.uuid) for remote_realm in already_registered_remote_realms
remote_realm.uuid for remote_realm in already_registered_remote_realms
}
new_remote_realms = [