shellphone.app/app/customers/queries/get-current-customer.ts

22 lines
434 B
TypeScript
Raw Normal View History

2021-07-31 14:33:18 +00:00
import { Ctx } from "blitz"
import db from "../../../db"
export default async function getCurrentCustomer(_ = null, { session }: Ctx) {
if (!session.userId) return null
return db.customer.findFirst({
where: { id: session.userId },
select: {
id: true,
encryptionKey: true,
accountSid: true,
authToken: true,
twimlAppSid: true,
paddleCustomerId: true,
paddleSubscriptionId: true,
user: true,
},
})
}