fix: deduplicate model photos in public resolver to match admin behavior
All checks were successful
Build and Push Backend Image / build (push) Successful in 43s
Build and Push Frontend Image / build (push) Successful in 4m10s

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-07 10:54:29 +01:00
parent f2871b98db
commit 6f2f3b3529

View File

@@ -12,10 +12,12 @@ async function enrichModel(db: any, user: any) {
.where(eq(user_photos.user_id, user.id))
.orderBy(user_photos.sort);
return {
...user,
photos: photoRows.map((p: any) => ({ id: p.id, filename: p.filename })),
};
const seen = new Set<string>();
const photos = photoRows
.filter((p: any) => p.id && !seen.has(p.id) && seen.add(p.id))
.map((p: any) => ({ id: p.id, filename: p.filename }));
return { ...user, photos };
}
builder.queryField("models", (t) =>