diff options
author | Kristofer Hallin <kristofer@sunet.se> | 2021-11-26 11:47:19 +0100 |
---|---|---|
committer | Kristofer Hallin <kristofer@sunet.se> | 2021-11-26 11:47:19 +0100 |
commit | a63a27f40a36224f7e596d730d014946253aa297 (patch) | |
tree | 4c132483e4e520f1797b5fd3e6c3bc957925fa4d /src/main.py | |
parent | e1ec5ae2b30e6a7560c20ad162029b1d6c9fad4e (diff) |
* Now possible to remove documents, new /delete endpoint.
* More unittests.
Diffstat (limited to 'src/main.py')
-rwxr-xr-x | src/main.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main.py b/src/main.py index 609433b..fef4050 100755 --- a/src/main.py +++ b/src/main.py @@ -24,6 +24,8 @@ app.add_middleware( ) # TODO: X-Total-Count + + @app.middleware("http") async def mock_x_total_count_header(request: Request, call_next): response = await call_next(request) @@ -153,6 +155,16 @@ async def add(data: Request, Authorize: AuthJWT = Depends()): return JSONResponse(content={"status": "success", "docs": key}) +@app.delete('/sc/v0/delete/{key}') +async def delete(key): + if db.delete(key) is None: + return JSONResponse(content={"status": "error", + "message": "Document not found"}, + status_code=400) + + return JSONResponse(content={"status": "success", "docs": {}}) + + def main(standalone=False): if not standalone: return app |