Moved code to subfolder

This commit is contained in:
2023-03-10 09:21:27 +01:00
parent 69416eb896
commit b90fbdf668
12 changed files with 24 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
from typing import List
from models.request import Request
request_collection = Request
async def add_request(item: Request) -> Request:
return await item.create()
async def retrieve_requests() -> List[Request]:
return await request_collection.all().to_list()
async def retrieve_request(text: str, language_from: str, language_to: str) -> List[Request]:
return await request_collection.find({"requested_text": text, "language_from": language_from, "language_to": language_to}).to_list()
async def clear_requests() -> None:
return await request_collection.delete_all()