From 563e4d8cbf0c20d541aeeb9d0b1d530f8107273b Mon Sep 17 00:00:00 2001 From: Vijay A Date: Sat, 21 Aug 2021 07:13:33 +0530 Subject: refactor(cleanup): remove code that refers to paid subscription (since we are always premium/free) --- src/api/server/ServerApi.js | 14 --------- .../app/Controllers/Http/UserController.js | 2 -- src/models/Order.ts | 33 ---------------------- src/models/User.ts | 22 +-------------- 4 files changed, 1 insertion(+), 70 deletions(-) delete mode 100644 src/models/Order.ts (limited to 'src') diff --git a/src/api/server/ServerApi.js b/src/api/server/ServerApi.js index a55997b9d..b5042525a 100644 --- a/src/api/server/ServerApi.js +++ b/src/api/server/ServerApi.js @@ -8,7 +8,6 @@ import RecipePreviewModel from '../../models/RecipePreview'; import RecipeModel from '../../models/Recipe'; import NewsModel from '../../models/News'; import UserModel from '../../models/User'; -import OrderModel from '../../models/Order'; import { sleep } from '../../helpers/async-helpers'; @@ -589,19 +588,6 @@ export default class ServerApi { .filter(newsItem => newsItem !== null); } - _mapOrderModels(orders) { - return orders - .map(orderItem => { - try { - return new OrderModel(orderItem); - } catch (e) { - console.error(e); - return null; - } - }) - .filter(orderItem => orderItem !== null); - } - _getDevRecipes() { const recipesDirectory = getDevRecipeDirectory(); try { diff --git a/src/internal-server/app/Controllers/Http/UserController.js b/src/internal-server/app/Controllers/Http/UserController.js index a3ad736fa..d8ed9abc5 100644 --- a/src/internal-server/app/Controllers/Http/UserController.js +++ b/src/internal-server/app/Controllers/Http/UserController.js @@ -85,7 +85,6 @@ class UserController { return response.send({ accountType: 'individual', beta: false, - donor: {}, email: '', emailValidated: true, features: {}, @@ -121,7 +120,6 @@ class UserController { data: { accountType: 'individual', beta: false, - donor: {}, email: '', emailValidated: true, features: {}, diff --git a/src/models/Order.ts b/src/models/Order.ts deleted file mode 100644 index 546b813a0..000000000 --- a/src/models/Order.ts +++ /dev/null @@ -1,33 +0,0 @@ -// TODO: Can this file be deleted? - -interface IOrder { - id: string; - subscriptionId: string; - name: string; - invoiceUrl: string; - price: string; - date: string; -} - -export default class Order { - id: string = ''; - - subscriptionId: string = ''; - - name: string = ''; - - invoiceUrl: string = ''; - - price: string = ''; - - date: string = ''; - - constructor(data: IOrder) { - this.id = data.id; - this.subscriptionId = data.subscriptionId; - this.name = data.name || this.name; - this.invoiceUrl = data.invoiceUrl || this.invoiceUrl; - this.price = data.price || this.price; - this.date = data.date || this.date; - } -} diff --git a/src/models/User.ts b/src/models/User.ts index 8c6c2b1c9..771d11955 100644 --- a/src/models/User.ts +++ b/src/models/User.ts @@ -8,13 +8,8 @@ interface IUser { organization: string | null; accountType: string | null; beta: boolean; - donor: object; - isDonor: boolean; - isMiner: boolean; locale: boolean; isSubscriptionOwner: boolean; - hasSubscription: boolean; - hadSubscription: boolean; team: object; } @@ -34,24 +29,14 @@ export default class User { @observable emailIsConfirmed = true; - // TODO: Need to delete references to 'subscription' and 'donor' + // Note: Kept around to be able to handle the response from Franz server // better assume it's confirmed to avoid noise @observable subscription = {}; @observable isSubscriptionOwner = false; - @observable hasSubscription = true; - - @observable hadSubscription = false; - @observable beta = false; - @observable donor = {}; - - @observable isDonor = false; - - @observable isMiner = false; - @observable locale = false; @observable team = {}; @@ -68,14 +53,9 @@ export default class User { this.organization = data.organization || this.organization; this.accountType = data.accountType || this.accountType; this.beta = data.beta || this.beta; - this.donor = data.donor || this.donor; - this.isDonor = data.isDonor || this.isDonor; - this.isMiner = data.isMiner || this.isMiner; this.locale = data.locale || this.locale; this.isSubscriptionOwner = data.isSubscriptionOwner || this.isSubscriptionOwner; - this.hasSubscription = data.hasSubscription || this.hasSubscription; - this.hadSubscription = data.hadSubscription || this.hadSubscription; this.team = data.team || this.team; } -- cgit v1.2.3-54-g00ecf