thinc-org / cugetreg

A course registration planning application for CU students
https://cugetreg.com
76 stars 2 forks source link

[BACKLOG] Move all multi-project types and schema into one single lib #371

Open bombnp opened 1 year ago

bombnp commented 1 year ago

Is your feature request related to a problem? Please describe. Both cugetreg-web and cugetreg-api have separate type definitions for GraphQL types (cugetreg-api= auto-generated from .graphql files, cugetreg-web= manual declaration). This mean changes to cugetreg-api'schema can break without cugetreg-web realizing it. cugetreg-api and cu-scraper both connects to MongoDB to access course data. The mongo schema is currently separated as well, and we need to change both of them when we make changes to the database schema.

Describe the solution you'd like

  1. Create a lib in monorepo as schema to act as a single source of type declaration between multiple projects (mostly frontend and backend). For GraphQL types, utilize auto-generated types from .graphql files for both projects. Note: this will require heavy refactoring on the frontend code.
    • MongoDB schemas: used by cugetreg-api and cu-scraper
    • GraphQL types: used by cugetreg-api and cugetreg-web
  2. Relocate mongo schema in cugetreg-api to this project, to share with cu-scraper (after we migrate scraper to this repo)

Additional context

Don't worry about cu-scraper for now as it may be deprecated in favor of new implementation soon.

Task Advisor @bombnp

leomotors commented 1 year ago

Summary

Motivation and Changes for Frontend

Backend

PR Spliting

In this ticket, I would like to split PR into 2 (or more part) for easier reviewing. Sub-PRs are independent and can be merged separately.

Sub-PR 1: Frontend #415

Sub-PR 2: Backend [TODO]

bombnp commented 1 year ago

@Leomotors since we're not using Nx anymore, does codegen still work? The generated code is probably fine, but the action to generate it required Nx right?

leomotors commented 1 year ago

@Leomotors since we're not using Nx anymore, does codegen still work? The generated code is probably fine, but the action to generate it required Nx right?

We need to convert the command into turbo way. Which is not that complex.