dcramer / dcramer/peated

refactor(api): remove legacy entity type in favor of kind

Open
#773 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
103
Forks
18
Avg merge
1h 19m
Merged PRs (30d)
555

Description

Why

Entity.kind is the canonical entity classification. The legacy multi-valued Entity.type field is no longer part of the product model, but API contracts and several callers still use it for catalog filters, entity creation, and presentation. This makes pages disagree about what an entity is.

API and data changes

  • Replace the optional type filter on GET /entities with a kind filter using the entity-kind enum.
  • Replace or remove the searchContext.type input where it represents entity classification.
  • Remove type from entity create, update, detail, list, and search schemas.
  • Remove the legacy database column and generated types through the normal migration workflow.
  • Update the typed mock API and fixtures to use only kind.
  • Keep bottle roles explicit on Bottle (brand, bottler, and distillers); do not reconstruct them from entity kind.

Web use

  • /distillers requests kind=distillery.
  • /brands requests kind=brand.
  • /bottlers requests kind=bottler.
  • Entity forms select one kind rather than several types.
  • Entity detail presentation and contextual actions use kind only.

Acceptance criteria

  • No public API entity contract exposes or accepts type.
  • Entity catalog filters paginate and sort correctly by kind.
  • Existing entities retain their canonical kind after migration.
  • Bottle brand, bottler, and distiller assignments remain unchanged.
  • The mock API covers distillery, brand, bottler, blender, and company records without a type field.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the GET /entities API, the searchContext input, entity create/update/detail/list/search schemas, and the normal database migration workflow. Then trace the /distillers, /brands, and /bottlers requests and entity forms. Done means no public entity contract or mock fixture uses type, kind filters work, and bottle assignments and canonical kinds are preserved.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend-api-design, database, frontend
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.