diff --git a/__pycache__/main.cpython-39.pyc b/__pycache__/main.cpython-39.pyc index 6f8979c..dd67d31 100644 Binary files a/__pycache__/main.cpython-39.pyc and b/__pycache__/main.cpython-39.pyc differ diff --git a/block_lists/__pycache__/models.cpython-39.pyc b/block_lists/__pycache__/models.cpython-39.pyc index 404311a..9d28708 100644 Binary files a/block_lists/__pycache__/models.cpython-39.pyc and b/block_lists/__pycache__/models.cpython-39.pyc differ diff --git a/block_lists/__pycache__/routes.cpython-39.pyc b/block_lists/__pycache__/routes.cpython-39.pyc index fa4e1fe..97b1ab2 100644 Binary files a/block_lists/__pycache__/routes.cpython-39.pyc and b/block_lists/__pycache__/routes.cpython-39.pyc differ diff --git a/block_lists/models.py b/block_lists/models.py index aeac919..f5f87ff 100644 --- a/block_lists/models.py +++ b/block_lists/models.py @@ -11,13 +11,13 @@ class ListType(str, Enum): class Site(BaseModel): site_url: str - comment: str = None + # comment: str = None created: datetime = datetime.now(timezone.utc) class BlockList(BaseModel): name: str - comment: str = None + # comment: str = None type: ListType = Field(default="black_list") created: datetime = datetime.now(timezone.utc) sites: List[Site] = [] @@ -26,7 +26,7 @@ class BlockList(BaseModel): class SiteResponse(BaseModel): id: str site_url: str - comment: str = None + # comment: str = None created: datetime updated: Optional[datetime] = None @@ -36,7 +36,7 @@ class BlockListResponse(BaseModel): name: str owner: str type: ListType - comment: str = None + # comment: str = None sites: List[SiteResponse] = [] created: datetime updated: Optional[datetime] = None diff --git a/block_lists/routes.py b/block_lists/routes.py index 9313e56..53e813e 100644 --- a/block_lists/routes.py +++ b/block_lists/routes.py @@ -32,7 +32,7 @@ async def create_block_list(block_list: BlockList, user=Depends(get_current_user res = BlockListResponse( id=id, name=block_list.name, - comment=block_list.comment, + # comment=block_list.comment, type=block_list.type, created=block_list.created, owner=owner, @@ -70,7 +70,7 @@ async def get_user_block_lists(user=Depends(get_current_user)) -> List[BlockList owner=owner, name=block_list["name"], type=block_list["type"], - comment=block_list["comment"], + # comment=block_list["comment"], created=block_list["created"], updated=block_list.get("updated"), sites=[SiteResponse( @@ -103,9 +103,15 @@ async def get_single_block_list(id: str) -> BlockListResponse: sites=[SiteResponse( id=site["id"], site_url=site["site_url"], - comment=site["comment"], + # comment=site["comment"], created=site["created"], updated=site.get("updated") ) for site in block_list["sites"]] ) return res + + +@router.delete("/{id}", status_code=200, description="Delete Blocklist", dependencies=[Depends(get_current_user)]) +def delete_block_list(id: str): + db["block_lists"].delete_one({"_id": id}) + return {"message": "List deleted successfully!"}