Skip to content

bovine_store.utils

add_sub_collections(obj)

Adds the subcollections replies, shares, and likes to the object given by obj

Source code in bovine_store/bovine_store/utils/__init__.py
def add_sub_collections(obj: dict) -> dict:
    """Adds the subcollections replies, shares, and likes to the
    object given by obj"""

    obj_type = obj.get("type")
    obj_id = obj.get("id")
    if obj_type not in ["Note", "Article", "Page"] or not obj_id:
        return obj

    for key in ["replies", "shares", "likes"]:
        obj[key] = f"{obj_id}/{key}"

    return obj