Skip to content

Commit

Permalink
Fix default updated_datetime (#120)
Browse files Browse the repository at this point in the history
To be within valid range for UTC date
  • Loading branch information
markwaddle authored Oct 15, 2024
1 parent 403572a commit fbcfbb5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ class Attachment(BaseModel):
filename: str
content: str
metadata: dict[str, Any]
updated_datetime: datetime.datetime = Field(default=datetime.datetime.min)
updated_datetime: datetime.datetime = Field(default=datetime.datetime.fromtimestamp(0, datetime.timezone.utc))
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,11 @@ async def _process_record(record: _Record) -> None:
# user participants should always be inactive on import
participant.active_participant = False
participant.status = None

await db.insert_if_not_exists(
session, db.User(user_id=participant.user_id, name="unknown imported user", service_user=False)
)

session.add(participant)

case db.Conversation.__name__:
Expand Down

0 comments on commit fbcfbb5

Please sign in to comment.