Replies: 1 comment
|
This makes sense |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Problem
Taxonomy terms have full CRUD, but the taxonomy definition itself only
supports list + create. There's no way to read, update, or delete one taxonomy
— every other resource (menus, content, bylines) has a single-resource
endpoint. Definitions live in
_emdash_taxonomy_defs; the list/create handlersalready target it, so this is purely filling in the missing operations.
Endpoints to add
1.
packages/core/src/astro/routes/api/taxonomies/[name].tsThe missing single-resource route, mirroring
menus/[name].ts:GETtaxonomies:readhandleTaxonomyGet(new)PUTtaxonomies:managehandleTaxonomyUpdate(new)DELETEtaxonomies:managehandleTaxonomyDelete(new)2.
packages/core/src/astro/routes/api/taxonomies/[name]/translations.tsMirrors
menus/[name]/translations.ts:GETtaxonomies:readhandleTaxonomyDefTranslations— already exists, unexposedPOST (create-translation) is optional — translation creation already flows
through
POST /taxonomieswithtranslationOf, so it's not a parity gap.Handlers to add (
packages/core/src/api/handlers/taxonomies.ts)All standalone,
db-first, returningApiResult<T>, following the term-levelequivalents as templates:
handleTaxonomyGet(db, name, { locale? })→ looks up_emdash_taxonomy_defsby name (+locale), runs the same orphan-collectionfiltering as
handleTaxonomyList, returns{ taxonomy }orNOT_FOUND.handleTaxonomyUpdate(db, name, input)→ updateslabel,labelSingular,hierarchical,collections(reuse the create handler'scollection-validation block). Disallow renaming
namefor now(additive-only). Returns
{ taxonomy }.handleTaxonomyDelete(db, name, { locale? })→ deletes the def row andcascades to its terms + their
content_taxonomieslinks.Delete semantics
Matches collection-delete (already destructive and accepted): remove the def,
all terms in
taxonomiesfor that taxonomy, and theircontent_taxonomiesrows. The term-level cleanup pattern already exists in
TaxonomyRepository.delete(database/repositories/taxonomy.ts:195) — deleteloops over the taxonomy's terms or does a bulk delete by
translation_group.Return
{ deleted: true }. No "non-empty" guard.Compatibility & process
previously-orphaned handler wired up. No schema or contract changes.
export const prerender = false;,requirePerm,unwrapResult,parseBody+ zod forPUT. CSRF header enforced bymiddleware.
packages/coreis published).test that
DELETEremoves def, terms, and content links.All reactions