DO_NOT_MERGE - feat: templates service, APKG export, Node.js pipeline#1942
DO_NOT_MERGE - feat: templates service, APKG export, Node.js pipeline#1942
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…ST /api/templates/publish)
…owner,name) migration
- Add migration to add base_type column (default 'basic') - Add baseType to PublicTemplateRow and CreatePublicTemplateInput - Pass baseType through publish endpoint and include in list response - Update Swagger docs with base_type enum description
…e handled correctly
Splits the originally-combined PR down to just template management so that piece can ship on its own. The marketplace publish/browse half is held for later; the AI-generate endpoint moves to its own branch (feat/ai-template-generate) since it's a distinct feature. Removed: - migrations: public_templates + its unique-owner-name + base_type additions, and the template_downloads tracking table - PublicTemplatesController + PublicTemplatesRepository - AITemplateController + AITemplateService + /api/templates/generate route + express-rate-limit dependency - /api/templates/public and /api/templates/publish route registrations and their Swagger blocks - update-server.js dev artifact that should never have been committed Kept and now swagger-documented: - /api/templates/export (Node.js sql.js APKG pipeline) - /api/templates/defaults (hard-coded starter note types) - /api/templates/user GET/PUT (Edit Templates payload) Added a TODO at the top of DefaultTemplatesService noting the hardcoded content should eventually migrate to the 2anki/templates repo. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two changes driven by the new_security_hotspots_reviewed + new_duplicated _lines_density failures on PR #1942: - DefaultTemplatesService now builds its eight starter note types through tiny helpers — field(name, ord, font?, size?) and noteType({ id, name, type?, tmpls, flds, css, tags? }) — instead of repeating the same { sticky: false, rtl: false, font: 'Inter', size: 20 } shape 25× and { mod: 0, usn: -1, sortf: 0 } 8×. Net ~90 lines of duplicated boilerplate gone. - exportNoteTypeToApkg swaps the Math.random()-based GUID for one built from crypto.randomBytes (S2245 was the remaining security hotspot on this PR's changeset). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|



Scope
Template management + the supporting Node.js APKG pipeline. The marketplace publish/browse and AI-generate pieces are held for later (see below).
What's in
src/lib/templates/exportNoteTypeToApkg.ts\. Replaces the Python `genanki` path for this export route.What's deliberately out (not deleted, just not merged)
Test plan
🤖 Generated with Claude Code