feat(web): vocabulary/term/authority list+create hooks + MSW handlers
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -62,3 +62,10 @@ export const materialTerms: TermView[] = [
|
||||
export const personAuthorities: AuthorityView[] = [
|
||||
{ id: "a-ada", kind: "person", external_uri: null, labels: [{ lang: "en", label: "Ada Lovelace" }] },
|
||||
];
|
||||
|
||||
export type VocabularyView = components["schemas"]["VocabularyView"];
|
||||
|
||||
export const vocabularies: VocabularyView[] = [
|
||||
{ id: "v-material", key: "material" },
|
||||
{ id: "v-technique", key: "technique" },
|
||||
];
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { http, HttpResponse } from "msw";
|
||||
|
||||
import { amphora, fibula, fieldDefinitions, materialTerms, objectsPage, personAuthorities } from "./fixtures";
|
||||
import { amphora, fibula, fieldDefinitions, materialTerms, objectsPage, personAuthorities, vocabularies } from "./fixtures";
|
||||
|
||||
export const handlers = [
|
||||
http.get("/api/admin/me", () =>
|
||||
@@ -17,6 +17,8 @@ export const handlers = [
|
||||
|
||||
http.get("/api/admin/field-definitions", () => HttpResponse.json(fieldDefinitions)),
|
||||
|
||||
http.get("/api/admin/vocabularies", () => HttpResponse.json(vocabularies)),
|
||||
|
||||
http.get("/api/admin/vocabularies/:id/terms", () => HttpResponse.json(materialTerms)),
|
||||
|
||||
http.get("/api/admin/authorities", ({ request }) => {
|
||||
@@ -25,6 +27,18 @@ export const handlers = [
|
||||
return HttpResponse.json(kind === "person" ? personAuthorities : []);
|
||||
}),
|
||||
|
||||
http.post("/api/admin/vocabularies", () =>
|
||||
HttpResponse.json({ id: "v-new", key: "new" }, { status: 201 }),
|
||||
),
|
||||
|
||||
http.post("/api/admin/vocabularies/:id/terms", () =>
|
||||
HttpResponse.json({ id: "t-new" }, { status: 201 }),
|
||||
),
|
||||
|
||||
http.post("/api/admin/authorities", () =>
|
||||
HttpResponse.json({ id: "a-new" }, { status: 201 }),
|
||||
),
|
||||
|
||||
http.post("/api/admin/objects", () =>
|
||||
HttpResponse.json({ id: "11111111-1111-1111-1111-111111111111" }, { status: 201 }),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user