feat: Implement getTrialStatus graphQL query

This commit is contained in:
Faruk AYDIN
2023-04-07 22:55:18 +02:00
parent 3bfc428dfe
commit c4dc0509c2
5 changed files with 53 additions and 13 deletions

View File

@@ -0,0 +1,19 @@
import appConfig from '../../config/app';
import Context from '../../types/express/context';
const getTrialStatus = async (
_parent: unknown,
_params: unknown,
context: Context
) => {
if (!appConfig.isCloud) return;
const inTrial = await context.currentUser.inTrial();
if (!inTrial) return;
return {
expireAt: context.currentUser.trialExpiryDate,
};
};
export default getTrialStatus;

View File

@@ -17,6 +17,7 @@ import getPaddleInfo from './queries/get-paddle-info.ee';
import getBillingAndUsage from './queries/get-billing-and-usage.ee';
import getInvoices from './queries/get-invoices.ee';
import getAutomatischInfo from './queries/get-automatisch-info';
import getTrialStatus from './queries/get-trial-status.ee';
import healthcheck from './queries/healthcheck';
const queryResolvers = {
@@ -39,6 +40,7 @@ const queryResolvers = {
getBillingAndUsage,
getInvoices,
getAutomatischInfo,
getTrialStatus,
healthcheck,
};

View File

@@ -40,6 +40,7 @@ type Query {
getBillingAndUsage: GetBillingAndUsage
getInvoices: [Invoice]
getAutomatischInfo: GetAutomatischInfo
getTrialStatus: GetTrialStatus
healthcheck: AppHealth
}
@@ -474,6 +475,10 @@ type GetAutomatischInfo {
isCloud: Boolean
}
type GetTrialStatus {
expireAt: String
}
type GetBillingAndUsage {
subscription: Subscription
usage: Usage