fix: account insert

This commit is contained in:
Vlad Stan
2024-10-10 09:08:22 +02:00
committed by dni ⚡
parent f923ecdefd
commit f54c78a58d
2 changed files with 2 additions and 13 deletions
+2 -3
View File
@@ -1,5 +1,4 @@
import json
from datetime import datetime
from time import time
from typing import Literal, Optional, Union
from uuid import uuid4
@@ -40,14 +39,14 @@ async def create_account(
conn: Optional[Connection] = None,
) -> Account:
if not account:
now = datetime.now()
now = int(time())
account = Account(id=uuid4().hex, created_at=now, updated_at=now)
await (conn or db).insert("accounts", account)
return account
async def update_account(account: Account) -> Account:
account.updated_at = datetime.now()
account.updated_at = int(time())
await db.update("accounts", account)
return account
-10
View File
@@ -565,13 +565,3 @@ async def m023_add_column_column_to_apipayments(db):
async def m024_drop_pending(db):
await db.execute("ALTER TABLE apipayments DROP COLUMN pending")
async def m025_add_pubkey_to_accounts(db):
"""
Adds pubkey column to accounts.
"""
try:
await db.execute("ALTER TABLE accounts ADD COLUMN pubkey TEXT")
except OperationalError:
pass