Skip to content

Commit

Permalink
Merge pull request #59 from ambujraj/dev
Browse files Browse the repository at this point in the history
added appwrite id in db
  • Loading branch information
ambujraj authored Mar 2, 2024
2 parents e3b05b8 + 8c3c122 commit 38bc60d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions middleware/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from storage.cloudflare_r2 import CloudflareR2Manager
from enum import Enum as PythonEnum
from datetime import datetime, timedelta, timezone
from pydantic import BaseModel
from pydantic import BaseModel, Field
from dotenv import load_dotenv
import uuid
import qrcode
Expand Down Expand Up @@ -72,10 +72,12 @@ class PostUpload(BaseModel):


class AddUser(BaseModel):
id: str = Field(..., alias="$id")
name: str
registration: str
email: str


class Feedback(BaseModel):
name: str
email: str
Expand Down Expand Up @@ -326,6 +328,7 @@ def post_upload_return_link_qr(body: PostUpload, upload_id: str):
"downloads_allowed": str(upload_metadata["max_download"]),
}


@app.post("/feedback")
def post_feedback(body: Feedback):
"""
Expand All @@ -340,12 +343,12 @@ def post_feedback(body: Feedback):
Returns:
- None
"""

feedback = {
"feedback_id": uuid.uuid4().hex,
"email": body.email,
"name": body.name,
"message": body.message
"message": body.message,
}
feedback_dynamodb.create_item(feedback)

Expand All @@ -367,6 +370,7 @@ def webhook_post_user_send_email(body: AddUser):

user = {
"user_id": uuid.uuid4().hex,
"appwrite_id": body.id,
"email": body.email,
"created_at": body.registration,
}
Expand Down

0 comments on commit 38bc60d

Please sign in to comment.