Skip to content

feat(websoc): support courseId query param#419

Closed
KevinWu098 wants to merge 2 commits into
mainfrom
feat/websoc-course-id-query
Closed

feat(websoc): support courseId query param#419
KevinWu098 wants to merge 2 commits into
mainfrom
feat/websoc-course-id-query

Conversation

@KevinWu098
Copy link
Copy Markdown
Member

@KevinWu098 KevinWu098 commented May 23, 2026

Description

Adds optional courseId to the WebSoc query endpoint (REST + GraphQL), filtering on the existing generated websoc_course.course_id column (REPLACE(dept_code, ' ', '') || course_number).

Also returns courseId on each course in the response so clients can use the same identifier as catalogue, programs, and /websoc/syllabi.

Related Issue

#416

Motivation and Context

Clients already identify courses by courseId (e.g. I&CSCIH32) elsewhere in the API. The main WebSoc query previously required department + courseNumber; this adds a single-key filter aligned with the syllabi endpoint.

For AntAlmanac, this allows better querying for collections of courses (which are more idiomatically identified by a courseId than a set of tuples which have to be serialized/deserialized between AA and AAPI).

How Has This Been Tested?

Not manually tested. Logic mirrors getSyllabi (eq(websocCourse.courseId, …)); no DB migration.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code involves a change to the database schema.
  • My code requires a change to the documentation.

Allow filtering the WebSoc query by courseId and return courseId on each course in the response.

Co-authored-by: Cursor <cursoragent@cursor.com>
@KevinWu098 KevinWu098 temporarily deployed to staging-419 May 23, 2026 04:51 — with GitHub Actions Inactive
@KevinWu098 KevinWu098 mentioned this pull request May 23, 2026
7 tasks
Comment thread apps/api/src/graphql/schema/websoc.ts Outdated
type WebsocCourse @cacheControl(maxAge: 300) {
sections: [WebsocSection!]!
courseId: String!
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do we really need to give both courseId and dept + num as a field in the response. Maybe its good practice, but it feels redundant to me

Copy link
Copy Markdown
Member Author

@KevinWu098 KevinWu098 May 23, 2026

Choose a reason for hiding this comment

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

I think... it's nice because it will let us do less string concatenation in app land

Comment thread apps/api/src/schema/websoc.ts Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nit: It makes good UX sense to put courseNumber right after department. Probably order ... dept, courseNum, courseId, courseTitle, ...

Comment thread apps/api/src/schema/websoc.ts Outdated
example: "I&C SCI",
}),
courseId: z.string().optional().openapi({
description: "The course ID to query",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Docs change to reflect that user should use courseId OR Dept + name, as per Dante

Align field order across GraphQL and Zod schemas; keep courseId OpenAPI description minimal.

Co-authored-by: Cursor <cursoragent@cursor.com>
@KevinWu098 KevinWu098 temporarily deployed to staging-419 May 23, 2026 19:28 — with GitHub Actions Inactive
@KevinWu098 KevinWu098 requested a review from HwijungK May 23, 2026 19:31
Copy link
Copy Markdown
Collaborator

@HwijungK HwijungK left a comment

Choose a reason for hiding this comment

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

I wont fight on the docs... this is an ok from me.

@HwijungK HwijungK requested a review from laggycomputer May 24, 2026 00:59
@KevinWu098 KevinWu098 closed this May 24, 2026
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.

2 participants