added Id to secrets

This commit is contained in:
Gourav Kumar 2024-06-13 23:24:14 +05:30
parent 2593264d24
commit e359526b17
2 changed files with 3 additions and 2 deletions

View File

@ -133,6 +133,8 @@ async def create_secret(secret: Secret, current_user: dict = Depends(get_current
text = f.read() text = f.read()
if text: if text:
data.extend(json.loads(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'] secret.user_id = current_user['id']
encryption_key = current_user['encryption_key'].encode() encryption_key = current_user['encryption_key'].encode()

View File

@ -17,10 +17,9 @@ class UserLogin(BaseModel):
password: str password: str
class Secret(BaseModel): class Secret(BaseModel):
id: int = None
user_id: int = None user_id: int = None
data: str data: str
salt: str = None
notes: str = None
added_on: str = datetime.datetime.now(datetime.timezone.utc).isoformat() added_on: str = datetime.datetime.now(datetime.timezone.utc).isoformat()
modified_on: str = None modified_on: str = None
active: bool = True active: bool = True