29 lines
517 B
JavaScript
29 lines
517 B
JavaScript
const { PrismaClient } = require("@prisma/client")
|
|
const prisma = new PrismaClient()
|
|
|
|
async function findSeller(where, options = {}) {
|
|
return prisma.seller.findFirst({
|
|
where,
|
|
include: options.include || undefined,
|
|
select: options.select || undefined,
|
|
})
|
|
}
|
|
|
|
async function findSellerByDomain(domain) {
|
|
return prisma.seller.findFirst({
|
|
where: {
|
|
domains: {
|
|
some: {
|
|
domain: domain,
|
|
},
|
|
},
|
|
},
|
|
})
|
|
}
|
|
|
|
|
|
module.exports = {
|
|
findSeller,
|
|
findSellerByDomain,
|
|
}
|