2019-08-01 15:24:18 -05:00
|
|
|
from enum import Enum
|
|
|
|
from enum import unique
|
|
|
|
from typing import Any
|
2019-08-01 15:25:58 -05:00
|
|
|
from typing import Dict
|
2019-08-01 15:24:18 -05:00
|
|
|
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)
|
2019-08-04 09:34:30 -05:00
|
|
|
|
|
|
|
|
|
|
|
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)
|