Skip to content

Conversation

@purplesmoke05
Copy link
Member

📌 Description

This pull request introduces several improvements and refactorings across the codebase, focusing on code style, timezone handling, type annotations, and code deduplication. The most significant changes include centralizing timezone conversion utilities, improving type safety and clarity in schema definitions, and cleaning up unused or redundant code.

These changes collectively improve maintainability, consistency, and type safety throughout the project.

✅ Related Issues

🔄 Changes

Timezone Handling and Utilities:

  • Centralized timezone conversion logic (replace_to_local_tz and format_timestamp) in Base class of app/model/db/base.py, replacing similar duplicated methods in multiple models. This reduces code duplication and ensures consistency in timestamp handling. [1] [2] [3] [4] [5] [6] [7]
  • Removed unused or redundant timezone imports and logic from several files, relying on the centralized implementation. [1] [2] [3]

Type Annotations and Pydantic Schema Improvements:

  • Improved type annotations in various Pydantic models for better type safety, including use of dict[str, Any], list[object], and explicit return types for methods and validators. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]
  • Updated Pydantic model usage to leverage new features, such as ConfigDict and Field(default_factory=...), and refined model inheritance for generics. [1] [2] [3]

General Code Quality and Maintenance:

  • Added # pyright: reportUnusedImport=false to several __init__.py files to suppress unused import warnings, improving code linting experience. [1] [2] [3] [4] [5]
  • Fixed variable naming and usage in mail sending logic to avoid confusion and potential bugs.

Other Notable Changes:

  • Renamed enum values from value to value_ in ListAllLockedSortItem and LockEventSortItem to avoid potential conflicts with reserved keywords. [1] [2]

📌 Checklist

  • I have added tests where necessary.
  • I have updated the documentation where necessary.

@purplesmoke05 purplesmoke05 marked this pull request as ready for review January 21, 2026 03:49
@github-actions
Copy link

Coverage

Coverage Report •
FileStmtsMissCoverMissing
app/model/blockchain
   __init__.py10100% 
   token.py7262596%90, 146, 149, 152, 275–276, 449–450, 472, 522–523, 530–531, 562–563, 701–702, 841–842, 887–888, 969–970, 1084–1085
app/model/db
   __init__.py200100% 
   base.py28485%48, 51, 66–67
   idx_lock_unlock.py49295%85, 139
   idx_token.py91297%134, 191
   idx_transfer.py370100% 
   idx_transfer_approval.py38197%74
   listing.py26292%52, 61
   public_info.py270100% 
app/model/mail
   __init__.py10100% 
   mail.py801383%67, 73, 80–81, 94, 114–115, 121, 133–134, 154, 156, 159
app/model/schema
   __init__.py210100% 
   bc_explorer.py700100% 
   dex_order_list.py420100% 
   eth.py510100% 
   messaging.py410100% 
   notification.py650100% 
   position.py1260100% 
   public_info.py480100% 
   token.py2100100% 
   token_bond.py460100% 
   token_coupon.py370100% 
   token_lock.py300100% 
   token_membership.py370100% 
   token_share.py450100% 
app/model/schema/base
   __init__.py10100% 
   base.py176497%203, 209–211
TOTAL46758157896% 

Tests Skipped Failures Errors Time
1538 0 💤 0 ❌ 0 🔥 11m 55s ⏱️

@YoshihitoAso YoshihitoAso merged commit b7ffa14 into dev-26.3 Jan 21, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Pyright] Fix type errors in app/model/

2 participants