prisma-factory icon indicating copy to clipboard operation
prisma-factory copied to clipboard

support ModelUncheckedCreateInput type

Open gmaliar opened this issue 2 years ago • 1 comments

UncheckedInputTypes allow us to pass ids to the prisma model rather than objects An example:

Currently we connect,

export const createConnection = (userId, type) => {
  const Factory = createConnectionFactory({});

  return Factory.create({
    type,
    user: {
      connect: {
        id: userId,
      },
    },
  });
};

An alternative when ConnectionUncheckedCreateInput type is added

export const createConnection = (userId, type) => {
  const Factory = createConnectionFactory({});

  return Factory.create({
    userId,
    type,
  });
};

gmaliar avatar Apr 25 '22 08:04 gmaliar

I had this hurdle myself. And it looks like a good solution.

kokdemirdev avatar Jan 28 '23 20:01 kokdemirdev