fix some errors

This commit is contained in:
user 2024-08-11 16:00:57 +03:00
parent 6f5082b860
commit 78bf9ffec8
2 changed files with 10 additions and 3 deletions

View File

@ -91,7 +91,7 @@ async def s_api_v1_auth_twa(request):
make_log("auth", f"Invalid ton_proof: {e}", level="warning")
return response.json({"error": "Invalid ton_proof"}, status=400)
ton_connection = (await request.ctx.db_session.execute(select(WalletConnection).where(
ton_connection = (request.ctx.db_session.execute(select(WalletConnection).where(
and_(
WalletConnection.user_id == known_user.id,
WalletConnection.network == 'ton',

View File

@ -114,14 +114,21 @@ class StoredContent(AlchemyBase, AudioContentMixin):
]:
extra_fields[k] = self.meta.get(k, None)
spec_field_updated = self.updated.isoformat() if isinstance(self.updated, datetime) else (
datetime.fromisoformat(self.updated).isoformat() if isinstance(self.updated, str) else None
)
spec_field_created = self.created.isoformat() if isinstance(self.created, datetime) else (
datetime.fromisoformat(self.created).isoformat() if isinstance(self.created, str) else None
)
return {
**extra_fields,
"hash": self.hash,
"cid": self.cid.serialize_v2(),
"content_type": self.meta.get('content_type', 'application/x-binary'),
"status": self.status,
"updated": self.updated.isoformat() if isinstance(self.updated, datetime) else (make_log("Content.json_format", f"Invalid Content.updated: {self.updated} ({type(self.updated)})", level="error") or None),
"created": self.created.isoformat() if isinstance(self.created, datetime) else (make_log("Content.json_format", f"Invalid Content.created: {self.created} ({type(self.created)})", level="error") or None),
"created": spec_field_created,
"updated": spec_field_updated,
}
@classmethod