feat: Add getSubscriptionStatus graphQL query

This commit is contained in:
Faruk AYDIN
2023-04-12 21:29:36 +02:00
parent d1344457dd
commit d2163f180e
4 changed files with 30 additions and 1 deletions

View File

@@ -0,0 +1,22 @@
import appConfig from '../../config/app';
import Context from '../../types/express/context';
const getSubscriptionStatus = async (
_parent: unknown,
_params: unknown,
context: Context
) => {
if (!appConfig.isCloud) return;
const currentSubscription = await context.currentUser.$relatedQuery(
'currentSubscription'
);
if (!currentSubscription?.cancellationEffectiveDate) return;
return {
cancellationEffectiveDate: currentSubscription.cancellationEffectiveDate,
};
};
export default getSubscriptionStatus;