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

22 lines
438 B
TypeScript

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,
},
});
}