Skip to content

feat(pretalx): return difficulty, track, and tags on sessions (#171)#174

Open
pan93412 wants to merge 2 commits into
mainfrom
claude/issue-171-api-fields-ts7Aw
Open

feat(pretalx): return difficulty, track, and tags on sessions (#171)#174
pan93412 wants to merge 2 commits into
mainfrom
claude/issue-171-api-fields-ts7Aw

Conversation

@pan93412
Copy link
Copy Markdown
Contributor

Closes #171.

Summary

/api/session 先前把 tags 寫死成空陣列,且沒有 difficultytrack 欄位。本 PR 依照 issue #171 的提案,仿照 2025 的做法把這三項補上:

  • 新增 tracks / tags 兩張 Pretalx table 的抓取與 schemaPRETALX_TABLES 加入 trackstags,新增 TrackSchemaTagSchemagetPretalxItemKeyid 為 key,直接相容)。
  • 新增 parserparseTrack(submission.track id → { id, name } 多語)、parseTags(submission.tags id[] → tag 名稱 string[])、parseDifficulty(把投稿者填寫的難度原始字串正規化成 Elementary/Intermediate/Advanced/Professional enum)。
  • 兩個 handler 輸出新欄位index.get.ts[id]/index.get.ts 都帶上 difficultytrack,並用 parseTags 取代 tags: []
  • schema 補欄位SessionSummarySchema 新增 difficultytrack,tags 內容改為實際 tag 名稱。
項目 來源 處理
difficulty answers Q270 正規化成英文 enum
track submission.track(id)→ tracks table 輸出 { id, name }(多語)
tags submission.tags(id[])→ tags table id → tag 名稱 string[]

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 lintpnpm typecheck 皆通過。
  • 測試用的 2025 資料 locale key 為 zh-hant,而既有的 PretalxLocaleSchema 只取 enzh-hans(room/type 名稱也是相同行為),因此 2025 資料的 track.name.zh-hans 會是空字串;2026 正式資料若採 zh-hans 則會正常填入。此為既有、跨欄位一致的設計,本 PR 未更動。

https://claude.ai/code/session_01DEyZKJJtSf8Hm8vDLpqiZZ


Generated by Claude Code

@rileychh-dokploy-coscup
Copy link
Copy Markdown

rileychh-dokploy-coscup Bot commented May 30, 2026

Dokploy Preview Deployment

Name Status Preview Updated (UTC)
Nuxt ❌ Failed Preview URL 2026-06-02T02:53:34.152Z

@pan93412 pan93412 marked this pull request as ready for review May 30, 2026 12:44
Copilot AI review requested due to automatic review settings May 30, 2026 12:44
@pan93412 pan93412 changed the title feat(pretalx): return difficulty, track, and tags on sessions feat(pretalx): return difficulty, track, and tags on sessions (#171) May 30, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 tracks and tags table 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 populated tags.

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.

Comment thread server/utils/pretalx/parser.ts
Comment thread server/utils/pretalx/parser.ts
Comment thread server/utils/pretalx/parser.ts
@pan93412 pan93412 requested a review from a team May 30, 2026 13:01
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
@pan93412 pan93412 force-pushed the claude/issue-171-api-fields-ts7Aw branch from 10c6d77 to 0f68f7e Compare June 1, 2026 15:02
@pan93412
Copy link
Copy Markdown
Contributor Author

pan93412 commented Jun 1, 2026

@mirumodapon 交給你看看~ #172 的「標籤」篩選,會需要「議程軌」和「難度」(標籤)相關的篩選維度。另外如果要符合 COSCUP 2025 的設計稿,也會需要這些內容。

@pan93412 pan93412 self-assigned this Jun 1, 2026
@pan93412
Copy link
Copy Markdown
Contributor Author

pan93412 commented Jun 2, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread server/utils/pretalx/parser.ts
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sessions 應回傳「社群」欄位

3 participants