Data pruning endpoint - #54
Open
jekuaitk wants to merge 3 commits into
Open
Conversation
cableman
requested changes
Jul 14, 2026
| user=Depends(get_admin_user), | ||
| db: AsyncSession = Depends(get_async_session), | ||
| ): | ||
| cutoff = int(time.time()) - days * 86400 |
jekuaitk
force-pushed
the
feature/prune-endpoint
branch
from
July 24, 2026 11:21
a07e538 to
a03d547
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a admin-only
POSTendpoint:Deletes chats that have not been updated for a given number of days. Requires an admin token
(JWT or API key) in the
Authorization: Bearerheader — non-admin callers get401.daysupdated_atis older thandaysdays is a candidate for deletion.dry_runfalse)true, only counts the matching chats and deletes nothing.limitPinned chats are always spared, regardless of age. Archived chats are pruned like any other.
Deleting a chat also removes its messages and shared-link copies, and tags that end up unused
by any of the affected user's remaining chats are cleaned up.
Examples