Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/document/controller/DocumentAPIRouter.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
)

@router.get("", response_model=List[documentDetailDto])
async def getDocuments(user_id: uuid.UUID = Depends(get_current_user)):
async def getDocuments():
try:
return await get_documents(str(user_id))
return await get_documents()
except Exception as e:
raise HTTPException(status_code=500, detail=f"문서 목록 조회 중 문제 발생: {str(e)}")

Expand Down
8 changes: 8 additions & 0 deletions src/main/document/repository/document_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,11 @@ def get_documents_by_user(user_id: str) -> List[documentDetailDto]:
# user = document_collection.find_one({"_id":ObjectId(user_id)})

# return user[""]

def get_all_documents():
client = get_mongo_client()
db = client['xrpedia-data']
document_collection = db['document_collection']

documents = document_collection.find()
return list(documents)
6 changes: 3 additions & 3 deletions src/main/document/service/document_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#2. 이를 db에 저장한다.
#3. client에게 보낸다.

from src.main.document.repository.document_repository import save_document, get_document, get_documents_by_user
from src.main.document.repository.document_repository import get_all_documents, save_document, get_document, get_documents_by_user
from src.main.document.dto.document import saveDocument, documentRequestDto
from datetime import datetime
import asyncio
Expand Down Expand Up @@ -36,5 +36,5 @@ async def get_document_detail(document_id: str):
return get_document(document_id)

# 사용자의 모든 문서 목록 조회
async def get_documents(user_id: str):
return get_documents_by_user(user_id)
async def get_documents():
return get_all_documents()