Add source manager and inline citing with 'sourced' badges
New /trees/[id]/sources page (list + create sources). Person-detail page now loads tree sources + citations and shows a '✓ N sourced' badge with an inline cite picker (source + page) on each event and on the person. Tree view links to Sources. Regenerated the OpenAPI client. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Justin Paul <justin@jpaul.me>
This commit is contained in:
@@ -56,9 +56,14 @@ export default function TreeDetailPage() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
<Link href="/trees" className="text-sm text-[var(--muted)] hover:underline">
|
<div className="flex items-center justify-between">
|
||||||
← All trees
|
<Link href="/trees" className="text-sm text-[var(--muted)] hover:underline">
|
||||||
</Link>
|
← All trees
|
||||||
|
</Link>
|
||||||
|
<Link href={`/trees/${treeId}/sources`} className="text-sm text-bronze hover:underline">
|
||||||
|
Sources →
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
|
||||||
<Card>
|
<Card>
|
||||||
<CardHeader>
|
<CardHeader>
|
||||||
|
|||||||
@@ -15,10 +15,11 @@ type Event = components["schemas"]["EventRead"];
|
|||||||
type Relationship = components["schemas"]["RelationshipRead"];
|
type Relationship = components["schemas"]["RelationshipRead"];
|
||||||
type Qualifier = components["schemas"]["ParentChildQualifier"];
|
type Qualifier = components["schemas"]["ParentChildQualifier"];
|
||||||
type RelCreate = components["schemas"]["RelationshipCreate"];
|
type RelCreate = components["schemas"]["RelationshipCreate"];
|
||||||
|
type Source = components["schemas"]["SourceRead"];
|
||||||
|
type Citation = components["schemas"]["CitationRead"];
|
||||||
|
type CitationCreate = components["schemas"]["CitationCreate"];
|
||||||
|
|
||||||
const fieldCls =
|
const fieldCls = "h-9 rounded-md border border-[var(--border)] bg-[var(--surface)] px-2 text-sm";
|
||||||
"h-10 rounded-md border border-[var(--border)] bg-[var(--surface)] px-2 text-sm";
|
|
||||||
|
|
||||||
const QUALIFIERS: Qualifier[] = ["biological", "adoptive", "step", "foster", "donor", "guardian"];
|
const QUALIFIERS: Qualifier[] = ["biological", "adoptive", "step", "foster", "donor", "guardian"];
|
||||||
|
|
||||||
export default function PersonDetailPage() {
|
export default function PersonDetailPage() {
|
||||||
@@ -31,6 +32,8 @@ export default function PersonDetailPage() {
|
|||||||
const [people, setPeople] = useState<Person[]>([]);
|
const [people, setPeople] = useState<Person[]>([]);
|
||||||
const [events, setEvents] = useState<Event[]>([]);
|
const [events, setEvents] = useState<Event[]>([]);
|
||||||
const [rels, setRels] = useState<Relationship[]>([]);
|
const [rels, setRels] = useState<Relationship[]>([]);
|
||||||
|
const [sources, setSources] = useState<Source[]>([]);
|
||||||
|
const [citations, setCitations] = useState<Citation[]>([]);
|
||||||
const [ready, setReady] = useState(false);
|
const [ready, setReady] = useState(false);
|
||||||
|
|
||||||
const [evType, setEvType] = useState("birth");
|
const [evType, setEvType] = useState("birth");
|
||||||
@@ -40,6 +43,11 @@ export default function PersonDetailPage() {
|
|||||||
const [relOther, setRelOther] = useState("");
|
const [relOther, setRelOther] = useState("");
|
||||||
const [relQual, setRelQual] = useState<Qualifier>("biological");
|
const [relQual, setRelQual] = useState<Qualifier>("biological");
|
||||||
|
|
||||||
|
// Inline citation form: which fact is being cited ("p" = person, `e:<id>`).
|
||||||
|
const [citeFor, setCiteFor] = useState<string | null>(null);
|
||||||
|
const [citeSource, setCiteSource] = useState("");
|
||||||
|
const [citePage, setCitePage] = useState("");
|
||||||
|
|
||||||
const load = useCallback(async () => {
|
const load = useCallback(async () => {
|
||||||
const p = await api.GET("/api/v1/trees/{tree_id}/persons/{person_id}", {
|
const p = await api.GET("/api/v1/trees/{tree_id}/persons/{person_id}", {
|
||||||
params: { path: { tree_id: treeId, person_id: personId } },
|
params: { path: { tree_id: treeId, person_id: personId } },
|
||||||
@@ -49,7 +57,7 @@ export default function PersonDetailPage() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setPerson(p.data ?? null);
|
setPerson(p.data ?? null);
|
||||||
const [all, ev, rl] = await Promise.all([
|
const [all, ev, rl, src, cit] = await Promise.all([
|
||||||
api.GET("/api/v1/trees/{tree_id}/persons", { params: { path: { tree_id: treeId } } }),
|
api.GET("/api/v1/trees/{tree_id}/persons", { params: { path: { tree_id: treeId } } }),
|
||||||
api.GET("/api/v1/trees/{tree_id}/persons/{person_id}/events", {
|
api.GET("/api/v1/trees/{tree_id}/persons/{person_id}/events", {
|
||||||
params: { path: { tree_id: treeId, person_id: personId } },
|
params: { path: { tree_id: treeId, person_id: personId } },
|
||||||
@@ -57,10 +65,14 @@ export default function PersonDetailPage() {
|
|||||||
api.GET("/api/v1/trees/{tree_id}/persons/{person_id}/relationships", {
|
api.GET("/api/v1/trees/{tree_id}/persons/{person_id}/relationships", {
|
||||||
params: { path: { tree_id: treeId, person_id: personId } },
|
params: { path: { tree_id: treeId, person_id: personId } },
|
||||||
}),
|
}),
|
||||||
|
api.GET("/api/v1/trees/{tree_id}/sources", { params: { path: { tree_id: treeId } } }),
|
||||||
|
api.GET("/api/v1/trees/{tree_id}/citations", { params: { path: { tree_id: treeId } } }),
|
||||||
]);
|
]);
|
||||||
setPeople(all.data ?? []);
|
setPeople(all.data ?? []);
|
||||||
setEvents(ev.data ?? []);
|
setEvents(ev.data ?? []);
|
||||||
setRels(rl.data ?? []);
|
setRels(rl.data ?? []);
|
||||||
|
setSources(src.data ?? []);
|
||||||
|
setCitations(cit.data ?? []);
|
||||||
setReady(true);
|
setReady(true);
|
||||||
}, [router, treeId, personId]);
|
}, [router, treeId, personId]);
|
||||||
|
|
||||||
@@ -72,12 +84,18 @@ export default function PersonDetailPage() {
|
|||||||
const m = new Map(people.map((p) => [p.id, p.primary_name ?? "Unnamed"]));
|
const m = new Map(people.map((p) => [p.id, p.primary_name ?? "Unnamed"]));
|
||||||
return (id: string) => m.get(id) ?? "Unknown";
|
return (id: string) => m.get(id) ?? "Unknown";
|
||||||
}, [people]);
|
}, [people]);
|
||||||
|
const sourceName = useMemo(() => {
|
||||||
|
const m = new Map(sources.map((s) => [s.id, s.title]));
|
||||||
|
return (id: string) => m.get(id) ?? "source";
|
||||||
|
}, [sources]);
|
||||||
|
|
||||||
const others = people.filter((p) => p.id !== personId);
|
const others = people.filter((p) => p.id !== personId);
|
||||||
const parents = rels.filter((r) => r.type === "parent_child" && r.person_to_id === personId);
|
const parents = rels.filter((r) => r.type === "parent_child" && r.person_to_id === personId);
|
||||||
const children = rels.filter((r) => r.type === "parent_child" && r.person_from_id === personId);
|
const children = rels.filter((r) => r.type === "parent_child" && r.person_from_id === personId);
|
||||||
const partners = rels.filter((r) => r.type === "partnership");
|
const partners = rels.filter((r) => r.type === "partnership");
|
||||||
const siblings = rels.filter((r) => r.type === "sibling");
|
const siblings = rels.filter((r) => r.type === "sibling");
|
||||||
|
const eventCites = (id: string) => citations.filter((c) => c.event_id === id);
|
||||||
|
const personCites = citations.filter((c) => c.person_id === personId);
|
||||||
|
|
||||||
async function addEvent(e: React.FormEvent) {
|
async function addEvent(e: React.FormEvent) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@@ -91,7 +109,6 @@ export default function PersonDetailPage() {
|
|||||||
load();
|
load();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function removeEvent(id: string) {
|
async function removeEvent(id: string) {
|
||||||
await api.DELETE("/api/v1/trees/{tree_id}/events/{event_id}", {
|
await api.DELETE("/api/v1/trees/{tree_id}/events/{event_id}", {
|
||||||
params: { path: { tree_id: treeId, event_id: id } },
|
params: { path: { tree_id: treeId, event_id: id } },
|
||||||
@@ -121,7 +138,6 @@ export default function PersonDetailPage() {
|
|||||||
load();
|
load();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function removeRel(id: string) {
|
async function removeRel(id: string) {
|
||||||
await api.DELETE("/api/v1/trees/{tree_id}/relationships/{relationship_id}", {
|
await api.DELETE("/api/v1/trees/{tree_id}/relationships/{relationship_id}", {
|
||||||
params: { path: { tree_id: treeId, relationship_id: id } },
|
params: { path: { tree_id: treeId, relationship_id: id } },
|
||||||
@@ -129,9 +145,100 @@ export default function PersonDetailPage() {
|
|||||||
load();
|
load();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function addCitation(target: Partial<CitationCreate>) {
|
||||||
|
if (!citeSource) return;
|
||||||
|
const body: CitationCreate = { source_id: citeSource, page: citePage || null, ...target };
|
||||||
|
const { error } = await api.POST("/api/v1/trees/{tree_id}/citations", {
|
||||||
|
params: { path: { tree_id: treeId } },
|
||||||
|
body,
|
||||||
|
});
|
||||||
|
if (!error) {
|
||||||
|
setCiteFor(null);
|
||||||
|
setCiteSource("");
|
||||||
|
setCitePage("");
|
||||||
|
load();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async function removeCitation(id: string) {
|
||||||
|
await api.DELETE("/api/v1/trees/{tree_id}/citations/{citation_id}", {
|
||||||
|
params: { path: { tree_id: treeId, citation_id: id } },
|
||||||
|
});
|
||||||
|
load();
|
||||||
|
}
|
||||||
|
|
||||||
if (!ready) return <p className="text-[var(--muted)]">Loading…</p>;
|
if (!ready) return <p className="text-[var(--muted)]">Loading…</p>;
|
||||||
if (!person) return <p className="text-[var(--muted)]">Not found.</p>;
|
if (!person) return <p className="text-[var(--muted)]">Not found.</p>;
|
||||||
|
|
||||||
|
// Inline "cite" control: a badge with count, a toggle, and the picker form.
|
||||||
|
function citeControl(key: string, target: Partial<CitationCreate>, cites: Citation[]) {
|
||||||
|
return (
|
||||||
|
<span className="inline-flex items-center gap-2">
|
||||||
|
{cites.length > 0 && (
|
||||||
|
<span
|
||||||
|
className="rounded bg-bronze/15 px-1.5 py-0.5 text-xs text-bronze"
|
||||||
|
title={cites.map((c) => sourceName(c.source_id)).join(", ")}
|
||||||
|
>
|
||||||
|
✓ {cites.length} sourced
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
{citeFor === key ? (
|
||||||
|
<form
|
||||||
|
onSubmit={(e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
addCitation(target);
|
||||||
|
}}
|
||||||
|
className="inline-flex items-center gap-1"
|
||||||
|
>
|
||||||
|
<select
|
||||||
|
className={fieldCls}
|
||||||
|
value={citeSource}
|
||||||
|
onChange={(e) => setCiteSource(e.target.value)}
|
||||||
|
>
|
||||||
|
<option value="">— source —</option>
|
||||||
|
{sources.map((s) => (
|
||||||
|
<option key={s.id} value={s.id}>
|
||||||
|
{s.title}
|
||||||
|
</option>
|
||||||
|
))}
|
||||||
|
</select>
|
||||||
|
<input
|
||||||
|
className={`${fieldCls} w-24`}
|
||||||
|
placeholder="page"
|
||||||
|
value={citePage}
|
||||||
|
onChange={(e) => setCitePage(e.target.value)}
|
||||||
|
/>
|
||||||
|
<Button type="submit" size="sm">
|
||||||
|
cite
|
||||||
|
</Button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => setCiteFor(null)}
|
||||||
|
className="text-xs text-[var(--muted)]"
|
||||||
|
>
|
||||||
|
cancel
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
) : sources.length === 0 ? (
|
||||||
|
<Link href={`/trees/${treeId}/sources`} className="text-xs text-[var(--muted)] hover:underline">
|
||||||
|
+ add a source first
|
||||||
|
</Link>
|
||||||
|
) : (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => {
|
||||||
|
setCiteFor(key);
|
||||||
|
setCiteSource("");
|
||||||
|
setCitePage("");
|
||||||
|
}}
|
||||||
|
className="text-xs text-bronze hover:underline"
|
||||||
|
>
|
||||||
|
+ cite
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const relGroup = (label: string, items: Relationship[], otherId: (r: Relationship) => string) =>
|
const relGroup = (label: string, items: Relationship[], otherId: (r: Relationship) => string) =>
|
||||||
items.length > 0 && (
|
items.length > 0 && (
|
||||||
<div>
|
<div>
|
||||||
@@ -162,7 +269,10 @@ export default function PersonDetailPage() {
|
|||||||
← Back to tree
|
← Back to tree
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
<h1 className="text-3xl font-semibold">{person.primary_name ?? "Unnamed person"}</h1>
|
<div className="flex flex-wrap items-center justify-between gap-2">
|
||||||
|
<h1 className="text-3xl font-semibold">{person.primary_name ?? "Unnamed person"}</h1>
|
||||||
|
{citeControl("p", { person_id: personId }, personCites)}
|
||||||
|
</div>
|
||||||
|
|
||||||
<Card>
|
<Card>
|
||||||
<CardHeader>
|
<CardHeader>
|
||||||
@@ -172,39 +282,32 @@ export default function PersonDetailPage() {
|
|||||||
{events.length === 0 ? (
|
{events.length === 0 ? (
|
||||||
<p className="text-sm text-[var(--muted)]">No events yet.</p>
|
<p className="text-sm text-[var(--muted)]">No events yet.</p>
|
||||||
) : (
|
) : (
|
||||||
<ul className="space-y-1">
|
<ul className="space-y-2">
|
||||||
{events.map((ev) => (
|
{events.map((ev) => (
|
||||||
<li key={ev.id} className="flex items-center justify-between text-sm">
|
<li key={ev.id} className="flex flex-wrap items-center justify-between gap-2 text-sm">
|
||||||
<span>
|
<span>
|
||||||
<span className="font-medium capitalize">{ev.event_type}</span>
|
<span className="font-medium capitalize">{ev.event_type}</span>
|
||||||
{ev.date_value ? (
|
{ev.date_value ? (
|
||||||
<span className="text-[var(--muted)]"> — {ev.date_value}</span>
|
<span className="text-[var(--muted)]"> — {ev.date_value}</span>
|
||||||
) : null}
|
) : null}
|
||||||
</span>
|
</span>
|
||||||
<button
|
<span className="flex items-center gap-3">
|
||||||
onClick={() => removeEvent(ev.id)}
|
{citeControl(`e:${ev.id}`, { event_id: ev.id }, eventCites(ev.id))}
|
||||||
className="text-[var(--muted)] hover:text-bronze"
|
<button
|
||||||
aria-label="Remove"
|
onClick={() => removeEvent(ev.id)}
|
||||||
>
|
className="text-[var(--muted)] hover:text-bronze"
|
||||||
×
|
aria-label="Remove"
|
||||||
</button>
|
>
|
||||||
|
×
|
||||||
|
</button>
|
||||||
|
</span>
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
)}
|
)}
|
||||||
<form onSubmit={addEvent} className="flex flex-wrap gap-2">
|
<form onSubmit={addEvent} className="flex flex-wrap gap-2">
|
||||||
<Input
|
<Input className="w-36" placeholder="Event type" value={evType} onChange={(e) => setEvType(e.target.value)} />
|
||||||
className="w-36"
|
<Input className="w-40" placeholder="Date (e.g. ABT 1850)" value={evDate} onChange={(e) => setEvDate(e.target.value)} />
|
||||||
placeholder="Event type"
|
|
||||||
value={evType}
|
|
||||||
onChange={(e) => setEvType(e.target.value)}
|
|
||||||
/>
|
|
||||||
<Input
|
|
||||||
className="w-40"
|
|
||||||
placeholder="Date (e.g. ABT 1850)"
|
|
||||||
value={evDate}
|
|
||||||
onChange={(e) => setEvDate(e.target.value)}
|
|
||||||
/>
|
|
||||||
<Button type="submit">Add event</Button>
|
<Button type="submit">Add event</Button>
|
||||||
</form>
|
</form>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
@@ -235,21 +338,13 @@ export default function PersonDetailPage() {
|
|||||||
) : (
|
) : (
|
||||||
<form onSubmit={addRel} className="flex flex-wrap items-center gap-2">
|
<form onSubmit={addRel} className="flex flex-wrap items-center gap-2">
|
||||||
<span className="text-sm text-[var(--muted)]">Add</span>
|
<span className="text-sm text-[var(--muted)]">Add</span>
|
||||||
<select
|
<select className={fieldCls} value={relKind} onChange={(e) => setRelKind(e.target.value as typeof relKind)}>
|
||||||
className={fieldCls}
|
|
||||||
value={relKind}
|
|
||||||
onChange={(e) => setRelKind(e.target.value as typeof relKind)}
|
|
||||||
>
|
|
||||||
<option value="parent">parent</option>
|
<option value="parent">parent</option>
|
||||||
<option value="child">child</option>
|
<option value="child">child</option>
|
||||||
<option value="partner">partner</option>
|
<option value="partner">partner</option>
|
||||||
<option value="sibling">sibling</option>
|
<option value="sibling">sibling</option>
|
||||||
</select>
|
</select>
|
||||||
<select
|
<select className={fieldCls} value={relOther} onChange={(e) => setRelOther(e.target.value)}>
|
||||||
className={fieldCls}
|
|
||||||
value={relOther}
|
|
||||||
onChange={(e) => setRelOther(e.target.value)}
|
|
||||||
>
|
|
||||||
<option value="">— person —</option>
|
<option value="">— person —</option>
|
||||||
{others.map((p) => (
|
{others.map((p) => (
|
||||||
<option key={p.id} value={p.id}>
|
<option key={p.id} value={p.id}>
|
||||||
@@ -258,11 +353,7 @@ export default function PersonDetailPage() {
|
|||||||
))}
|
))}
|
||||||
</select>
|
</select>
|
||||||
{(relKind === "parent" || relKind === "child") && (
|
{(relKind === "parent" || relKind === "child") && (
|
||||||
<select
|
<select className={fieldCls} value={relQual} onChange={(e) => setRelQual(e.target.value as Qualifier)}>
|
||||||
className={fieldCls}
|
|
||||||
value={relQual}
|
|
||||||
onChange={(e) => setRelQual(e.target.value as Qualifier)}
|
|
||||||
>
|
|
||||||
{QUALIFIERS.map((q) => (
|
{QUALIFIERS.map((q) => (
|
||||||
<option key={q} value={q}>
|
<option key={q} value={q}>
|
||||||
{q}
|
{q}
|
||||||
|
|||||||
@@ -0,0 +1,131 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import Link from "next/link";
|
||||||
|
import { useParams, useRouter } from "next/navigation";
|
||||||
|
import { useCallback, useEffect, useState } from "react";
|
||||||
|
|
||||||
|
import { api } from "@/lib/api/client";
|
||||||
|
import type { components } from "@/lib/api/schema";
|
||||||
|
import { Button } from "@/components/ui/button";
|
||||||
|
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||||
|
import { Input } from "@/components/ui/input";
|
||||||
|
|
||||||
|
type Source = components["schemas"]["SourceRead"];
|
||||||
|
|
||||||
|
export default function SourcesPage() {
|
||||||
|
const router = useRouter();
|
||||||
|
const params = useParams<{ id: string }>();
|
||||||
|
const treeId = params.id;
|
||||||
|
|
||||||
|
const [sources, setSources] = useState<Source[]>([]);
|
||||||
|
const [ready, setReady] = useState(false);
|
||||||
|
const [title, setTitle] = useState("");
|
||||||
|
const [repository, setRepository] = useState("");
|
||||||
|
const [url, setUrl] = useState("");
|
||||||
|
|
||||||
|
const load = useCallback(async () => {
|
||||||
|
const { data, response } = await api.GET("/api/v1/trees/{tree_id}/sources", {
|
||||||
|
params: { path: { tree_id: treeId } },
|
||||||
|
});
|
||||||
|
if (response.status === 401) {
|
||||||
|
router.push("/login");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setSources(data ?? []);
|
||||||
|
setReady(true);
|
||||||
|
}, [router, treeId]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
load();
|
||||||
|
}, [load]);
|
||||||
|
|
||||||
|
async function add(e: React.FormEvent) {
|
||||||
|
e.preventDefault();
|
||||||
|
if (!title.trim()) return;
|
||||||
|
const { error } = await api.POST("/api/v1/trees/{tree_id}/sources", {
|
||||||
|
params: { path: { tree_id: treeId } },
|
||||||
|
body: { title, repository: repository || null, url: url || null },
|
||||||
|
});
|
||||||
|
if (!error) {
|
||||||
|
setTitle("");
|
||||||
|
setRepository("");
|
||||||
|
setUrl("");
|
||||||
|
load();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function remove(id: string) {
|
||||||
|
await api.DELETE("/api/v1/trees/{tree_id}/sources/{source_id}", {
|
||||||
|
params: { path: { tree_id: treeId, source_id: id } },
|
||||||
|
});
|
||||||
|
load();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ready) return <p className="text-[var(--muted)]">Loading…</p>;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="space-y-6">
|
||||||
|
<Link href={`/trees/${treeId}`} className="text-sm text-[var(--muted)] hover:underline">
|
||||||
|
← Back to tree
|
||||||
|
</Link>
|
||||||
|
<h1 className="text-2xl font-bold">Sources</h1>
|
||||||
|
|
||||||
|
<Card>
|
||||||
|
<CardHeader>
|
||||||
|
<CardTitle className="text-base">New source</CardTitle>
|
||||||
|
</CardHeader>
|
||||||
|
<CardContent>
|
||||||
|
<form onSubmit={add} className="flex flex-wrap gap-2">
|
||||||
|
<Input
|
||||||
|
className="w-56"
|
||||||
|
placeholder="Title (e.g. 1880 US Census)"
|
||||||
|
value={title}
|
||||||
|
onChange={(e) => setTitle(e.target.value)}
|
||||||
|
/>
|
||||||
|
<Input
|
||||||
|
className="w-40"
|
||||||
|
placeholder="Repository"
|
||||||
|
value={repository}
|
||||||
|
onChange={(e) => setRepository(e.target.value)}
|
||||||
|
/>
|
||||||
|
<Input
|
||||||
|
className="w-48"
|
||||||
|
placeholder="URL"
|
||||||
|
value={url}
|
||||||
|
onChange={(e) => setUrl(e.target.value)}
|
||||||
|
/>
|
||||||
|
<Button type="submit">Add source</Button>
|
||||||
|
</form>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
|
||||||
|
{sources.length === 0 ? (
|
||||||
|
<p className="text-[var(--muted)]">No sources yet — add one above, then cite it on facts.</p>
|
||||||
|
) : (
|
||||||
|
<ul className="space-y-2">
|
||||||
|
{sources.map((s) => (
|
||||||
|
<li key={s.id}>
|
||||||
|
<Card>
|
||||||
|
<CardContent className="flex items-start justify-between gap-3 p-4">
|
||||||
|
<div>
|
||||||
|
<div className="font-medium">{s.title}</div>
|
||||||
|
<div className="text-sm text-[var(--muted)]">
|
||||||
|
{[s.repository, s.url].filter(Boolean).join(" · ")}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
onClick={() => remove(s.id)}
|
||||||
|
className="text-[var(--muted)] hover:text-bronze"
|
||||||
|
aria-label="Remove"
|
||||||
|
>
|
||||||
|
×
|
||||||
|
</button>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
Vendored
+410
@@ -329,10 +329,143 @@ export interface paths {
|
|||||||
patch?: never;
|
patch?: never;
|
||||||
trace?: never;
|
trace?: never;
|
||||||
};
|
};
|
||||||
|
"/api/v1/trees/{tree_id}/sources": {
|
||||||
|
parameters: {
|
||||||
|
query?: never;
|
||||||
|
header?: never;
|
||||||
|
path?: never;
|
||||||
|
cookie?: never;
|
||||||
|
};
|
||||||
|
/** List Sources */
|
||||||
|
get: operations["list_sources_api_v1_trees__tree_id__sources_get"];
|
||||||
|
put?: never;
|
||||||
|
/** Create Source */
|
||||||
|
post: operations["create_source_api_v1_trees__tree_id__sources_post"];
|
||||||
|
delete?: never;
|
||||||
|
options?: never;
|
||||||
|
head?: never;
|
||||||
|
patch?: never;
|
||||||
|
trace?: never;
|
||||||
|
};
|
||||||
|
"/api/v1/trees/{tree_id}/sources/{source_id}": {
|
||||||
|
parameters: {
|
||||||
|
query?: never;
|
||||||
|
header?: never;
|
||||||
|
path?: never;
|
||||||
|
cookie?: never;
|
||||||
|
};
|
||||||
|
/** Get Source */
|
||||||
|
get: operations["get_source_api_v1_trees__tree_id__sources__source_id__get"];
|
||||||
|
put?: never;
|
||||||
|
post?: never;
|
||||||
|
/** Delete Source */
|
||||||
|
delete: operations["delete_source_api_v1_trees__tree_id__sources__source_id__delete"];
|
||||||
|
options?: never;
|
||||||
|
head?: never;
|
||||||
|
patch?: never;
|
||||||
|
trace?: never;
|
||||||
|
};
|
||||||
|
"/api/v1/trees/{tree_id}/citations": {
|
||||||
|
parameters: {
|
||||||
|
query?: never;
|
||||||
|
header?: never;
|
||||||
|
path?: never;
|
||||||
|
cookie?: never;
|
||||||
|
};
|
||||||
|
/** List Citations */
|
||||||
|
get: operations["list_citations_api_v1_trees__tree_id__citations_get"];
|
||||||
|
put?: never;
|
||||||
|
/** Create Citation */
|
||||||
|
post: operations["create_citation_api_v1_trees__tree_id__citations_post"];
|
||||||
|
delete?: never;
|
||||||
|
options?: never;
|
||||||
|
head?: never;
|
||||||
|
patch?: never;
|
||||||
|
trace?: never;
|
||||||
|
};
|
||||||
|
"/api/v1/trees/{tree_id}/citations/{citation_id}": {
|
||||||
|
parameters: {
|
||||||
|
query?: never;
|
||||||
|
header?: never;
|
||||||
|
path?: never;
|
||||||
|
cookie?: never;
|
||||||
|
};
|
||||||
|
get?: never;
|
||||||
|
put?: never;
|
||||||
|
post?: never;
|
||||||
|
/** Delete Citation */
|
||||||
|
delete: operations["delete_citation_api_v1_trees__tree_id__citations__citation_id__delete"];
|
||||||
|
options?: never;
|
||||||
|
head?: never;
|
||||||
|
patch?: never;
|
||||||
|
trace?: never;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
export type webhooks = Record<string, never>;
|
export type webhooks = Record<string, never>;
|
||||||
export interface components {
|
export interface components {
|
||||||
schemas: {
|
schemas: {
|
||||||
|
/**
|
||||||
|
* CitationConfidence
|
||||||
|
* @enum {string}
|
||||||
|
*/
|
||||||
|
CitationConfidence: "high" | "medium" | "low";
|
||||||
|
/** CitationCreate */
|
||||||
|
CitationCreate: {
|
||||||
|
/**
|
||||||
|
* Source Id
|
||||||
|
* Format: uuid
|
||||||
|
*/
|
||||||
|
source_id: string;
|
||||||
|
/** Person Id */
|
||||||
|
person_id?: string | null;
|
||||||
|
/** Event Id */
|
||||||
|
event_id?: string | null;
|
||||||
|
/** Name Id */
|
||||||
|
name_id?: string | null;
|
||||||
|
/** Relationship Id */
|
||||||
|
relationship_id?: string | null;
|
||||||
|
/** Page */
|
||||||
|
page?: string | null;
|
||||||
|
/** Detail */
|
||||||
|
detail?: string | null;
|
||||||
|
confidence?: components["schemas"]["CitationConfidence"] | null;
|
||||||
|
};
|
||||||
|
/** CitationRead */
|
||||||
|
CitationRead: {
|
||||||
|
/**
|
||||||
|
* Id
|
||||||
|
* Format: uuid
|
||||||
|
*/
|
||||||
|
id: string;
|
||||||
|
/**
|
||||||
|
* Tree Id
|
||||||
|
* Format: uuid
|
||||||
|
*/
|
||||||
|
tree_id: string;
|
||||||
|
/**
|
||||||
|
* Source Id
|
||||||
|
* Format: uuid
|
||||||
|
*/
|
||||||
|
source_id: string;
|
||||||
|
/** Person Id */
|
||||||
|
person_id: string | null;
|
||||||
|
/** Event Id */
|
||||||
|
event_id: string | null;
|
||||||
|
/** Name Id */
|
||||||
|
name_id: string | null;
|
||||||
|
/** Relationship Id */
|
||||||
|
relationship_id: string | null;
|
||||||
|
/** Page */
|
||||||
|
page: string | null;
|
||||||
|
/** Detail */
|
||||||
|
detail: string | null;
|
||||||
|
confidence: components["schemas"]["CitationConfidence"] | null;
|
||||||
|
/**
|
||||||
|
* Created At
|
||||||
|
* Format: date-time
|
||||||
|
*/
|
||||||
|
created_at: string;
|
||||||
|
};
|
||||||
/** EventCreate */
|
/** EventCreate */
|
||||||
EventCreate: {
|
EventCreate: {
|
||||||
/** Event Type */
|
/** Event Type */
|
||||||
@@ -552,6 +685,59 @@ export interface components {
|
|||||||
*/
|
*/
|
||||||
expires_at: string;
|
expires_at: string;
|
||||||
};
|
};
|
||||||
|
/** SourceCreate */
|
||||||
|
SourceCreate: {
|
||||||
|
/** Title */
|
||||||
|
title: string;
|
||||||
|
/** Author */
|
||||||
|
author?: string | null;
|
||||||
|
/** Source Type */
|
||||||
|
source_type?: string | null;
|
||||||
|
/** Repository */
|
||||||
|
repository?: string | null;
|
||||||
|
/** Url */
|
||||||
|
url?: string | null;
|
||||||
|
/** Citation Text */
|
||||||
|
citation_text?: string | null;
|
||||||
|
/** Publication Info */
|
||||||
|
publication_info?: string | null;
|
||||||
|
/** Quality Note */
|
||||||
|
quality_note?: string | null;
|
||||||
|
};
|
||||||
|
/** SourceRead */
|
||||||
|
SourceRead: {
|
||||||
|
/**
|
||||||
|
* Id
|
||||||
|
* Format: uuid
|
||||||
|
*/
|
||||||
|
id: string;
|
||||||
|
/**
|
||||||
|
* Tree Id
|
||||||
|
* Format: uuid
|
||||||
|
*/
|
||||||
|
tree_id: string;
|
||||||
|
/** Title */
|
||||||
|
title: string;
|
||||||
|
/** Author */
|
||||||
|
author: string | null;
|
||||||
|
/** Source Type */
|
||||||
|
source_type: string | null;
|
||||||
|
/** Repository */
|
||||||
|
repository: string | null;
|
||||||
|
/** Url */
|
||||||
|
url: string | null;
|
||||||
|
/** Citation Text */
|
||||||
|
citation_text: string | null;
|
||||||
|
/** Publication Info */
|
||||||
|
publication_info: string | null;
|
||||||
|
/** Quality Note */
|
||||||
|
quality_note: string | null;
|
||||||
|
/**
|
||||||
|
* Created At
|
||||||
|
* Format: date-time
|
||||||
|
*/
|
||||||
|
created_at: string;
|
||||||
|
};
|
||||||
/** TokenRequest */
|
/** TokenRequest */
|
||||||
TokenRequest: {
|
TokenRequest: {
|
||||||
/** Token */
|
/** Token */
|
||||||
@@ -1256,4 +1442,228 @@ export interface operations {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
list_sources_api_v1_trees__tree_id__sources_get: {
|
||||||
|
parameters: {
|
||||||
|
query?: never;
|
||||||
|
header?: never;
|
||||||
|
path: {
|
||||||
|
tree_id: string;
|
||||||
|
};
|
||||||
|
cookie?: never;
|
||||||
|
};
|
||||||
|
requestBody?: never;
|
||||||
|
responses: {
|
||||||
|
/** @description Successful Response */
|
||||||
|
200: {
|
||||||
|
headers: {
|
||||||
|
[name: string]: unknown;
|
||||||
|
};
|
||||||
|
content: {
|
||||||
|
"application/json": components["schemas"]["SourceRead"][];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
/** @description Validation Error */
|
||||||
|
422: {
|
||||||
|
headers: {
|
||||||
|
[name: string]: unknown;
|
||||||
|
};
|
||||||
|
content: {
|
||||||
|
"application/json": components["schemas"]["HTTPValidationError"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
create_source_api_v1_trees__tree_id__sources_post: {
|
||||||
|
parameters: {
|
||||||
|
query?: never;
|
||||||
|
header?: never;
|
||||||
|
path: {
|
||||||
|
tree_id: string;
|
||||||
|
};
|
||||||
|
cookie?: never;
|
||||||
|
};
|
||||||
|
requestBody: {
|
||||||
|
content: {
|
||||||
|
"application/json": components["schemas"]["SourceCreate"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
responses: {
|
||||||
|
/** @description Successful Response */
|
||||||
|
201: {
|
||||||
|
headers: {
|
||||||
|
[name: string]: unknown;
|
||||||
|
};
|
||||||
|
content: {
|
||||||
|
"application/json": components["schemas"]["SourceRead"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
/** @description Validation Error */
|
||||||
|
422: {
|
||||||
|
headers: {
|
||||||
|
[name: string]: unknown;
|
||||||
|
};
|
||||||
|
content: {
|
||||||
|
"application/json": components["schemas"]["HTTPValidationError"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
get_source_api_v1_trees__tree_id__sources__source_id__get: {
|
||||||
|
parameters: {
|
||||||
|
query?: never;
|
||||||
|
header?: never;
|
||||||
|
path: {
|
||||||
|
tree_id: string;
|
||||||
|
source_id: string;
|
||||||
|
};
|
||||||
|
cookie?: never;
|
||||||
|
};
|
||||||
|
requestBody?: never;
|
||||||
|
responses: {
|
||||||
|
/** @description Successful Response */
|
||||||
|
200: {
|
||||||
|
headers: {
|
||||||
|
[name: string]: unknown;
|
||||||
|
};
|
||||||
|
content: {
|
||||||
|
"application/json": components["schemas"]["SourceRead"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
/** @description Validation Error */
|
||||||
|
422: {
|
||||||
|
headers: {
|
||||||
|
[name: string]: unknown;
|
||||||
|
};
|
||||||
|
content: {
|
||||||
|
"application/json": components["schemas"]["HTTPValidationError"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
delete_source_api_v1_trees__tree_id__sources__source_id__delete: {
|
||||||
|
parameters: {
|
||||||
|
query?: never;
|
||||||
|
header?: never;
|
||||||
|
path: {
|
||||||
|
tree_id: string;
|
||||||
|
source_id: string;
|
||||||
|
};
|
||||||
|
cookie?: never;
|
||||||
|
};
|
||||||
|
requestBody?: never;
|
||||||
|
responses: {
|
||||||
|
/** @description Successful Response */
|
||||||
|
204: {
|
||||||
|
headers: {
|
||||||
|
[name: string]: unknown;
|
||||||
|
};
|
||||||
|
content?: never;
|
||||||
|
};
|
||||||
|
/** @description Validation Error */
|
||||||
|
422: {
|
||||||
|
headers: {
|
||||||
|
[name: string]: unknown;
|
||||||
|
};
|
||||||
|
content: {
|
||||||
|
"application/json": components["schemas"]["HTTPValidationError"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
list_citations_api_v1_trees__tree_id__citations_get: {
|
||||||
|
parameters: {
|
||||||
|
query?: never;
|
||||||
|
header?: never;
|
||||||
|
path: {
|
||||||
|
tree_id: string;
|
||||||
|
};
|
||||||
|
cookie?: never;
|
||||||
|
};
|
||||||
|
requestBody?: never;
|
||||||
|
responses: {
|
||||||
|
/** @description Successful Response */
|
||||||
|
200: {
|
||||||
|
headers: {
|
||||||
|
[name: string]: unknown;
|
||||||
|
};
|
||||||
|
content: {
|
||||||
|
"application/json": components["schemas"]["CitationRead"][];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
/** @description Validation Error */
|
||||||
|
422: {
|
||||||
|
headers: {
|
||||||
|
[name: string]: unknown;
|
||||||
|
};
|
||||||
|
content: {
|
||||||
|
"application/json": components["schemas"]["HTTPValidationError"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
create_citation_api_v1_trees__tree_id__citations_post: {
|
||||||
|
parameters: {
|
||||||
|
query?: never;
|
||||||
|
header?: never;
|
||||||
|
path: {
|
||||||
|
tree_id: string;
|
||||||
|
};
|
||||||
|
cookie?: never;
|
||||||
|
};
|
||||||
|
requestBody: {
|
||||||
|
content: {
|
||||||
|
"application/json": components["schemas"]["CitationCreate"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
responses: {
|
||||||
|
/** @description Successful Response */
|
||||||
|
201: {
|
||||||
|
headers: {
|
||||||
|
[name: string]: unknown;
|
||||||
|
};
|
||||||
|
content: {
|
||||||
|
"application/json": components["schemas"]["CitationRead"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
/** @description Validation Error */
|
||||||
|
422: {
|
||||||
|
headers: {
|
||||||
|
[name: string]: unknown;
|
||||||
|
};
|
||||||
|
content: {
|
||||||
|
"application/json": components["schemas"]["HTTPValidationError"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
delete_citation_api_v1_trees__tree_id__citations__citation_id__delete: {
|
||||||
|
parameters: {
|
||||||
|
query?: never;
|
||||||
|
header?: never;
|
||||||
|
path: {
|
||||||
|
tree_id: string;
|
||||||
|
citation_id: string;
|
||||||
|
};
|
||||||
|
cookie?: never;
|
||||||
|
};
|
||||||
|
requestBody?: never;
|
||||||
|
responses: {
|
||||||
|
/** @description Successful Response */
|
||||||
|
204: {
|
||||||
|
headers: {
|
||||||
|
[name: string]: unknown;
|
||||||
|
};
|
||||||
|
content?: never;
|
||||||
|
};
|
||||||
|
/** @description Validation Error */
|
||||||
|
422: {
|
||||||
|
headers: {
|
||||||
|
[name: string]: unknown;
|
||||||
|
};
|
||||||
|
content: {
|
||||||
|
"application/json": components["schemas"]["HTTPValidationError"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -849,10 +849,571 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"/api/v1/trees/{tree_id}/sources": {
|
||||||
|
"post": {
|
||||||
|
"tags": [
|
||||||
|
"sources"
|
||||||
|
],
|
||||||
|
"summary": "Create Source",
|
||||||
|
"operationId": "create_source_api_v1_trees__tree_id__sources_post",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "tree_id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "uuid",
|
||||||
|
"title": "Tree Id"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"requestBody": {
|
||||||
|
"required": true,
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/SourceCreate"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responses": {
|
||||||
|
"201": {
|
||||||
|
"description": "Successful Response",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/SourceRead"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"422": {
|
||||||
|
"description": "Validation Error",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/HTTPValidationError"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"sources"
|
||||||
|
],
|
||||||
|
"summary": "List Sources",
|
||||||
|
"operationId": "list_sources_api_v1_trees__tree_id__sources_get",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "tree_id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "uuid",
|
||||||
|
"title": "Tree Id"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Successful Response",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/components/schemas/SourceRead"
|
||||||
|
},
|
||||||
|
"title": "Response List Sources Api V1 Trees Tree Id Sources Get"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"422": {
|
||||||
|
"description": "Validation Error",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/HTTPValidationError"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/api/v1/trees/{tree_id}/sources/{source_id}": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"sources"
|
||||||
|
],
|
||||||
|
"summary": "Get Source",
|
||||||
|
"operationId": "get_source_api_v1_trees__tree_id__sources__source_id__get",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "tree_id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "uuid",
|
||||||
|
"title": "Tree Id"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "source_id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "uuid",
|
||||||
|
"title": "Source Id"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Successful Response",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/SourceRead"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"422": {
|
||||||
|
"description": "Validation Error",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/HTTPValidationError"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"delete": {
|
||||||
|
"tags": [
|
||||||
|
"sources"
|
||||||
|
],
|
||||||
|
"summary": "Delete Source",
|
||||||
|
"operationId": "delete_source_api_v1_trees__tree_id__sources__source_id__delete",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "tree_id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "uuid",
|
||||||
|
"title": "Tree Id"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "source_id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "uuid",
|
||||||
|
"title": "Source Id"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"204": {
|
||||||
|
"description": "Successful Response"
|
||||||
|
},
|
||||||
|
"422": {
|
||||||
|
"description": "Validation Error",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/HTTPValidationError"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/api/v1/trees/{tree_id}/citations": {
|
||||||
|
"post": {
|
||||||
|
"tags": [
|
||||||
|
"citations"
|
||||||
|
],
|
||||||
|
"summary": "Create Citation",
|
||||||
|
"operationId": "create_citation_api_v1_trees__tree_id__citations_post",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "tree_id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "uuid",
|
||||||
|
"title": "Tree Id"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"requestBody": {
|
||||||
|
"required": true,
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/CitationCreate"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responses": {
|
||||||
|
"201": {
|
||||||
|
"description": "Successful Response",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/CitationRead"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"422": {
|
||||||
|
"description": "Validation Error",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/HTTPValidationError"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"citations"
|
||||||
|
],
|
||||||
|
"summary": "List Citations",
|
||||||
|
"operationId": "list_citations_api_v1_trees__tree_id__citations_get",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "tree_id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "uuid",
|
||||||
|
"title": "Tree Id"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Successful Response",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/components/schemas/CitationRead"
|
||||||
|
},
|
||||||
|
"title": "Response List Citations Api V1 Trees Tree Id Citations Get"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"422": {
|
||||||
|
"description": "Validation Error",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/HTTPValidationError"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/api/v1/trees/{tree_id}/citations/{citation_id}": {
|
||||||
|
"delete": {
|
||||||
|
"tags": [
|
||||||
|
"citations"
|
||||||
|
],
|
||||||
|
"summary": "Delete Citation",
|
||||||
|
"operationId": "delete_citation_api_v1_trees__tree_id__citations__citation_id__delete",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "tree_id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "uuid",
|
||||||
|
"title": "Tree Id"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "citation_id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "uuid",
|
||||||
|
"title": "Citation Id"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"204": {
|
||||||
|
"description": "Successful Response"
|
||||||
|
},
|
||||||
|
"422": {
|
||||||
|
"description": "Validation Error",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/HTTPValidationError"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"components": {
|
"components": {
|
||||||
"schemas": {
|
"schemas": {
|
||||||
|
"CitationConfidence": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"high",
|
||||||
|
"medium",
|
||||||
|
"low"
|
||||||
|
],
|
||||||
|
"title": "CitationConfidence"
|
||||||
|
},
|
||||||
|
"CitationCreate": {
|
||||||
|
"properties": {
|
||||||
|
"source_id": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "uuid",
|
||||||
|
"title": "Source Id"
|
||||||
|
},
|
||||||
|
"person_id": {
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"format": "uuid"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Person Id"
|
||||||
|
},
|
||||||
|
"event_id": {
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"format": "uuid"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Event Id"
|
||||||
|
},
|
||||||
|
"name_id": {
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"format": "uuid"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Name Id"
|
||||||
|
},
|
||||||
|
"relationship_id": {
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"format": "uuid"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Relationship Id"
|
||||||
|
},
|
||||||
|
"page": {
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Page"
|
||||||
|
},
|
||||||
|
"detail": {
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Detail"
|
||||||
|
},
|
||||||
|
"confidence": {
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/components/schemas/CitationConfidence"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"source_id"
|
||||||
|
],
|
||||||
|
"title": "CitationCreate"
|
||||||
|
},
|
||||||
|
"CitationRead": {
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "uuid",
|
||||||
|
"title": "Id"
|
||||||
|
},
|
||||||
|
"tree_id": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "uuid",
|
||||||
|
"title": "Tree Id"
|
||||||
|
},
|
||||||
|
"source_id": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "uuid",
|
||||||
|
"title": "Source Id"
|
||||||
|
},
|
||||||
|
"person_id": {
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"format": "uuid"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Person Id"
|
||||||
|
},
|
||||||
|
"event_id": {
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"format": "uuid"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Event Id"
|
||||||
|
},
|
||||||
|
"name_id": {
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"format": "uuid"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Name Id"
|
||||||
|
},
|
||||||
|
"relationship_id": {
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"format": "uuid"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Relationship Id"
|
||||||
|
},
|
||||||
|
"page": {
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Page"
|
||||||
|
},
|
||||||
|
"detail": {
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Detail"
|
||||||
|
},
|
||||||
|
"confidence": {
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/components/schemas/CitationConfidence"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "date-time",
|
||||||
|
"title": "Created At"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"id",
|
||||||
|
"tree_id",
|
||||||
|
"source_id",
|
||||||
|
"person_id",
|
||||||
|
"event_id",
|
||||||
|
"name_id",
|
||||||
|
"relationship_id",
|
||||||
|
"page",
|
||||||
|
"detail",
|
||||||
|
"confidence",
|
||||||
|
"created_at"
|
||||||
|
],
|
||||||
|
"title": "CitationRead"
|
||||||
|
},
|
||||||
"EventCreate": {
|
"EventCreate": {
|
||||||
"properties": {
|
"properties": {
|
||||||
"event_type": {
|
"event_type": {
|
||||||
@@ -1512,6 +2073,211 @@
|
|||||||
],
|
],
|
||||||
"title": "SessionRead"
|
"title": "SessionRead"
|
||||||
},
|
},
|
||||||
|
"SourceCreate": {
|
||||||
|
"properties": {
|
||||||
|
"title": {
|
||||||
|
"type": "string",
|
||||||
|
"title": "Title"
|
||||||
|
},
|
||||||
|
"author": {
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Author"
|
||||||
|
},
|
||||||
|
"source_type": {
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Source Type"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Repository"
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Url"
|
||||||
|
},
|
||||||
|
"citation_text": {
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Citation Text"
|
||||||
|
},
|
||||||
|
"publication_info": {
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Publication Info"
|
||||||
|
},
|
||||||
|
"quality_note": {
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Quality Note"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"title"
|
||||||
|
],
|
||||||
|
"title": "SourceCreate"
|
||||||
|
},
|
||||||
|
"SourceRead": {
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "uuid",
|
||||||
|
"title": "Id"
|
||||||
|
},
|
||||||
|
"tree_id": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "uuid",
|
||||||
|
"title": "Tree Id"
|
||||||
|
},
|
||||||
|
"title": {
|
||||||
|
"type": "string",
|
||||||
|
"title": "Title"
|
||||||
|
},
|
||||||
|
"author": {
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Author"
|
||||||
|
},
|
||||||
|
"source_type": {
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Source Type"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Repository"
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Url"
|
||||||
|
},
|
||||||
|
"citation_text": {
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Citation Text"
|
||||||
|
},
|
||||||
|
"publication_info": {
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Publication Info"
|
||||||
|
},
|
||||||
|
"quality_note": {
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "Quality Note"
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "date-time",
|
||||||
|
"title": "Created At"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"id",
|
||||||
|
"tree_id",
|
||||||
|
"title",
|
||||||
|
"author",
|
||||||
|
"source_type",
|
||||||
|
"repository",
|
||||||
|
"url",
|
||||||
|
"citation_text",
|
||||||
|
"publication_info",
|
||||||
|
"quality_note",
|
||||||
|
"created_at"
|
||||||
|
],
|
||||||
|
"title": "SourceRead"
|
||||||
|
},
|
||||||
"TokenRequest": {
|
"TokenRequest": {
|
||||||
"properties": {
|
"properties": {
|
||||||
"token": {
|
"token": {
|
||||||
|
|||||||
Reference in New Issue
Block a user