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.
This pull request introduces several improvements to the
TemplateStatelogic in the desktop app and refactors permission handling in the API to enhance maintainability and functionality. Key changes include removing unused code in theTemplateStateclass, centralizing permission checks with a new utility function, and optimizing database queries for template access.Desktop App Changes:
TemplateState:injectDataFunctionlogic and associated background task handling, simplifying thegetTemplatesmethod (apps/desktop/components/tauri-provider/template-state.ts: [1] [2].fetchercall to clean up redundant null assertion (apps/desktop/components/tauri-provider/template-state.ts: apps/desktop/components/tauri-provider/template-state.tsL102-R100).API Changes:
Permission Handling Refactor:
has_role_permissionto centralize permission checks, replacing inline logic across the codebase (packages/api/src/permission/role_permission.rs: [1]packages/api/src/middleware/jwt.rs: [2].has_role_permission, ensuring consistent usage (packages/api/src/middleware/jwt.rs: [1]packages/api/src/routes/user/templates.rs: [2].Database Query Optimization:
packages/api/src/routes/user/templates.rs: packages/api/src/routes/user/templates.rsR32-R57).limitparameter handling to usemininstead ofmaxfor clarity and correctness (packages/api/src/routes/user/templates.rs: packages/api/src/routes/user/templates.rsR32-R57).Metadata Fallback Logic:
packages/api/src/routes/user/templates.rs: packages/api/src/routes/user/templates.rsR104).… logic