import { prisma } from "../constants";
import { Prisma } from "../../generated/prisma/client";
import {
  buildCollectorFindManyArgs,
  CollectorQueryOptions,
} from "../helper/collectorQuery";

type MemberCollectorOpts = CollectorQueryOptions<
  Prisma.MemberSelect,
  Prisma.MemberInclude
>;

export default async (opts?: MemberCollectorOpts) => {
  const args: Prisma.MemberFindManyArgs = buildCollectorFindManyArgs<
    Prisma.MemberSelect,
    Prisma.MemberInclude
  >(opts);

  const data = await prisma.member.findMany(args);

  return data;
};
