feat: Implement draft version of getBillingAndUsage query

This commit is contained in:
Faruk AYDIN
2023-03-25 00:39:49 +03:00
parent 310497a5bf
commit b5524b18cf
5 changed files with 80 additions and 1 deletions

View File

@@ -10,6 +10,7 @@ import bcrypt from 'bcrypt';
import crypto from 'crypto';
import PaymentPlan from './payment-plan.ee';
import UsageData from './usage-data.ee';
import Subscription from './subscription.ee';
class User extends Base {
id!: string;
@@ -26,6 +27,7 @@ class User extends Base {
executions?: Execution[];
paymentPlan?: PaymentPlan;
usageData?: UsageData;
subscription?: Subscription;
static tableName = 'users';
@@ -99,6 +101,14 @@ class User extends Base {
to: 'users.id',
},
},
subscription: {
relation: Base.HasOneRelation,
modelClass: Subscription,
join: {
from: 'subscriptions.user_id',
to: 'users.id',
},
},
});
login(password: string) {