blob: 3f614a38739830805520a0f7aefa7661fabbb658 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
from ATRI.database import RssRsshubSubcription
class DB:
async def __aenter__(self):
return self
async def __aexit__(self, exc_type, exc_val, exc_tb):
pass
async def add_sub(self, _id: str, group_id: int):
await RssRsshubSubcription.create(_id=_id, group_id=group_id)
async def update_sub(self, _id, group_id, update_map: dict):
await RssRsshubSubcription.filter(_id=_id, group_id=group_id).update(
**update_map
)
async def del_sub(self, query_map: dict):
await RssRsshubSubcription.filter(**query_map).delete()
async def get_sub_list(self, query_map: dict) -> list:
return await RssRsshubSubcription.filter(**query_map)
async def get_all_subs(self) -> list:
return await RssRsshubSubcription.all()
|