import { OrderEnum } from '../../CommonsModule/enum/order.enum' ; import { Injectable , NotImplementedException } from '@nestjs/common' ; import { UserStatusEnum } from '../enum/UserStatusEnum' ; import { UserService } from '../../UserModule/service/user.service' ; import { CourseTakenStatusEnum } from '../../CourseModule/enum/course-taken-status.enum' ; import { getCoursesByFinished } from '../interfaces/getCoursesByFinished' ; import { CourseTakenService } from '../../CourseModule/service/v1/course-taken.service' ; @ Injectable ( ) export class DashboardService { constructor ( private userService , private courseTakenService ) { } public async getUserQuantity ( status ? ) { if ( ! status ) { return this . userService . getUsersQuantity ( ) ; } if ( status === UserStatusEnum . ACTIVE ) { return this . courseTakenService . getActiveUsersQuantity ( ) ; } throw new NotImplementedException ( ) ; } getCertificateQuantity ( ) { return this . courseTakenService . getCertificateQuantity ( ) ; } getUsersInCourseQuantity ( status ) { if ( ! status ) { return this . courseTakenService . getUsersWithCompletedAndTakenCourses ( ) ; } if ( status === CourseTakenStatusEnum . COMPLETED ) { return this . courseTakenService . getUsersWithCompletedCourses ( ) ; } return this . courseTakenService . getUsersWithTakenCourses ( ) ; } getCoursesByFinished ( order , limit ) { return this . courseTakenService . getCoursesByFinished ( order , limit ) ; } }