diff --git a/src/api/resolvers/course/index.ts b/src/api/resolvers/course/index.ts index 4ca87601..e426e3b5 100644 --- a/src/api/resolvers/course/index.ts +++ b/src/api/resolvers/course/index.ts @@ -1,8 +1,5 @@ import { QueryResolvers, MutationResolvers } from '@generated/server'; -import { - createCourse, - // getCoursesById, -} from '@services/firebase/course'; +import { createCourse } from '@services/firebase/course'; import { mergeCourses } from '@services/course'; interface Resolvers { @@ -17,12 +14,6 @@ export const resolvers: Resolvers = { return []; } - // LEGACY - // const courses = await getCoursesById(me?.uid); - // if (!courses) { - // return []; - // } - const courses = await courseConnector.getCoursesByUserId( me.uid ); @@ -46,12 +37,6 @@ export const resolvers: Resolvers = { return null; } - // LEGACY - // const courses = await getCoursesById(me?.uid); - // if (!courses) { - // return null; - // } - const courses = await courseConnector.getCoursesByUserIdAndCourseId( me.uid, courseId diff --git a/src/api/resolvers/upgrade/index.ts b/src/api/resolvers/upgrade/index.ts index b1d08add..bdcecc4e 100644 --- a/src/api/resolvers/upgrade/index.ts +++ b/src/api/resolvers/upgrade/index.ts @@ -1,5 +1,4 @@ import { QueryResolvers } from '@generated/server'; -// import { getCoursesById } from '@services/firebase/course'; import { getUpgradeableCourses } from '@services/course'; interface Resolvers { @@ -22,12 +21,6 @@ export const resolvers: Resolvers = { courseId ); - // LEGACY - // const courses = await getCoursesById(me?.uid); - // if (!courses) { - // return []; - // } - return getUpgradeableCourses(courseId, courses); }, }, diff --git a/src/services/course/index.ts b/src/services/course/index.ts index 9d6dcf89..1624e0c9 100644 --- a/src/services/course/index.ts +++ b/src/services/course/index.ts @@ -1,10 +1,5 @@ import omit from 'lodash.omit'; -// import { -// FirebaseCourseContent, -// FirebaseCourse, -// } from '@services/firebase/course'; - import { Course } from '@models/course'; import { COURSE } from '@data/course-keys'; import BUNDLE_LEGACY from '@data/bundle-legacy'; diff --git a/src/services/discount/index.ts b/src/services/discount/index.ts index 73f0bb64..5509c0fc 100644 --- a/src/services/discount/index.ts +++ b/src/services/discount/index.ts @@ -2,8 +2,6 @@ import axios from 'axios'; import { COURSE } from '@data/course-keys'; import { BUNDLE } from '@data/bundle-keys'; -// LEGACY -// import { getCoursesById } from '@services/firebase/course'; import { getUpgradeableCourses } from '@services/course'; import { Course } from '@models/course'; @@ -39,9 +37,6 @@ const tryUpgradeDiscount = async ( coupon: string, uid: string ) => { - // LEGACY - //const courses = await getCoursesById(uid); - if (!courses) { return price; } diff --git a/src/services/firebase/course.ts b/src/services/firebase/course.ts index 67bd298b..f7b44b97 100644 --- a/src/services/firebase/course.ts +++ b/src/services/firebase/course.ts @@ -37,29 +37,3 @@ export const createCourse = async ({ coupon, }, }); - -export type FirebaseCourseContent = { - courseId: COURSE; - packageId: BUNDLE; - invoice: { - amount: number; - createdAt: number; - currency: string; - licencesCount: number; - paymentType: string; - coupon: string; - }; -}; - -export type FirebaseCourse = { - [key: string]: FirebaseCourseContent; -}; - -export const getCoursesById = async ( - uid?: string -): Promise => - await firebaseAdmin - .database() - .ref(`users/${uid}/courses`) - .once('value') - .then(snapshot => snapshot.val());