Skip to content

Commit 86162a7

Browse files
authored
[Fix] 자료 전체 보기는 모든 자료를 조회해야 함 (#29)
## 작업 내역 (관련 이슈) - #28 ## 특이 사항 -
2 parents 8fcfb79 + 92dec5d commit 86162a7

3 files changed

Lines changed: 13 additions & 5 deletions

File tree

src/main/document/controller/DocumentAPIRouter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
)
1313

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

src/main/document/repository/document_repository.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,11 @@ def get_documents_by_user(user_id: str) -> List[documentDetailDto]:
7676
# user = document_collection.find_one({"_id":ObjectId(user_id)})
7777

7878
# return user[""]
79+
80+
def get_all_documents():
81+
client = get_mongo_client()
82+
db = client['xrpedia-data']
83+
document_collection = db['document_collection']
84+
85+
documents = document_collection.find()
86+
return list(documents)

src/main/document/service/document_service.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#2. 이를 db에 저장한다.
33
#3. client에게 보낸다.
44

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

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

0 commit comments

Comments
 (0)