Skip to content

Add filters to token transfer approval history APIs - #1131

Merged
YoshihitoAso merged 1 commit into
dev-26.12from
feature/transfer-approval-history-filters
Oct 30, 2026
Merged

YoshihitoAso merged 1 commit into
dev-26.12from
feature/transfer-approval-history-filters

Conversation

@YoshihitoAso

Copy link
Copy Markdown
Member

📌 Description

Add optional filters to the bond and share token transfer approval history APIs.

✅ Related Issues

None.

🔄 Changes

  • Add application and approval datetime ranges, amount comparisons, and index ID filters.
  • Add partial name matching using snapshot personal information when available and latest personal information otherwise.
  • Interpret datetime filters in the configured timezone, consistent with existing APIs.
  • Update the OpenAPI specification and add numbered normal and error cases to each API's existing tests.

📌 Checklist

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

@github-actions

Copy link
Copy Markdown

Coverage

Coverage Report •
FileStmtsMissBranchBrPartCoverMissing
app/model/schema
   transfer.py96000100% 
app/routers/issuer
   bond.py1436306624696%217->218, 218, 733->743, 750->755, 756->762, 806->863, 1028->1029, 1029, 1030->1031, 1031, 1032->1033, 1033, 1039->1045, 1043->1045, 1045->1047, 1047, 1059->1060, 1060, 1221->1222, 1222, 1467->1468, 1468, 1469->1470, 1470, 1471->1472, 1472, 1478->1484, 1482->1484, 1484->1486, 1486, 1498->1499, 1499, 1670->1674, 1714->1715, 1715, 1968->1969, 1969, 2055->2065, 2072->2081, 2163->2173, 2180->2189, 2461->2462, 2462, 2492->2495, 2508->2513, 2519->2522, 2537->2543, 2552->2555, 2643->2644, 2644, 2875->2876, 2876, 3180->3181, 3181, 3221->3222, 3222, 3526->3527, 3527, 3534->3535, 3535, 3570->3574, 3574, 3813->3815, 3864->3865, 3865, 4228->4230, 4320->4321, 4321, 4327->4328, 4328, 4600–4603, 5046->5047, 5047
   share.py1433306484396%217->218, 218, 719->724, 725->731, 770->827, 992->993, 993, 994->995, 995, 996->997, 997, 1003->1009, 1007->1009, 1009->1011, 1011, 1023->1024, 1024, 1185->1186, 1186, 1431->1432, 1432, 1433->1434, 1434, 1435->1436, 1436, 1442->1448, 1446->1448, 1448->1450, 1450, 1462->1463, 1463, 1634->1638, 1678->1679, 1679, 2018->2024, 2107->2113, 2385->2386, 2386, 2416->2419, 2432->2437, 2443->2446, 2461->2467, 2476->2479, 2578->2579, 2579, 2808->2809, 2809, 2810->2811, 2811, 3107->3108, 3108, 3148->3149, 3149, 3460->3461, 3461, 3468->3469, 3469, 3532->3533, 3533, 3742->3744, 3793->3794, 3794, 4157->4159, 4248->4249, 4249, 4255->4256, 4256, 4529–4532, 4972->4973, 4973
tests/app/routers
   test_bond_transfer_approvals_ListSpecificBondTokenTransferApprovalHistory.py12390140599%1108->1116, 1259->1267, 1454->1462, 1681->1690, 1940->1948
   test_share_transfer_approvals_ListSpecificShareTokenTransferApprovalHistory.py12390140599%1108->1116, 1259->1267, 1454->1462, 1681->1690, 1940->1948
TOTAL1037272287590090097% 
Tests Skipped Failures Errors Time
2798 0 💤 0 ❌ 0 🔥 5m 48s ⏱️

Comment on lines +4185 to +4196
# - Datetimes are stored as naive UTC. Interpret inputs in config.TZ.
for field, value, is_lower_bound in (
(subquery.application_datetime, get_query.application_datetime_from, True),
(subquery.application_datetime, get_query.application_datetime_to, False),
(subquery.approval_datetime, get_query.approval_datetime_from, True),
(subquery.approval_datetime, get_query.approval_datetime_to, False),
):
if value is not None:
utc_value = local_tz.localize(value).astimezone(UTC).replace(tzinfo=None)
stmt = stmt.where(
field >= utc_value if is_lower_bound else field <= utc_value
)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nits]
These fields are typed as datetime and exposed as format: date-time, so clients can send offset-aware(timezone-aware) values, e.g. 2026-10-30T14:00:00+09:00 or 2026-10-30T05:00:00Z.

Pydantic parses these as timezone-aware datetimes, but local_tz.localize(value) only accepts naive datetimes and raises ValueError: Not naive datetime (tzinfo is already set), so it would be nice to convert aware values to UTC and then localize.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems the existing parts also need to be reviewed, so I will address that separately.

@YoshihitoAso
YoshihitoAso merged commit 3c91940 into dev-26.12 Oct 30, 2026
10 checks passed
@YoshihitoAso
YoshihitoAso deleted the feature/transfer-approval-history-filters branch October 30, 2026 07:05
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.

2 participants