All problems

Repeated Package Scans Duplicate Rows in a Dispatch Manifest

Level 2 · node · Data · Missing package-ID deduplication when generating dispatch manifests

Scenario

A fictional delivery depot converts uploaded scanner records into dispatch manifests. Network retries can create repeated records with the same package ID at one depot. Each manifest should contain only one entry per package ID for its depot, retaining the first received record. Review the transformation through the repository, service, and controller.

Requirements

Deduplicate package IDs within each depot's manifest while preserving the first record and input order. Identical package IDs at different depots must remain independent. Do not mutate stored records or add external dependencies.

Acceptance criteria

  • Include packages with unique IDs for the selected depot.
  • Return only one entry for repeated package IDs within a depot.
  • Treat the same package ID at different depots independently.
  • Retain the first record when a package ID repeats.
  • Reading a manifest does not modify stored source records.
  • A depot without records returns an empty package list.