← Re: [CSplus/RelationshipCRM] 基盤構築(Next.js + Prisma 7 + Neon PostgreSQL)と連絡先CRUD (PR #1)
メール履歴を編集
送受信区分
*
送信
受信
日時
*
件名
*
本文
@chatgpt-codex-connector[bot] commented on this pull request. ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `a9e4464460` <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". </details> > +} + +// ============ ユーザー(将来の認証用。当面は単一ユーザー運用)============ +model User { + id String @id @default(cuid()) + name String + email String @unique + interactions Interaction[] + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt +} + +// ============ 会社 ============ +model Company { + id String @id @default(cuid()) + name String **<sub><sub></sub></sub> Enforce unique company names for find-or-create** When two contact creates for the same new company name run concurrently, both calls to `resolveCompanyId` can observe no existing row and insert separate `Company` records because `name` is only indexed, not unique. That splits contacts across duplicate companies even though the flow is documented as find-or-create by name; make the name constraint unique and use an upsert/transaction so the race cannot create duplicates. Useful? React with 👍 / 👎. > + q?: string; + rank?: string; + page?: string; +}>; + +export default async function ContactsPage({ + searchParams, +}: { + searchParams: SearchParams; +}) { + const params = await searchParams; + const rank = relationshipRankValues.find((r) => r === params.rank); + const page = Number(params.page) || 1; + + const result = await contactSearch.search({ + keyword: params.q, **<sub><sub></sub></sub> Normalize repeated contact search params** In Next page props, a repeated query key is delivered as `string[]`, so a URL like `/contacts?q=alice&q=bob` passes an array here into `contactSearch`; the Prisma implementation then calls `query.keyword?.trim()` and throws, making the contacts page return an error. Coerce `q`, `rank`, and `page` to a single string or reject arrays before using them. Useful? React with 👍 / 👎. -- Reply to this email directly or view it on GitHub: https://github.com/CSplus/RelationshipCRM/pull/1#pullrequestreview-4676793993 You are receiving this because you authored the thread. Message ID: <CSplus/RelationshipCRM/pull/1/review/4676793993@github.com>
会社または連絡先のどちらか一方は必ず指定してください(両方も可)
連絡先(相手)
指定なし
会社
指定なし
連絡先を選ぶと所属会社が自動でセットされます(変更可)
更新する