|
@@ -1,7 +1,7 @@
|
|
|
import io
|
|
|
import json
|
|
|
import time
|
|
|
-import uuid
|
|
|
+from datetime import datetime, timedelta, timezone
|
|
|
import app.crud as crud
|
|
|
from fastapi import APIRouter, File, UploadFile, Form, Depends
|
|
|
from sqlalchemy.orm import Session
|
|
@@ -57,9 +57,12 @@ def upload_file(file: UploadFile = File(...), project_id: str=Form(...), file_ty
|
|
|
def get_directory(project_id: str, user_id: str, file_type: str):
|
|
|
files = minio_client.ls_file(f'{project_id}/{file_type}/')
|
|
|
res = []
|
|
|
+ td = timedelta(hours=8)
|
|
|
+ tz = timezone(td)
|
|
|
for file in files:
|
|
|
timestamp = file.object_name.split('_',1)[0].split('/')[-1]
|
|
|
- time_str = time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(int(timestamp)))
|
|
|
+ dt = datetime.fromtimestamp(int(timestamp), tz)
|
|
|
+ time_str = dt.strftime('%Y-%m-%d %H:%M:%S')
|
|
|
dag_name = file.object_name.split('_',1)[1]
|
|
|
res.append({'name':time_str+'-'+dag_name, 'uri':file.object_name,'timestamp':timestamp})
|
|
|
res.sort(key=lambda x: x['timestamp'],reverse=True)
|