Skip to content

Migrate ClassSchedule and Course schemas to Go; with valida…#2

Merged
NaoCoding merged 11 commits into
mainfrom
firebase/courses-schema
Sep 28, 2025
Merged

Migrate ClassSchedule and Course schemas to Go; with valida…#2
NaoCoding merged 11 commits into
mainfrom
firebase/courses-schema

Conversation

@Darrin-Lin
Copy link
Copy Markdown
Member

This pull request migrates the schema definitions for ClassSchedule and Course from TypeScript (.ts) files using Zod validation to Go (.go) files using Go types and struct tags. The new Go implementations introduce explicit type definitions, validation rules, and some additional helper logic for time format validation. The TypeScript schemas and related utility code are removed.

Schema migration from TypeScript to Go:

  • Added ClassSchedule schema in Go (ClassSchedule.go), defining the structure, validation rules, and visibility options as Go types and constants.
  • Added Course schema in Go (Course.go), including detailed field validation via struct tags, explicit course categories, and a helper function to validate time formats for CourseTime.

Removal of TypeScript schema definitions and utilities:

  • Removed the TypeScript definition and Zod validation for ClassSchedule, including the route utility and type exports in ClassSchedule.ts.
  • Removed the TypeScript definition and Zod validation for Course, including the route utility and type exports in Course.ts.

@Darrin-Lin
Copy link
Copy Markdown
Member Author

Need help for naming convention.

Copy link
Copy Markdown
Contributor

@NaoCoding NaoCoding left a comment

Choose a reason for hiding this comment

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

For the schema part, I think there's no any issues.
However, I would prefer modifying the readme.md for telling the developers about how to setup the backend. (This can also be done after you write a new Golang backend).

- Deleted main application file (src/app.ts) along with its middleware and routes.
- Removed environment configuration file (src/config/env.ts) that handled environment variables.
- Eliminated Firebase configuration file (src/config/firebase.ts) and its initialization logic.
- Removed server entry point (src/index.ts) that started the Express server.
- Deleted API tests (src/test/api.test.ts) and configuration tests (src/test/config.test.ts).
- Removed test setup file (src/test/setup.ts) for initializing test environment.
- Deleted TypeScript configuration file (tsconfig.json) and Vitest configuration file (vitest.config.ts).
This commit reverts the changes from commit f332187, 0ffb16e, 7cfe244, 6bcd0bd, e802ac3, 72c9601, cac8809, b21b7dd, 713ba26
that were mistakenly pushed to this branch. Ensures the
branch state matches the intended branch history.
Copy link
Copy Markdown
Contributor

@NaoCoding NaoCoding left a comment

Choose a reason for hiding this comment

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

LGTM

@NaoCoding NaoCoding merged commit 0794425 into main Sep 28, 2025
1 check passed
@Darrin-Lin Darrin-Lin deleted the firebase/courses-schema branch September 28, 2025 14:16
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