migrate to blitzjs
This commit is contained in:
21
app/customers/queries/get-current-customer.ts
Normal file
21
app/customers/queries/get-current-customer.ts
Normal file
@ -0,0 +1,21 @@
|
||||
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,
|
||||
},
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user