fix: 非公開の本へのコメントを禁止する - #269
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was previously deployed
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.
Motivation
Description
IBookCommentRepositoryにisBookPublic(bookId): Promise<boolean | null>を追加し、BookCommentRepositoryに実装を追加してisPublicMemoを返すようにしました。CreateBookCommentUseCase.execute内でisBookPublicを呼んで存在チェックと公開状態チェックを行い、存在しない場合は書籍が見つかりません、非公開の場合は非公開の書籍にはコメントできませんを投げて処理を中断するようにしました。createでも公開状態を再確認して、事前確認後に非公開へ変更されていた場合に保存しない防御を追加しました。CommentSectionにcanCommentプロパティを追加して非公開時は投稿フォームの代わりに案内文を表示するようにし、BookDetailReadModalでbook.isPublicMemoを渡すようにしました。apps/api/src/application/usecases/book-comments/create-book-comment.spec.tsに追加しました。Testing
pnpm --filter api test -- --runInBand application/usecases/book-comments/create-book-comment.spec.tsを実行し、対象スペックは5 passedで成功しました。PRISMA_ENGINES_CHECKSUM_IGNORE_MISSING=1 pnpm --filter api exec prisma generateを実行し、その後pnpm --filter api check-typesとpnpm --filter web check-typesを実行して型チェックを通過しました。pnpm --filter api lintとpnpm --filter web lintを実行しエラーは出ておらず警告のみ確認しました。Codex Task