fix: fix Application UI using UTC time (#472) bump:patch

* use tzlocal to get the local time

* delete tmp folder

* update date_created and date_updated with current timezone

* pass precommit

* update date_created field default by local time
This commit is contained in:
cin-cris
2024-11-11 16:51:38 +07:00
committed by GitHub
parent 6a81c77dd8
commit 5b828c213c
6 changed files with 22 additions and 14 deletions

View File

@@ -1,4 +1,5 @@
import uuid
from datetime import datetime
import chromadb
from ktem.index.models import Index
@@ -15,7 +16,7 @@ from sqlalchemy import (
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.ext.mutable import MutableDict
from sqlalchemy.orm import Session
from sqlalchemy.sql import func
from tzlocal import get_localzone
def _init_resource(private: bool = True, id: int = 1):
@@ -41,7 +42,7 @@ def _init_resource(private: bool = True, id: int = 1):
"path": Column(String),
"size": Column(Integer, default=0),
"date_created": Column(
DateTime(timezone=True), server_default=func.now()
DateTime(timezone=True), default=datetime.now(get_localzone())
),
"user": Column(Integer, default=1),
"note": Column(
@@ -66,7 +67,7 @@ def _init_resource(private: bool = True, id: int = 1):
"path": Column(String),
"size": Column(Integer, default=0),
"date_created": Column(
DateTime(timezone=True), server_default=func.now()
DateTime(timezone=True), default=datetime.now(get_localzone())
),
"user": Column(Integer, default=1),
"note": Column(