update to get favicon from compontent by using the storage
Build and Push Docker Container / build-and-push (push) Successful in 1m36s

This commit is contained in:
2026-02-16 12:02:52 +01:00
parent e8e37e8967
commit 6137121209
4 changed files with 32 additions and 30 deletions
+22 -25
View File
@@ -1,28 +1,30 @@
from my_helpers.ConvexDbBase import ConvexDbBase
from my_helpers.db.convex.ConvexDbBase import ConvexDbBase
from my_helpers.db.convex.ConvexRuntime import ConvexRuntime
from my_modules.app.logger import logger
from convex import ConvexError, ConvexExecutionError
from datetime import datetime
class ConvexDB(ConvexDbBase):
service_namespace = 'nanoshare'
def __init__(self, dsn:str):
super().__init__(dsn=dsn, service=ConvexDB.service_namespace)
def __init__(self, runtime:ConvexRuntime):
super().__init__(
runtime=runtime,
service=ConvexDB.service_namespace
)
# File Quary Functions
async def get_file(self, file_id:str):
data = await self.run_query_with_reconnection(
self.client.query,
f"{self.service_namespace}/files:getByFileId",
data = await self.run_query(
name='files:getByFileId',
args={ 'file_id': file_id }
)
return data
async def get_files(self, user_id:str):
data = await self.run_query_with_reconnection(
self.client.query,
f"{self.service_namespace}/files:getAllNotExpired",
data = await self.run_query(
name='files:getAllNotExpired',
args={ 'user_id': user_id }
)
return [ {
@@ -43,24 +45,21 @@ class ConvexDB(ConvexDbBase):
if expires_at:
args['expires_at'] = expires_at.isoformat()
data = await self.run_query_with_reconnection(
self.client.mutation,
f"{self.service_namespace}/files:addNewFile",
data = await self.run_mutation(
name='files:addNewFile',
args=args,
)
return data
async def update_file(self, file_id:str, file_name:str, note:str, expires_at:datetime, user_id:str):
await self.run_query_with_reconnection(
self.client.mutation,
f"{self.service_namespace}/files:updateFile",
await self.run_mutation(
name='files:updateFile',
args={ 'file_id': file_id, 'file_name': file_name, 'note': note, 'expires_at': expires_at.isoformat(), 'user_id': user_id }
)
async def delete_file(self, file_id:str, user_id:str):
await self.run_query_with_reconnection(
self.client.mutation,
f"{self.service_namespace}/files:deleteFile",
await self.run_mutation(
name='files:deleteFile',
args={ 'file_id': file_id, 'user_id': user_id }
)
@@ -69,17 +68,15 @@ class ConvexDB(ConvexDbBase):
# File Access Quary Functions
async def add_file_access(self, file_id: str, ip_address:str, status:str, user_agent:str):
data = await self.run_query_with_reconnection(
self.client.mutation,
f"{self.service_namespace}/access:addNewAccess",
data = await self.run_mutation(
name='access:addNewAccess',
args={ 'file_id': file_id, 'ip_address': ip_address, 'user_agent': str(user_agent), 'status': status }
)
return data
async def get_all_access(self, user_id:str):
data = await self.run_query_with_reconnection(
self.client.query,
f"{self.service_namespace}/access:getAllByUser",
data = await self.run_query(
name='access:getAllByUser',
args={ 'user_id': user_id }
)
return data