mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-11-15 11:14:28 +00:00
a21121308f
* Cleanup little-boxes stuff * Force html5lib for parsing OG data * Bugfixes
27 lines
600 B
Python
27 lines
600 B
Python
from enum import Enum
|
|
from enum import unique
|
|
from typing import Any
|
|
from typing import Dict
|
|
from typing import Optional
|
|
|
|
from config import DB
|
|
|
|
_Q = Dict[str, Any]
|
|
_Doc = Optional[Dict[str, Any]]
|
|
|
|
|
|
@unique
|
|
class CollectionName(Enum):
|
|
ACTIVITIES = "activities"
|
|
|
|
|
|
def find_one_activity(q: _Q) -> _Doc:
|
|
return DB[CollectionName.ACTIVITIES.value].find_one(q)
|
|
|
|
|
|
def update_one_activity(q: _Q, update: _Q) -> None:
|
|
DB[CollectionName.ACTIVITIES.value].update_one(q, update)
|
|
|
|
|
|
def update_many_activities(q: _Q, update: _Q) -> None:
|
|
DB[CollectionName.ACTIVITIES.value].update_many(q, update)
|