add working accessed quary and rename fields in html template
Build and Push Docker Container / build-and-push (push) Successful in 1m37s

This commit is contained in:
2025-12-22 14:00:02 +01:00
parent fefda61c0b
commit 410e09a980
2 changed files with 5 additions and 31 deletions
+3 -29
View File
@@ -79,36 +79,10 @@ class ConvexDB(ConvexDbBase):
async def get_all_access(self, user_id:str): async def get_all_access(self, user_id:str):
data = await self.run_query_with_reconnection( data = await self.run_query_with_reconnection(
self.client.query, self.client.query,
""" f"{self.service_namespace}/access:getAllByUser",
select files { args={ 'user_id': user_id }
file_id,
file_name,
note,
accesses: {
at,
status,
ip: {
value
},
user_agent: {
value
}
}
order by .at desc
}
filter .user_id = <str>$user_id
""",
user_id=user_id
) )
return sorted([{ return data
"file_id": file.file_id,
"file_name": file.file_name,
"file_note": file.note,
"status": access.status,
"ip": access.ip.value,
"user_agent": access.user_agent.value,
"accessed_at": access.at,
} for file in data for access in file.accesses], key=lambda x: x["accessed_at"], reverse=True)
async def get_file_access(self, file_id: str): async def get_file_access(self, file_id: str):
data = await self.run_query_with_reconnection( data = await self.run_query_with_reconnection(
+2 -2
View File
@@ -35,7 +35,7 @@
</td> </td>
<td>{{ access.file_note }}</td> <td>{{ access.file_note }}</td>
<td><span class="badge">{{ access.status }}</span></td> <td><span class="badge">{{ access.status }}</span></td>
<td>{{ access.ip }}</td> <td>{{ access.ip_address }}</td>
<td>{{ access.user_agent }}</td> <td>{{ access.user_agent }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
@@ -65,7 +65,7 @@
const datetime = timeEl.getAttribute("datetime"); const datetime = timeEl.getAttribute("datetime");
if (!datetime) return; if (!datetime) return;
const date = new Date(datetime); const date = new Date(Number.parseInt(datetime));
timeEl.title = date.toISOString(); timeEl.title = date.toISOString();
timeEl.textContent = date.toLocaleString(undefined, { timeEl.textContent = date.toLocaleString(undefined, {