added Id to secrets
This commit is contained in:
parent
2593264d24
commit
e359526b17
2
main.py
2
main.py
@ -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()
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user