feat(precedent-library): add district and chair_name to edit form
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 3m11s

Fields existed in DB and Precedent type but were missing from:
- PrecedentUpdateRequest (backend model)
- update_case_law allowed set (db layer)
- PrecedentPatch (frontend type)
- precedent-edit-sheet form state, inputs, and patch payload

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-19 12:16:43 +00:00
parent 1da2a9a2cb
commit 1496e520fd
4 changed files with 25 additions and 3 deletions

View File

@@ -1985,7 +1985,7 @@ async def update_case_law(case_law_id: UUID, **fields) -> dict | None:
allowed = { allowed = {
"case_number", "case_name", "court", "date", "practice_area", "appeal_subtype", "case_number", "case_name", "court", "date", "practice_area", "appeal_subtype",
"subject_tags", "summary", "headnote", "key_quote", "source_url", "subject_tags", "summary", "headnote", "key_quote", "source_url",
"source_type", "precedent_level", "is_binding", "source_type", "precedent_level", "is_binding", "district", "chair_name",
} }
updates = {k: v for k, v in fields.items() if k in allowed} updates = {k: v for k, v in fields.items() if k in allowed}
if not updates: if not updates:

View File

@@ -38,6 +38,8 @@ type FormState = {
citation: string; citation: string;
case_name: string; case_name: string;
court: string; court: string;
district: string;
chair_name: string;
decision_date: string; decision_date: string;
practice_area: PracticeArea; practice_area: PracticeArea;
appeal_subtype: string; appeal_subtype: string;
@@ -51,8 +53,8 @@ type FormState = {
}; };
const EMPTY: FormState = { const EMPTY: FormState = {
citation: "", case_name: "", court: "", decision_date: "", citation: "", case_name: "", court: "", district: "", chair_name: "",
practice_area: "", appeal_subtype: "", source_type: "", decision_date: "", practice_area: "", appeal_subtype: "", source_type: "",
precedent_level: "", is_binding: true, subject_tags: "", precedent_level: "", is_binding: true, subject_tags: "",
summary: "", headnote: "", key_quote: "", summary: "", headnote: "", key_quote: "",
}; };
@@ -75,6 +77,8 @@ export function PrecedentEditSheet({ caseLawId, onOpenChange }: Props) {
citation: record.case_number || "", citation: record.case_number || "",
case_name: record.case_name || "", case_name: record.case_name || "",
court: record.court || "", court: record.court || "",
district: record.district || "",
chair_name: record.chair_name || "",
decision_date: record.date ? record.date.slice(0, 10) : "", decision_date: record.date ? record.date.slice(0, 10) : "",
practice_area: (record.practice_area || "") as PracticeArea, practice_area: (record.practice_area || "") as PracticeArea,
appeal_subtype: appealSubtypeLabel(record.appeal_subtype), appeal_subtype: appealSubtypeLabel(record.appeal_subtype),
@@ -95,6 +99,8 @@ export function PrecedentEditSheet({ caseLawId, onOpenChange }: Props) {
const patch: Record<string, unknown> = { const patch: Record<string, unknown> = {
case_name: form.case_name.trim(), case_name: form.case_name.trim(),
court: form.court.trim(), court: form.court.trim(),
district: form.district.trim(),
chair_name: form.chair_name.trim(),
practice_area: form.practice_area || undefined, practice_area: form.practice_area || undefined,
appeal_subtype: form.appeal_subtype.trim(), appeal_subtype: form.appeal_subtype.trim(),
source_type: form.source_type || undefined, source_type: form.source_type || undefined,
@@ -180,6 +186,18 @@ export function PrecedentEditSheet({ caseLawId, onOpenChange }: Props) {
<Input id="court" value={form.court} <Input id="court" value={form.court}
onChange={(e) => setForm({ ...form, court: e.target.value })} /> onChange={(e) => setForm({ ...form, court: e.target.value })} />
</div> </div>
<div className="space-y-1">
<Label htmlFor="district">מחוז</Label>
<Input id="district" value={form.district}
onChange={(e) => setForm({ ...form, district: e.target.value })}
placeholder="ירושלים / תל אביב / מרכז" />
</div>
<div className="space-y-1">
<Label htmlFor="chair-name">יו"ר</Label>
<Input id="chair-name" value={form.chair_name}
onChange={(e) => setForm({ ...form, chair_name: e.target.value })}
placeholder="עו״ד דפנה תמיר" />
</div>
<div className="space-y-1"> <div className="space-y-1">
<Label htmlFor="date">תאריך</Label> <Label htmlFor="date">תאריך</Label>
<Input id="date" type="date" value={form.decision_date} <Input id="date" type="date" value={form.decision_date}

View File

@@ -414,6 +414,8 @@ export type PrecedentPatch = Partial<{
source_type: SourceType; source_type: SourceType;
precedent_level: string; precedent_level: string;
is_binding: boolean; is_binding: boolean;
district: string;
chair_name: string;
}>; }>;
export function useUpdatePrecedent() { export function useUpdatePrecedent() {

View File

@@ -4287,6 +4287,8 @@ class PrecedentUpdateRequest(BaseModel):
source_type: str | None = None source_type: str | None = None
precedent_level: str | None = None precedent_level: str | None = None
is_binding: bool | None = None is_binding: bool | None = None
district: str | None = None
chair_name: str | None = None
class HalachaUpdateRequest(BaseModel): class HalachaUpdateRequest(BaseModel):