Remove Org.created_at to maintain compatibility with old versions (the field was not being used).

This commit is contained in:
2026-01-28 01:31:35 +00:00
parent aa58f08bc5
commit b08cca754f
2 changed files with 5 additions and 19 deletions
+2 -7
View File
@@ -264,9 +264,7 @@ def create_org(org: Org, *, ctx: SessionContext | None = None) -> None:
if org.uuid in _db.orgs:
raise ValueError(f"Organization {org.uuid} already exists")
with _db.transaction("admin:create_org", ctx):
new_org = Org(
display_name=org.display_name, created_at=datetime.now(timezone.utc)
)
new_org = Org(display_name=org.display_name)
_db.orgs[org.uuid] = new_org
new_org.uuid = org.uuid
# Create Administration role with org admin permission
@@ -885,10 +883,7 @@ def bootstrap(
_db.permissions[perm_org_admin_uuid] = perm_org_admin
# Create organization
new_org = Org(
display_name=org_name,
created_at=now,
)
new_org = Org(display_name=org_name)
new_org.uuid = org_uuid
_db.orgs[org_uuid] = new_org
+3 -12
View File
@@ -84,15 +84,9 @@ class Role(msgspec.Struct, dict=True, omit_defaults=True):
class Org(msgspec.Struct, dict=True):
"""Organization data structure.
Mutable fields: display_name
Immutable fields: created_at (set at creation, never modified)
uuid is derived from created_at using uuid7.
"""
"""Organization data structure."""
display_name: str
created_at: datetime
def __post_init__(self):
self.uuid: UUID = _UUID_UNSET # Convenience field, not serialized
@@ -100,11 +94,8 @@ class Org(msgspec.Struct, dict=True):
@classmethod
def create(cls, display_name: str) -> "Org":
"""Create a new Org with auto-generated uuid7."""
org = cls(
display_name=display_name,
created_at=datetime.now(timezone.utc),
)
org.uuid = uuid7.create(org.created_at)
org = cls(display_name=display_name)
org.uuid = uuid7.create()
return org