feat: subs and views
This commit is contained in:
@@ -22,6 +22,7 @@ from .purchase.delete_purchase import delete_purchase
|
||||
from .purchase.get_purchase import get_purchase
|
||||
from .purchase.get_purchases import get_purchases
|
||||
from .purchase.update_purchase import update_purchase
|
||||
from .subscription.handle_subscription import handle_subscription
|
||||
from .target_channel.connect_target_chan import connect_target_chan
|
||||
from .target_channel.disconnect_target_chan import disconnect_target_chan
|
||||
from .target_channel.disconnect_target_chan_by_tg_id import disconnect_target_chan_by_tg_id
|
||||
@@ -29,6 +30,9 @@ from .target_channel.get_user_target_chans import get_user_target_chans
|
||||
from .target_channel.update_target_chan_permissions import update_target_chan_permissions
|
||||
from .telegram_login import telegram_login
|
||||
from .validate_login_token import validate_login_token
|
||||
from .views.fetch_views import fetch_views
|
||||
from .views.get_views_history import get_views_history
|
||||
from .views.update_views_manually import update_views_manually
|
||||
|
||||
|
||||
class Database(typing.Protocol):
|
||||
@@ -110,6 +114,24 @@ class Database(typing.Protocol):
|
||||
|
||||
async def check_creative_in_use(self, creative_id: UUID) -> bool: ...
|
||||
|
||||
async def get_purchase_by_invite_link(self, invite_link: str) -> domain.Purchase | None: ...
|
||||
|
||||
async def create_subscription(self, subscription: domain.Subscription) -> domain.Subscription: ...
|
||||
|
||||
async def get_subscription_by_user_and_purchase(
|
||||
self, user_telegram_id: int, purchase_id: UUID
|
||||
) -> domain.Subscription | None: ...
|
||||
|
||||
async def create_views_snapshot(self, snapshot: domain.ViewsSnapshot) -> domain.ViewsSnapshot: ...
|
||||
|
||||
async def get_views_history(
|
||||
self,
|
||||
purchase_id: UUID,
|
||||
*,
|
||||
from_date: datetime.datetime | None = None,
|
||||
to_date: datetime.datetime | None = None,
|
||||
) -> list[domain.ViewsSnapshot]: ...
|
||||
|
||||
|
||||
class TelegramWriter(typing.Protocol):
|
||||
async def send_message(self, text: str, chat_id: int) -> None: ...
|
||||
@@ -120,6 +142,8 @@ class TelegramWriter(typing.Protocol):
|
||||
|
||||
async def create_chat_invite_link(self, chat_id: int, requires_approval: bool = False) -> str: ...
|
||||
|
||||
async def get_post_views(self, post_url: str) -> int | None: ... # None если не удалось получить
|
||||
|
||||
|
||||
class JWTEncoder(typing.Protocol):
|
||||
def encode_access_token(self, user_id: UUID, telegram_id: int, username: str | None = None) -> str: ...
|
||||
@@ -155,3 +179,7 @@ class Usecase:
|
||||
update_purchase = update_purchase
|
||||
archive_purchase = archive_purchase
|
||||
delete_purchase = delete_purchase
|
||||
handle_subscription = handle_subscription
|
||||
fetch_views = fetch_views
|
||||
get_views_history = get_views_history
|
||||
update_views_manually = update_views_manually
|
||||
|
||||
Reference in New Issue
Block a user