feat(pretalx): return difficulty, track, and tags on sessions (#171)#174
feat(pretalx): return difficulty, track, and tags on sessions (#171)#174pan93412 wants to merge 2 commits into
Conversation
Dokploy Preview Deployment
|
There was a problem hiding this comment.
Pull request overview
This PR extends the Pretalx-backed session API so session responses can include difficulty, track, and real Pretalx tag metadata instead of always returning an empty tag list.
Changes:
- Adds Pretalx
tracksandtagstable schemas and fetches them with cached Pretalx data. - Adds parser helpers for session difficulty normalization, track lookup, and tag lookup.
- Updates session list/detail handlers and shared session schemas to expose
difficulty,track, and populatedtags.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
shared/types/session.ts |
Adds session difficulty and track response schemas/types. |
shared/types/pretalx.ts |
Adds Pretalx tracks/tags table definitions and result typing. |
server/utils/pretalx/parser.ts |
Adds parsing helpers for difficulty, track, and tags. |
server/utils/pretalx/index.ts |
Fetches tracks and tags alongside existing Pretalx tables. |
server/api/session/index.get.ts |
Includes difficulty, track, and parsed tags in session list responses. |
server/api/session/[id]/index.get.ts |
Includes difficulty, track, and parsed tags in session detail responses. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fetch the Pretalx tracks and tags tables and surface them on the /api/session endpoints, resolving issue #171. - Add tracks/tags tables and Zod schemas to PRETALX_TABLES - Add parseTrack, parseTags, and parseDifficulty parsers - Normalize difficulty answers into Elementary/Intermediate/Advanced/ Professional enum - Add difficulty and track fields to SessionSummarySchema and replace the hardcoded empty tags array with resolved tag names
10c6d77 to
0f68f7e
Compare
|
@mirumodapon 交給你看看~ #172 的「標籤」篩選,會需要「議程軌」和「難度」(標籤)相關的篩選維度。另外如果要符合 COSCUP 2025 的設計稿,也會需要這些內容。 |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0f68f7e7c8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Add is_public to TagSchema and filter out non-public tags in parseTags so organizer-only labels are not exposed via the public session API.
Closes #171.
Summary
/api/session先前把tags寫死成空陣列,且沒有difficulty、track欄位。本 PR 依照 issue #171 的提案,仿照 2025 的做法把這三項補上:PRETALX_TABLES加入tracks、tags,新增TrackSchema、TagSchema(getPretalxItemKey以id為 key,直接相容)。parseTrack(submission.track id →{ id, name }多語)、parseTags(submission.tags id[] → tag 名稱string[])、parseDifficulty(把投稿者填寫的難度原始字串正規化成Elementary/Intermediate/Advanced/Professionalenum)。index.get.ts與[id]/index.get.ts都帶上difficulty、track,並用parseTags取代tags: []。SessionSummarySchema新增difficulty、track,tags內容改為實際 tag 名稱。difficultytrack{ id, name }(多語)tagsstring[]Example output
實際打
/api/session驗證(測試環境指向 coscup-2025 event)。單筆 session:
{ "id": "3LWSX3", "language": "中文", "difficulty": "Elementary", "track": { "id": 461, "name": { "en": "Main Session Track", "zh-hans": "" } }, "tags": ["原綜合軌"] }全體覆蓋率(共 341 場):
{ "total_sessions": 341, "with_difficulty": 328, "with_track": 341, "with_nonempty_tags": 73 }difficulty出現值:["Advanced", "Elementary", "Intermediate"](皆已正規化)tags範例:"early-bird","program-invitation","cn","Misc - DevOps","原綜合軌"track.name.en範例:"Cloud Native Days Taipei","Golang Taiwan","Data Infrastructure"單筆詳細端點
/api/session/{id}同樣帶上這三個新欄位。Notes
pnpm lint與pnpm typecheck皆通過。zh-hant,而既有的PretalxLocaleSchema只取en與zh-hans(room/type 名稱也是相同行為),因此 2025 資料的track.name.zh-hans會是空字串;2026 正式資料若採zh-hans則會正常填入。此為既有、跨欄位一致的設計,本 PR 未更動。https://claude.ai/code/session_01DEyZKJJtSf8Hm8vDLpqiZZ
Generated by Claude Code