$use but instead with $extends issue

Hey! i am trying to use $extends but i am having an issue here, here is what kappa told me and it worked perfectly:
const prisma = new PrismaClient().$extends({
query: {
membership: {
async findMany({ args, query }) {
if (!args.where) {
args.where = {};
}
if (args.where.revoked !== false && args.where.revoked !== true) {
args.where.revoked = false;
}
return query(args);
},
async findUnique({ args, query }) {
if (!args.where) {
args.where = {};
}
if (args.where.revoked !== false && args.where.revoked !== true) {
args.where.revoked = false;
}
return query(args);
},
},
},
});
const prisma = new PrismaClient().$extends({
query: {
membership: {
async findMany({ args, query }) {
if (!args.where) {
args.where = {};
}
if (args.where.revoked !== false && args.where.revoked !== true) {
args.where.revoked = false;
}
return query(args);
},
async findUnique({ args, query }) {
if (!args.where) {
args.where = {};
}
if (args.where.revoked !== false && args.where.revoked !== true) {
args.where.revoked = false;
}
return query(args);
},
},
},
});
But, this only works if i do prisma.membership.find... i also want it to work if i do:
await prisma.Airline.find...({
include : {
membership: true
}
})
await prisma.Airline.find...({
include : {
membership: true
}
})
this still shows the memberships with revoked as true, how can i do this? thanks
1 Reply
SPEEDBIRD101
SPEEDBIRD101OP5mo ago
is this even possible?? no one?
Want results from more Discord servers?
Add your server