Fixed UTC time
This commit is contained in:
@@ -4,7 +4,7 @@ from secrets import token_urlsafe
|
||||
from shutil import move
|
||||
from typing import Union
|
||||
from magic import Magic
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timezone
|
||||
from os import makedirs, path, remove
|
||||
from classes.models import Video, SearchResults
|
||||
#from modules.unified_exif_reader import extract_location
|
||||
@@ -60,8 +60,8 @@ async def video_upload(file: UploadFile, album: str, caption: Union[str, None] =
|
||||
"album": album,
|
||||
"filename": filename,
|
||||
"dates": {
|
||||
"uploaded": datetime.utcnow(),
|
||||
"modified": datetime.utcnow()
|
||||
"uploaded": datetime.now(tz=timezone.utc),
|
||||
"modified": datetime.now(tz=timezone.utc)
|
||||
},
|
||||
"caption": caption,
|
||||
# "location": [
|
||||
@@ -118,7 +118,7 @@ async def video_move(id: str, album: str, current_user: User = Security(get_curr
|
||||
else:
|
||||
filename = video["filename"]
|
||||
|
||||
col_videos.find_one_and_update( {"_id": ObjectId(id)}, {"$set": {"album": album, "filename": filename, "dates.modified": datetime.utcnow()}} )
|
||||
col_videos.find_one_and_update( {"_id": ObjectId(id)}, {"$set": {"album": album, "filename": filename, "dates.modified": datetime.now(tz=timezone.utc)}} )
|
||||
|
||||
move(
|
||||
path.join("data", "users", current_user.user, "albums", video["album"], video["filename"]),
|
||||
@@ -142,7 +142,7 @@ async def video_patch(id: str, caption: str, current_user: User = Security(get_c
|
||||
except InvalidId:
|
||||
return HTTPException(status_code=HTTP_404_NOT_FOUND, detail="Could not find an video with such id.")
|
||||
|
||||
col_videos.find_one_and_update( {"_id": ObjectId(id)}, {"$set": {"caption": caption, "dates.modified": datetime.utcnow()}} )
|
||||
col_videos.find_one_and_update( {"_id": ObjectId(id)}, {"$set": {"caption": caption, "dates.modified": datetime.now(tz=timezone.utc)}} )
|
||||
|
||||
return UJSONResponse(
|
||||
{
|
||||
|
Reference in New Issue
Block a user