Matt
06/02/2020, 5:23 PMconst nextAcctNum = async (state, type, ctx) => {
const prefix = state + "-" + (type === "Residential" ? "R" : "C") + "-";
highAcct = await ctx.prisma.account.findMany({
where: {
acct_num: {
startsWith: prefix,
},
},
orderBy: { acct_num: "desc" },
first: 1,
});
const highAcctNum = highAcct[0].acct_num;
let num = Number(highAcctNum.substr(5)) + 1;
let newAcctNum = prefix + num;
console.log("New Account Number: ", newAcctNum);
return newAcctNum;
};
module.exports = { nextAcctNum };
This used to work fine and return the highest account number. Now when I run it, I get this error:
Error:
Invalid `prisma.account.findMany()` invocation in
C:\Users\...\src\nextacctnum.js:3:38
{
where: {
acct_num: {
startsWith: 'AZ-R-'
}
},
orderBy: {
acct_num: 'desc'
},
first: 1
~~~~~
}
Unknown arg `first` in first for type Account. Did you mean `cursor`? Available args:
type findManyAccount {
where?: AccountWhereInput
orderBy?: AccountOrderByInput
cursor?: AccountWhereUniqueInput
take?: Int
skip?: Int
}
Does anyone have any idea why I'm getting this error now?Ugogo
06/02/2020, 6:01 PMcursor
or take
instead of first
Matt
06/02/2020, 6:02 PMUgogo
06/02/2020, 6:03 PMMatt
06/02/2020, 6:04 PM