Skip to content

Commit

Permalink
правки
Browse files Browse the repository at this point in the history
  • Loading branch information
HamletSargsyan committed Jul 23, 2024
1 parent 8941362 commit 1b7ec1e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Подсказка о том как использовать команду `/craft`

### Исправлено

- Ошибки с сравнением времени

### Удалено

- Кеширование, из-за изменения результата функции ([#35](https://github.com/HamletSargsyan/livebot/issues/35), [#34](https://github.com/HamletSargsyan/livebot/issues/34), [#33](https://github.com/HamletSargsyan/livebot/issues/33))
Expand Down
2 changes: 1 addition & 1 deletion src/database/funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
)


client = MongoClient(DB_URL)
client = MongoClient(DB_URL, tz_aware=True)

if DB_NAME == "test":
choice = input(f"Drop database `{DB_NAME}`? [N/y] ")
Expand Down
8 changes: 3 additions & 5 deletions src/database/models.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
from typing import TypeVar, Generic, Type, Any
from datetime import datetime, timedelta
from datetime import datetime, timedelta, UTC
from bson import ObjectId

from helpers.enums import Locations


def _utcnow():
from datetime import UTC

return datetime.now(UTC)


Expand Down Expand Up @@ -75,10 +73,10 @@ def __init__(self, __exclude: list[str] = [], **kwargs) -> None:
):
try:
v = expected_type(v)
except (ValueError, TypeError):
except (ValueError, TypeError) as e:
raise ValueError(
f"Invalid type. Expected {expected_type}, got {type(v)} for field {k}"
)
) from e
setattr(self, k, v)


Expand Down

0 comments on commit 1b7ec1e

Please sign in to comment.