2021-08-03 12:02:01 +00:00
|
|
|
import { resolver } from "blitz";
|
2021-07-31 14:33:18 +00:00
|
|
|
|
2021-07-31 15:57:43 +00:00
|
|
|
import db from "../../../db";
|
2021-07-31 14:33:18 +00:00
|
|
|
|
2021-08-03 12:02:01 +00:00
|
|
|
export default resolver.pipe(resolver.authorize(), async (_ = null, { session }) => {
|
2021-07-31 15:57:43 +00:00
|
|
|
if (!session.userId) return null;
|
2021-07-31 14:33:18 +00:00
|
|
|
|
|
|
|
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,
|
|
|
|
},
|
2021-07-31 15:57:43 +00:00
|
|
|
});
|
2021-08-03 12:02:01 +00:00
|
|
|
});
|