← メール履歴一覧

Re: [CSplus/RelationshipCRM] feat: 案件(Case)管理機能 (PR #6)

受信Gmail同期2026/07/11 20:39
編集

未紐付けのメールです

連絡先を選択して紐付けると、連絡先・会社のメール履歴に表示されます

相手(連絡先)
-
会社
-
From(Gmail)
notifications@github.com
To / Cc(Gmail)
relationshipcrm@noreply.github.com, koshiba@csplus.jp, state_change@noreply.github.com
作成日時
2026/07/12 11:08
更新日時
2026/07/12 11:08

本文

@chatgpt-codex-connector[bot] commented on this pull request. ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `353c8fa1df` <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> > +import type { Prisma } from "@/generated/prisma/client"; +import { openCaseStatuses, type CaseStatusValue } from "@/lib/case-labels"; +import { formatDate, formatDateTime, fullName } from "@/lib/utils"; +import { + CasePriorityBadge, + CaseStatusBadge, +} from "@/components/cases/case-badges"; + +export type CaseRow = Prisma.CaseGetPayload<{ + include: { company: true; contact: true }; +}>; + +export function isCaseOverdue(row: CaseRow, now: Date): boolean { + return ( + row.dueDate !== null && + row.dueDate < now && **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Compare date-only due dates by day** Because `dueDate` is entered with `<input type="date">` and saved as midnight for that calendar day, comparing it directly with the current timestamp marks any case due today as overdue for almost the entire day. For example, a case due on July 11 is rendered as `期限超過` once the clock is after 00:00 on July 11; the dashboard uses the same `lt: now` style check for its overdue/upcoming buckets, so those counts are skewed too. Normalize both sides to calendar days or compare against the start of the next day. Useful? React with 👍 / 👎. > @@ -224,6 +226,45 @@ enum InteractionStatus { COMPLETED } +// ============ 案件(相談事項・課題・案件の可能性・対応中テーマ)============ +// 会社・連絡先のどちらか一方、または両方に紐付ける(アプリ側で必須チェック)。 +// 削除は原則物理削除ではなく status = CLOSED にする運用。 +model Case { + id String @id @default(cuid()) + title String + description String? + status CaseStatus @default(OPEN) + priority CasePriority @default(MEDIUM) + dueDate DateTime? // 期限 + resolvedAt DateTime? // 解決日時(RESOLVED / CLOSED 時に自動設定) + company Company? @relation(fields: [companyId], references: [id], onDelete: SetNull) + companyId String? + contact Contact? @relation(fields: [contactId], references: [id], onDelete: SetNull) **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Preserve an owner when deleting contact-only cases** When a case is created from a contact page it can have only `contactId` set, and the existing `deleteContact` action physically deletes contacts. With this new `onDelete: SetNull` relation, deleting that contact leaves the case with both `contactId` and `companyId` null, violating the new app-level invariant that one owner is required and orphaning an open case that still appears in `/cases` and dashboard counts but no longer belongs to any contact or company. Prevent deletion, cascade/close these cases, or ensure a remaining company owner is set before nulling the last link. Useful? React with 👍 / 👎. -- Reply to this email directly or view it on GitHub: https://github.com/CSplus/RelationshipCRM/pull/6#pullrequestreview-4677643446 You are receiving this because you modified the open/close state. Message ID: <CSplus/RelationshipCRM/pull/6/review/4677643446@github.com>