-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
24 add orm #34
24 add orm #34
Conversation
Deploying jisaku-nunawa-net with
|
Latest commit: |
9f1d8cc
|
Status: | ✅ Deploy successful! |
Preview URL: | https://615696e2.jisaku-nunawa-net.pages.dev |
Branch Preview URL: | https://24-add-orm.jisaku-nunawa-net.pages.dev |
Copilot's SummaryThis pull request includes several major changes to the codebase, primarily focused on migrating from Migration to
|
Cloudflare Pagesでプレビューしたところ |
ORMとしてTypeORMを導入し、SQLべた書きをやめた。導入のため
typeorm
とreflect-metadata
パッケージを追加した。また、dbディレクトリ以下にTypeORMのEntityを定義した。TypeORMの導入にあたって、sql.jsを直接呼んでいる箇所は削除し、index.tsxでsql.jsとTypeORMのDataSourceの初期化を行うようにした。
また、FilterOption.tsxが複雑化しており、導入の障害になっていたのでリファクタした。まず、Accordionsは分割し、SQLの実行結果からコンポーネントを生成する方式をやめ、JSONファイルから生成する方式にした。さらに、onSubmitのSQLクエリ作成部分は、SQLべた書きではなくTypeORMのQueryBuilderで生成するようにした。CPUなどパーツごとのクエリ作成部分は別の関数に分けて記載し、処理の流れを分かりやすくした。クエリ作成で使うため、types/index.tsにある型情報も追記した。