깜놀하는 해므찌로

Prisma in / TypeScript Set 중복 제거 예시 본문

IT

Prisma in / TypeScript Set 중복 제거 예시

agnusdei1207 2023. 8. 29. 15:36
반응형
SMALL
const uniqueEntities = Array.from(
      new Set(entities.map((entity) => entity.user.id))
    );

    const uniqueUsers = await this.prismaService.user.findMany({
      where: {
        id: {
          in: uniqueEntities,
        },
      },
    });

 

반응형
LIST