63 Zeilen
1.7 KiB
Python
63 Zeilen
1.7 KiB
Python
"""
|
|
Fingerprint repository interface.
|
|
"""
|
|
|
|
from abc import ABC, abstractmethod
|
|
from typing import Optional, List
|
|
from datetime import datetime
|
|
|
|
from domain.entities.browser_fingerprint import BrowserFingerprint
|
|
|
|
|
|
class IFingerprintRepository(ABC):
|
|
"""Interface for fingerprint persistence."""
|
|
|
|
@abstractmethod
|
|
def save(self, fingerprint: BrowserFingerprint) -> str:
|
|
"""Save a fingerprint and return its ID."""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def find_by_id(self, fingerprint_id: str) -> Optional[BrowserFingerprint]:
|
|
"""Find a fingerprint by ID."""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def find_by_account_id(self, account_id: str) -> Optional[BrowserFingerprint]:
|
|
"""Find a fingerprint associated with an account."""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def find_all(self) -> List[BrowserFingerprint]:
|
|
"""Find all fingerprints."""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def update(self, fingerprint: BrowserFingerprint) -> bool:
|
|
"""Update an existing fingerprint."""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def delete(self, fingerprint_id: str) -> bool:
|
|
"""Delete a fingerprint by ID."""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def find_by_platform(self, platform: str) -> List[BrowserFingerprint]:
|
|
"""Find all fingerprints for a specific platform."""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def exists(self, fingerprint_id: str) -> bool:
|
|
"""Check if a fingerprint exists."""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def count(self) -> int:
|
|
"""Count total fingerprints."""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def find_recent(self, limit: int = 10) -> List[BrowserFingerprint]:
|
|
"""Find most recently created fingerprints."""
|
|
pass |