feat: add ShareLink domain model and storage mixin#21
Merged
Conversation
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.
Summary
Adds the
ShareLinkdomain model and storage layer (ShareLinkMixin) to the open-source package. This is the open-source half of moving share links from an auth-side (Reflexio-managed) database to the per-customer data storage, so that share link records live alongside the resources they reference.Changes
models/api_schema/domain/entities.py) — newShareLinkPydantic class withid: int,org_id,token,resource_type,resource_id,created_at,expires_at,created_by_email.server/services/storage/storage_base/_share_links.py) — abstractShareLinkMixinwith 6 methods:create_share_link,get_share_link_by_token,get_share_link_by_resource,get_share_links,delete_share_link,delete_all_share_links.BaseStoragenow inherits this mixin.server/services/storage/sqlite_storage/_share_links.py,_base.py) —SQLiteShareLinkMixinplus theshare_linkstable DDL (auto-created at startup). Uses the shared_epoch_now()helper andself._execute/_fetchone/_fetchallhelpers for thread-safe queries.server/services/storage/disk_storage/_share_links.py) —DiskShareLinkMixinthat raisesNotImplementedErrorfor each method (disk storage does not support share links).Storage instances are org-scoped
None of the new methods take an
org_idparameter — the storage instance is already bound to a specific org. This matches the pattern used by every other mixin.Test plan
tests/server/services/storage/test_sqlite_share_links.pycover create / get-by-token / get-by-resource / list / delete / delete-all (12 tests, all passing)ruff check/ruff format --checkcleanpyrightclean on all new files