Skip to content

Commit 4f86206

Browse files
committed
dedupe lists
1 parent 6202c0f commit 4f86206

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/api/routes/membership.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,14 @@ const membershipPlugin: FastifyPluginAsync = async (fastify, _options) => {
244244
message: "Failed to get all member lists.",
245245
});
246246
}
247-
return reply.send(
248-
response.Items.map((x) => unmarshall(x))
249-
.filter((x) => !!x)
250-
.map((x) => x.memberList),
251-
);
247+
const deduped = [
248+
...new Set(
249+
response.Items.map((x) => unmarshall(x))
250+
.filter((x) => !!x)
251+
.map((x) => x.memberList),
252+
),
253+
];
254+
return reply.send(deduped);
252255
},
253256
);
254257
// I would have liked to do an overwrite here, but delete all in PK isn't atomic in Dynamo.

0 commit comments

Comments
 (0)