From e359526b176e497bd26add197583ee0d12b0888c Mon Sep 17 00:00:00 2001 From: gourav Date: Thu, 13 Jun 2024 23:24:14 +0530 Subject: [PATCH] added Id to secrets --- main.py | 2 ++ models.py | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index f02364f..093b13f 100644 --- a/main.py +++ b/main.py @@ -133,6 +133,8 @@ async def create_secret(secret: Secret, current_user: dict = Depends(get_current text = f.read() if text: data.extend(json.loads(text)) + secret_id = max(i['id'] for i in data) + 1 + secret.id = secret_id secret.user_id = current_user['id'] encryption_key = current_user['encryption_key'].encode() diff --git a/models.py b/models.py index 978e30e..1ae7df7 100644 --- a/models.py +++ b/models.py @@ -17,10 +17,9 @@ class UserLogin(BaseModel): password: str class Secret(BaseModel): + id: int = None user_id: int = None data: str - salt: str = None - notes: str = None added_on: str = datetime.datetime.now(datetime.timezone.utc).isoformat() modified_on: str = None active: bool = True