20 lines
697 B
Python
20 lines
697 B
Python
"""Доступ к подпискам на рассылки."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from common.db.pool import get_pool
|
|
|
|
|
|
async def subscribe(id_user: int) -> None:
|
|
"""Подписать пользователя на рассылки."""
|
|
async with get_pool().connection() as conn:
|
|
async with conn.cursor() as cur:
|
|
await cur.execute("CALL bot.subscribe(%s)", (id_user,))
|
|
|
|
|
|
async def unsubscribe(id_user: int) -> None:
|
|
"""Отписать пользователя от рассылок."""
|
|
async with get_pool().connection() as conn:
|
|
async with conn.cursor() as cur:
|
|
await cur.execute("CALL bot.unsubscribe(%s)", (id_user,))
|