shellphone.app/app/settings/queries/get-subscription.ts

15 lines
406 B
TypeScript

import { resolver } from "blitz";
import db, { SubscriptionStatus } from "db";
export default resolver.pipe(resolver.authorize(), async (_ = null, { session }) => {
if (!session.orgId) return null;
return db.subscription.findFirst({
where: {
organizationId: session.orgId,
OR: [{ status: { not: SubscriptionStatus.deleted } }, { cancellationEffectiveDate: { gt: new Date() } }],
},
});
});