add working accessed quary and rename fields in html template
Build and Push Docker Container / build-and-push (push) Successful in 1m37s
Build and Push Docker Container / build-and-push (push) Successful in 1m37s
This commit is contained in:
@@ -79,36 +79,10 @@ class ConvexDB(ConvexDbBase):
|
||||
async def get_all_access(self, user_id:str):
|
||||
data = await self.run_query_with_reconnection(
|
||||
self.client.query,
|
||||
"""
|
||||
select files {
|
||||
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
|
||||
f"{self.service_namespace}/access:getAllByUser",
|
||||
args={ 'user_id': user_id }
|
||||
)
|
||||
return sorted([{
|
||||
"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)
|
||||
return data
|
||||
|
||||
async def get_file_access(self, file_id: str):
|
||||
data = await self.run_query_with_reconnection(
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
</td>
|
||||
<td>{{ access.file_note }}</td>
|
||||
<td><span class="badge">{{ access.status }}</span></td>
|
||||
<td>{{ access.ip }}</td>
|
||||
<td>{{ access.ip_address }}</td>
|
||||
<td>{{ access.user_agent }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
@@ -65,7 +65,7 @@
|
||||
const datetime = timeEl.getAttribute("datetime");
|
||||
if (!datetime) return;
|
||||
|
||||
const date = new Date(datetime);
|
||||
const date = new Date(Number.parseInt(datetime));
|
||||
|
||||
timeEl.title = date.toISOString();
|
||||
timeEl.textContent = date.toLocaleString(undefined, {
|
||||
|
||||
Reference in New Issue
Block a user