Add console command for merging duplicate photos#978
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| { | ||
| ImageHash = g.Key!, | ||
| PhotoIds = g.Select(p => p.Id).OrderBy(id => id).ToList(), | ||
| }) | ||
| .Where(g => g.PhotoIds.Count > 1) |
There was a problem hiding this comment.
Replace untranslatable GroupBy ToList projection
The new duplicate merge command will throw before doing any work because the grouping pipeline builds PhotoIds = g.Select(p => p.Id).OrderBy(id => id).ToList() inside the EF Core query (lines 34-38). Npgsql/EF Core cannot translate ToList() within a grouped projection, so running merge-duplicates will raise “The LINQ expression … could not be translated” instead of returning duplicate groups. Materialize only translatable aggregates (e.g., Count/Min) or fetch the ID lists in a separate query so the command can execute.
Useful? React with 👍 / 👎.
Summary
merge-duplicatesconsole command and wire it into dependency injectionTesting
Codex Task