Spaces:
Paused
Paused
Update backend/mongodb/operations/calls.py
Browse files
backend/mongodb/operations/calls.py
CHANGED
|
@@ -3,6 +3,13 @@ from fastapi.encoders import jsonable_encoder
|
|
| 3 |
import sys
|
| 4 |
from ..models.calls import UpdateCall, UserCall, UserCaptions
|
| 5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
def list_calls(collection, limit: int):
|
| 8 |
try:
|
|
|
|
| 3 |
import sys
|
| 4 |
from ..models.calls import UpdateCall, UserCall, UserCaptions
|
| 5 |
|
| 6 |
+
# Used within calls to create call record in main.py
|
| 7 |
+
def create_calls(collection, user: UserCall = Body(...)):
|
| 8 |
+
calls = jsonable_encoder(user)
|
| 9 |
+
new_calls = collection.insert_one(calls)
|
| 10 |
+
created_calls = collection.find_one({"_id": new_calls.inserted_id})
|
| 11 |
+
|
| 12 |
+
return created_calls
|
| 13 |
|
| 14 |
def list_calls(collection, limit: int):
|
| 15 |
try:
|