Merged
Conversation
Contributor
Haruto-Imai
commented
Nov 13, 2025
- 盤面保存機能に関する変数、型、関数などに"Board"の文字を追加しました。
- 盤面保存/読込機能をほぼそのまま流用し、コード保存/読込機能を追加しました。
aster-void
reviewed
Nov 13, 2025
| @@ -1,6 +1,6 @@ | |||
| import { json } from "@sveltejs/kit"; | |||
| import { prisma } from "@/lib/prisma.server.ts"; | |||
| import { createPreview } from "@/lib/board-preview.js"; | |||
Contributor
There was a problem hiding this comment.
見落としてたけどこれ @/lib/board-preview.ts の方が適切
aster-void
reviewed
Nov 13, 2025
src/routes/api/code/+server.ts
Outdated
| }); | ||
|
|
||
| export async function POST({ request }) { | ||
| let requestData; |
Contributor
There was a problem hiding this comment.
これをやると暗黙に any 型 (型チェックスキップ) になるので、型アノテーションは必ずつけてね (board のほうも)
type Code = v.InferOutput<typeof CodeSchema>;
let requestData: Code | undefined = undefined;
Contributor
There was a problem hiding this comment.
ここではまだ unknown か
let requestData: unknown;
aster-void
reviewed
Nov 13, 2025
prisma/schema.prisma
Outdated
| id Int @id @default(autoincrement()) | ||
| createdAt DateTime @default(now()) | ||
| codeData String | ||
| codeName String |
Contributor
There was a problem hiding this comment.
オブジェクトのプロパティにはそのオブジェクト自体の名前を入れないでね。
例
class Car {
// bad
carName: string
// good
name: string
}
const car = new Car();
// bad
car.carName
// good
car.name
aster-void
reviewed
Nov 13, 2025
aster-void
reviewed
Nov 13, 2025
prisma/schema.prisma
Outdated
| boardPreview Json | ||
| } | ||
|
|
||
| model CodeState { |
Contributor
There was a problem hiding this comment.
これは BoardState にも言えるけど、データベースに保存される段階ではもうデータであって状態じゃないので、単純に Board Code という命名がいいと思う
Contributor
There was a problem hiding this comment.
(これはデータは状態になりえないということを暗黙に意味するものではない)
aster-void
reviewed
Nov 13, 2025
| if (code) { | ||
| editingCode = code; | ||
| } | ||
| } |
Contributor
There was a problem hiding this comment.
これよりも長くなりそうだったら Reactive Class に分割するのも検討して良さそう
aster-void
reviewed
Nov 13, 2025
src/routes/+page.svelte
Outdated
| {/if} | ||
|
|
||
| <div class="modal-action"> | ||
| <button class="btn" onclick={() => (loadCodeState = { state: "closed" })}> |
Contributor
There was a problem hiding this comment.
この部分も、長くなりそうだったらコンポネントを分割してね
Deploying life-code with
|
| Latest commit: |
8bb1d31
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://94a4f798.life-code.pages.dev |
| Branch Preview URL: | https://feature-save-code.life-code.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.