List all documents Query Parameters: include_l0 (bool): Whether to include L0 data (chunks and embeddings)
()
| 20 | |
| 21 | @document_bp.route("/documents/list", methods=["GET"]) |
| 22 | def list_documents(): |
| 23 | """ |
| 24 | List all documents |
| 25 | Query Parameters: |
| 26 | include_l0 (bool): Whether to include L0 data (chunks and embeddings) |
| 27 | """ |
| 28 | try: |
| 29 | # get query params |
| 30 | include_l0 = request.args.get("include_l0", "").lower() == "true" |
| 31 | if include_l0: |
| 32 | documents = document_service.list_documents_with_l0() |
| 33 | return jsonify(APIResponse.success(data=documents)) |
| 34 | else: |
| 35 | documents = document_service.list_documents() |
| 36 | return jsonify( |
| 37 | APIResponse.success(data=[doc.to_dict() for doc in documents]) |
| 38 | ) |
| 39 | except Exception as e: |
| 40 | logger.error(f"Error listing documents: {str(e)}", exc_info=True) |
| 41 | return jsonify(APIResponse.error(message=f"Error listing documents: {str(e)}")) |
| 42 | |
| 43 | |
| 44 | @document_bp.route("/documents/scan", methods=["POST"]) |
nothing calls this directly
no test coverage detected