Repository navigation
feat(lectures): split Lectures into Lectures + LectureClips - #292
Merged
Merged
Conversation
Lectures now models a full Nirmala Vidya talk; the new LectureClips child
collection holds time-range excerpts. External polymorphic references that
used to target `lectures` now target `lecture-clips` (AppCards, ShowcaseBlock,
richText RelationshipFeature, wm-app-config.postRealizationLecture). The
`/api/lectures/for-viewer` endpoint now returns a discriminated mixed feed of
`{ type: 'lecture' | 'clip', ... }` with conditional parent population and
server-merged thumbnail/subtitlesUrl fallbacks on clips. Seed entry points
that write legacy `lectures` rows throw with a pointer to the follow-up PR.
BREAKING: response shape for `/api/lectures/for-viewer` changes, and all
existing `lectures` rows are dropped by the migration.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…review polish - Add deleteChildren() beforeDelete-hook factory in src/hooks/cascadeDeletion.ts. PayloadCMS has no native onDelete: cascade on relationship fields (payloadcms/payload#11177, #1209); the default ON DELETE SET NULL orphans rows whose parent relationship is required: true. - Wire cascade into Lectures -> LectureClips and Albums -> Songs (both are composition relationships where the child has no meaning without the parent). - Cache eligibleLectures in /api/lectures/for-viewer so parents already fetched at depth:1 don't trigger a second find. - LectureClips polish: DEFAULT_CLIP_LENGTH_SECONDS constant for the 600s default; reword thumbnail/subtitlesUrl descriptions to clarify the fallback is applied by the for-viewer endpoint, not by collection CRUD. - Drop unused tagViewers10 test fixture. - Documentation & settings updates carried over from parallel sessions (AGENTS.md migration guidance, code-style + tests rules, PermissionRequest notifier). Tests: 529 passing (+5 cascade-delete tests across Lectures and Albums). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
- Set `push: false` on sqliteD1Adapter in src/payload.config.ts. Push mode silently skipped SQLite ALTER TABLE rebuilds needed for polymorphic-FK renames (issue #292), leaving local dev out of sync with production migrations. Local dev now takes the same code path as prod: run `pnpm payload migrate` before first boot. - AGENTS.md: document the new local-dev workflow and warn against flipping push back on. - Lectures.clips join: hide during create via `admin.condition` so the row can only be added once the parent has an id — matches the pattern used by the other post-create fields on this collection. - .claude/settings.json: trim PermissionRequest voice hook (user edit). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
This was referenced Apr 21, 2026
Ardnived
added a commit
that referenced
this pull request
Apr 26, 2026
…ureClips shape (#313) Drops the throw-on-use guards introduced in #292 and rewires the wemeditate + storyblok importers to upsert a parent Lecture (keyed on `nirmalVidyaVimeoUrl`) plus a single full-video child LectureClip per unique vimeo_id. Rich-text content references the clip, not the parent, matching the post-#291 polymorphic move everywhere else. - `convertVimeo`: handles the actual nested `data.items[0].vimeo_id` shape from wemeditate source data; emits `lecture-clips` relationships; drops YouTube blocks with a logged warning (no NV YouTube ingest path) - `WeMeditateImporter.importLectures`: per-vimeo error isolation so a single NV API failure doesn't kill the 40-video batch — the failed id is just absent from `lectureClipMap` and the converter logs a missing-clip warning - `StoryblokImporter.upsertLecture`: same parent+clip pattern; returns the child clip id and the call site emits a `lecture-clips` relationship node - `Lectures.nirmalVidyaVimeoUrl`: promote the natural key from convention to schema with `unique: true, index: true` (new migration `20260426_105204`) Includes a unit-lane `convert-vimeo.spec.ts` for the pure converter and an integration `seeds-lectures.int.spec.ts` that mocks the NV API to verify the end-to-end parent+clip flow, skip-mode no-op, and per-vimeo error isolation. Closes #311 Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Ardnived
added a commit
that referenced
this pull request
May 26, 2026
* feat(lectures): split Lectures into Lectures + LectureClips (#291) Lectures now models a full Nirmala Vidya talk; the new LectureClips child collection holds time-range excerpts. External polymorphic references that used to target `lectures` now target `lecture-clips` (AppCards, ShowcaseBlock, richText RelationshipFeature, wm-app-config.postRealizationLecture). The `/api/lectures/for-viewer` endpoint now returns a discriminated mixed feed of `{ type: 'lecture' | 'clip', ... }` with conditional parent population and server-merged thumbnail/subtitlesUrl fallbacks on clips. Seed entry points that write legacy `lectures` rows throw with a pointer to the follow-up PR. BREAKING: response shape for `/api/lectures/for-viewer` changes, and all existing `lectures` rows are dropped by the migration. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * feat(lectures,albums): generalize parent-child cascade-delete + #292 review polish - Add deleteChildren() beforeDelete-hook factory in src/hooks/cascadeDeletion.ts. PayloadCMS has no native onDelete: cascade on relationship fields (payloadcms/payload#11177, #1209); the default ON DELETE SET NULL orphans rows whose parent relationship is required: true. - Wire cascade into Lectures -> LectureClips and Albums -> Songs (both are composition relationships where the child has no meaning without the parent). - Cache eligibleLectures in /api/lectures/for-viewer so parents already fetched at depth:1 don't trigger a second find. - LectureClips polish: DEFAULT_CLIP_LENGTH_SECONDS constant for the 600s default; reword thumbnail/subtitlesUrl descriptions to clarify the fallback is applied by the for-viewer endpoint, not by collection CRUD. - Drop unused tagViewers10 test fixture. - Documentation & settings updates carried over from parallel sessions (AGENTS.md migration guidance, code-style + tests rules, PermissionRequest notifier). Tests: 529 passing (+5 cascade-delete tests across Lectures and Albums). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * fix(db): disable Drizzle push on local D1 to stop schema drift - Set `push: false` on sqliteD1Adapter in src/payload.config.ts. Push mode silently skipped SQLite ALTER TABLE rebuilds needed for polymorphic-FK renames (issue #292), leaving local dev out of sync with production migrations. Local dev now takes the same code path as prod: run `pnpm payload migrate` before first boot. - AGENTS.md: document the new local-dev workflow and warn against flipping push back on. - Lectures.clips join: hide during create via `admin.condition` so the row can only be added once the parent has an id — matches the pattern used by the other post-create fields on this collection. - .claude/settings.json: trim PermissionRequest voice hook (user edit). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * feat(api): require select + populate for client reads (#199) Adds validateClientQueryParamsHook to the usage plugin, which rejects API client read requests that omit `select`, or that use `depth > 1` without `populate`. Managers and write operations are unaffected. The hook lives alongside rateLimitHook in the usage plugin because it shares the same client-only gating and exclusion set (SYSTEM_EXCLUSIONS + 'clients'). It runs before rate limiting so malformed requests don't burn rate-limit slots. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * refactor(api): args-based validation + trusted-internal escape hatch - Switch validateClientQueryParamsHook from URL parsing to args inspection (`args.select`, `args.populate`, `args.depth`). Payload's REST handler already parses URL query params into args before the hook fires, and this avoids false-positive rejections on SDK callers that pass args directly. - Add SKIP_CLIENT_QUERY_VALIDATION_KEY context flag for trusted internal endpoint handlers (appCardsForViewer, lecturesForViewer) that forward client req to payload.find(...) and need to shape their own response without enumerating every field via select. Rate limiting and usage tracking still fire — only query-param validation is skipped. - Update role-based-access tests to pass `select` on client-simulating reads (matches the new enforcement). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * refactor(api): replace SKIP_CLIENT_QUERY_VALIDATION_KEY with asTrustedReq helper The exported constant + manual req spread pattern in every endpoint was overkill for what is an internal implementation detail. An asTrustedReq() helper encapsulates the bypass mechanism; the key string is inlined in the two adjacent places that read/write it. Also inlines the intermediate depth variable in the validation hook. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
13 tasks
Ardnived
added a commit
that referenced
this pull request
Nov 5, 2026
…review polish - Add deleteChildren() beforeDelete-hook factory in src/hooks/cascadeDeletion.ts. PayloadCMS has no native onDelete: cascade on relationship fields (payloadcms/payload#11177, #1209); the default ON DELETE SET NULL orphans rows whose parent relationship is required: true. - Wire cascade into Lectures -> LectureClips and Albums -> Songs (both are composition relationships where the child has no meaning without the parent). - Cache eligibleLectures in /api/lectures/for-viewer so parents already fetched at depth:1 don't trigger a second find. - LectureClips polish: DEFAULT_CLIP_LENGTH_SECONDS constant for the 600s default; reword thumbnail/subtitlesUrl descriptions to clarify the fallback is applied by the for-viewer endpoint, not by collection CRUD. - Drop unused tagViewers10 test fixture. - Documentation & settings updates carried over from parallel sessions (AGENTS.md migration guidance, code-style + tests rules, PermissionRequest notifier). Tests: 529 passing (+5 cascade-delete tests across Lectures and Albums). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Ardnived
added a commit
that referenced
this pull request
Nov 5, 2026
- Set `push: false` on sqliteD1Adapter in src/payload.config.ts. Push mode silently skipped SQLite ALTER TABLE rebuilds needed for polymorphic-FK renames (issue #292), leaving local dev out of sync with production migrations. Local dev now takes the same code path as prod: run `pnpm payload migrate` before first boot. - AGENTS.md: document the new local-dev workflow and warn against flipping push back on. - Lectures.clips join: hide during create via `admin.condition` so the row can only be added once the parent has an id — matches the pattern used by the other post-create fields on this collection. - .claude/settings.json: trim PermissionRequest voice hook (user edit). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
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.
Closes #291.
Summary
Lecturesnow models a full Nirmala Vidya talk. The newLectureClipschild collection (hidden from the sidebar; managed throughLectures.clipswithadmin.allowCreate: true) holds per-excerpt metadata:parent,startTime/endTime, localizedtitle, optionalthumbnail, localizedsubtitlesUrl,tags.lecturesis retargeted tolecture-clips:AppCards.content,ShowcaseBlock.items,RelationshipFeature.enabledCollections,wm-app-config.postRealizationLecture./api/lectures/for-vieweris rewritten to return a discriminated mixed feed of{ type: 'lecture' | 'clip', ... }. Clips are eligible independently of their parent — the endpoint populatesparentonly when the parent is viewer-eligible, and merges parentthumbnail/subtitlesUrlinto clips whose own values are empty (runs even whenparent: null). All internalpayload.findcalls forwardreqso usage-tracking and rate-limit hooks attribute to the caller.Lectureslosesversions.drafts,startTime/endTime, and_statusfrom defaultColumns; keepsaccess: { update: () => false }onnirmalVidyaVimeoUrl.LectureTagsgains a secondlectureClipsjoin alongside the existinglecturesjoin.ContentIndexBlockgainslecture-clipsas a newtypeoption with alectureClipFiltersfield mirroringlectureFilters(both pull fromlecture-tags).lecturesrows (seeds/wemeditate/import.ts,seeds/storyblok/import.ts,seeds/lib/lexicalConverter.ts) now throw with a pointer to the clip-aware follow-up PR. Seed test collection lists + expected counts updated.scripts/create-sample-page.tsskips the lectures branch.20260421_030949createslecture_clips+ relationship tables, drops_lectures_v*, dropsstartTime/endTimecolumns, rewires polymorphic_relstolecture_clips_id. Manual augmentations:DELETE FROM lectures;(aligns with issue's "no data migration" decision) and fixing Drizzle'sapp_cards_rels/_app_cards_v_relsrebuild which mistakenlySELECT lecture_clips_id FROMthe old table where onlylectures_idexisted.Breaking changes (coordinate with consumers before deploy)
/api/lectures/for-viewerresponse shape: discriminated mixed array, possibly-nullparenton clips, server-mergedthumbnail/subtitlesUrlon clips.wemeditate-appandwemeditate-webneed updates.wm-app-config.postRealizationLecturenow referenceslecture-clips.AppCards/ShowcaseBlock/ RichText polymorphic references no longer acceptlectures— existing content referencinglectureswill render as dangling (frontend already handles null relations).lecturesrows are dropped by the migration per the issue decision; editors re-create from scratch.Test plan
pnpm lint→ 0 errorspnpm tsc --noEmit→ 0 errorspnpm build→ successpnpm test:int→ 524 passing (up from 519: added 10 newlecture-clipstests, renamed 5for-viewertests, 1 newcollections-smokecanary, -6 startTime/endTime tests moved off Lectures)clipsjoin → confirmLectureClipsis not in the sidebar,LectureTagslist view shows bothlecturesandlectureClipscounts, and/api/lectures/for-viewer?limit=10&pathProgress=5returns a mixed discriminated array with at least one clip whoseparent: nulland at least one clip whose emptythumbnail/subtitlesUrlgets server-merged from parent.pnpm payload migrateagainst a copy of production and confirm the migration applies cleanly.Test Results
🤖 Generated with Claude Code