fix: generate valid ObjectId for audit log entries
default_factory=PyObjectId produced "" (empty string) since Annotated[str, ...] is a type annotation, not a callable factory. Replace with lambda: str(ObjectId()) to generate a real unique ID. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
0d46c1440c
commit
e48d63bdbd
1 changed files with 1 additions and 1 deletions
|
|
@ -86,7 +86,7 @@ class AuditLogSeverity(str, Enum):
|
|||
class AuditLog(BaseModel):
|
||||
"""Audit log entry model."""
|
||||
|
||||
id: Optional[PyObjectId] = Field(default_factory=PyObjectId, alias="_id")
|
||||
id: Optional[PyObjectId] = Field(default_factory=lambda: str(ObjectId()), alias="_id")
|
||||
|
||||
# Core audit fields
|
||||
timestamp: datetime = Field(default_factory=datetime.utcnow)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue