reportedBy: github-copilot.v1/refine-github-issue
feat(diet): extract shared artifacts for phase 2 - src/modules/diet/shared
Objective
Create reusable artifacts (types, converters, and mappers) used by recent-food, template and the api/food routes without changing infrastructure layers (repositories/gateways). The artifacts must be forward-compatible with Phase 3.
Reference: docs/unify-phases-2-3.md
Scope / Proposed Implementation
- Add a
src/modules/diet/shared folder containing explicit, named exports only (no barrel index.ts files).
src/modules/diet/shared/types/templateTypes.ts — shared TypeScript types such as Template, TemplateItem and minimal runtime guards/validations (JSDoc required).
src/modules/diet/shared/converters/templateToItem.ts — templateToItem(template): Item converter (named export).
src/modules/diet/shared/mappers/recentFoodMapper.ts — reusable DB↔domain mappers (used by Supabase gateway).
Concrete tasks
- Create the
shared files with JSDoc and named exports. Do not create barrel index.ts files.
- Update consumers in
src/modules/diet/recent-food and src/modules/diet/template to import from the new shared paths.
- Update unit tests that reference moved types/mappers to point to the new paths and adjust imports.
- Run the full test suite and fix regressions.
- Document the new artifact locations in the diet module README and in
docs/unify-phases-2-3.md (link back).
Priority symbols/files to migrate (examples)
src/modules/diet/template/domain/template.ts — migrate Template type and guards to shared/types.
src/modules/diet/template/application/templateToItem.ts — move or re-export the converter from shared/converters.
src/modules/diet/recent-food/infrastructure/supabase/supabaseRecentFoodMapper.ts — extract or re-use mappers in shared/mappers.
- Optional: shared constants (e.g.,
src/modules/diet/recent-food/infrastructure/supabase/constants.ts) if truly shared.
Acceptance criteria
PR checklist
Notes
See the planning document: docs/unify-phases-2-3.md for the full Phase 2 & Phase 3 plan and file inventory. The Phase 2 work is estimated at 3–7 days for a senior developer; risk: low–moderate.
reportedBy: github-copilot.v1/refine-github-issue
feat(diet): extract shared artifacts for phase 2 - src/modules/diet/shared
Objective
Create reusable artifacts (types, converters, and mappers) used by
recent-food,templateand theapi/foodroutes without changing infrastructure layers (repositories/gateways). The artifacts must be forward-compatible with Phase 3.Reference:
docs/unify-phases-2-3.mdScope / Proposed Implementation
src/modules/diet/sharedfolder containing explicit, named exports only (no barrelindex.tsfiles).src/modules/diet/shared/types/templateTypes.ts— shared TypeScript types such asTemplate,TemplateItemand minimal runtime guards/validations (JSDoc required).src/modules/diet/shared/converters/templateToItem.ts—templateToItem(template): Itemconverter (named export).src/modules/diet/shared/mappers/recentFoodMapper.ts— reusable DB↔domain mappers (used by Supabase gateway).Concrete tasks
sharedfiles with JSDoc and named exports. Do not create barrelindex.tsfiles.src/modules/diet/recent-foodandsrc/modules/diet/templateto import from the new shared paths.docs/unify-phases-2-3.md(link back).Priority symbols/files to migrate (examples)
src/modules/diet/template/domain/template.ts— migrateTemplatetype and guards toshared/types.src/modules/diet/template/application/templateToItem.ts— move or re-export the converter fromshared/converters.src/modules/diet/recent-food/infrastructure/supabase/supabaseRecentFoodMapper.ts— extract or re-use mappers inshared/mappers.src/modules/diet/recent-food/infrastructure/supabase/constants.ts) if truly shared.Acceptance criteria
recent-food,template,src/routes/api/food) import fromsrc/modules/diet/shared.index.tsfiles added; all imports are explicit.PR checklist
sharedfiles with JSDoc and named exports.Notes
See the planning document:
docs/unify-phases-2-3.mdfor the full Phase 2 & Phase 3 plan and file inventory. The Phase 2 work is estimated at 3–7 days for a senior developer; risk: low–moderate.