feat: Implement getUsageData graphQL query

This commit is contained in:
Faruk AYDIN
2023-03-06 12:37:28 +01:00
parent 42d418da58
commit 282e5ba2d8
5 changed files with 50 additions and 1 deletions

View File

@@ -26,7 +26,7 @@ class UsageData extends Base {
relation: Base.BelongsToOneRelation,
modelClass: User,
join: {
from: 'payment_plans.user_id',
from: 'usage_data.user_id',
to: 'users.id',
},
},

View File

@@ -7,6 +7,7 @@ import Execution from './execution';
import bcrypt from 'bcrypt';
import crypto from 'crypto';
import PaymentPlan from './payment-plan.ee';
import UsageData from './usage-data.ee';
class User extends Base {
id!: string;
@@ -21,6 +22,7 @@ class User extends Base {
steps?: Step[];
executions?: Execution[];
paymentPlan?: PaymentPlan;
usageData?: UsageData;
static tableName = 'users';
@@ -86,6 +88,14 @@ class User extends Base {
to: 'users.id',
},
},
usageData: {
relation: Base.HasOneRelation,
modelClass: UsageData,
join: {
from: 'usage_data.user_id',
to: 'users.id',
},
},
});
login(password: string) {