[feat] change str id type to UUID
This commit is contained in:
parent
e629e34c4d
commit
770af1fe76
11 changed files with 150 additions and 173 deletions
|
|
@ -2,6 +2,7 @@ from collections.abc import Mapping
|
|||
from datetime import datetime
|
||||
from types import TracebackType
|
||||
from typing import Protocol, TypeAlias
|
||||
from uuid import UUID
|
||||
|
||||
from domain.sandbox import SandboxSession
|
||||
from domain.user import User
|
||||
|
|
@ -19,13 +20,13 @@ class UserRepository(Protocol):
|
|||
|
||||
|
||||
class SandboxSessionRepository(Protocol):
|
||||
def get_active_by_chat_id(self, chat_id: str) -> SandboxSession | None: ...
|
||||
def get_active_by_chat_id(self, chat_id: UUID) -> SandboxSession | None: ...
|
||||
|
||||
def list_expired(self, now: datetime) -> list[SandboxSession]: ...
|
||||
|
||||
def save(self, session: SandboxSession) -> None: ...
|
||||
|
||||
def delete(self, session_id: str) -> None: ...
|
||||
def delete(self, session_id: UUID) -> None: ...
|
||||
|
||||
|
||||
class LockContext(Protocol):
|
||||
|
|
@ -40,15 +41,15 @@ class LockContext(Protocol):
|
|||
|
||||
|
||||
class SandboxLifecycleLocker(Protocol):
|
||||
def lock(self, chat_id: str) -> LockContext: ...
|
||||
def lock(self, chat_id: UUID) -> LockContext: ...
|
||||
|
||||
|
||||
class SandboxRuntime(Protocol):
|
||||
def create(
|
||||
self,
|
||||
*,
|
||||
session_id: str,
|
||||
chat_id: str,
|
||||
session_id: UUID,
|
||||
chat_id: UUID,
|
||||
created_at: datetime,
|
||||
expires_at: datetime,
|
||||
) -> SandboxSession: ...
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue