shellphone.app/app/customers/queries/get-current-customer.ts
2021-08-03 20:02:01 +08:00

22 lines
452 B
TypeScript

import { resolver } from "blitz";
import db from "../../../db";
export default resolver.pipe(resolver.authorize(), async (_ = null, { session }) => {
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,
},
});
});