File

apps/recallassess/recallassess-api/src/api/admin/learning-group/config/learning-group-config.service.ts

Extends

ModuleConfigBase

Index

Methods

Methods

getConfiguration
getConfiguration()
Returns : ModuleConfig
import { ColumnConfig, ColumnType } from "@bish-nest/core/app-config/column-config.class";
import { ModuleConfig } from "@bish-nest/core/app-config/module-config.class";
import { ModuleConfigBase } from "@bish-nest/core/app-config/module-config-base.class";
import { Injectable } from "@nestjs/common";
import { LearningGroupAddDto } from "../dto/learning-group-add.dto";
import { LearningGroupDetailDto } from "../dto/learning-group-detail.dto";
import { LearningGroupListDto } from "../dto/learning-group-list.dto";
import { LearningGroupSaveDto } from "../dto/learning-group-save.dto";

@Injectable()
export class LearningGroupConfig extends ModuleConfigBase {
  getConfiguration(): ModuleConfig {
    const columns: ColumnConfig[] = [
      new ColumnConfig({ name: "id", type: ColumnType.Integer }),
      new ColumnConfig({ name: "company_id", type: ColumnType.Integer }),
      new ColumnConfig({ name: "company.name" }),
      new ColumnConfig({ name: "course_id", type: ColumnType.Integer }),
      new ColumnConfig({ name: "course.title" }),
      new ColumnConfig({ name: "participant_id_created_by", type: ColumnType.Integer }),
      new ColumnConfig({ name: "participant_created_by_display" }),
      new ColumnConfig({ name: "name" }),
      new ColumnConfig({ name: "description" }),
      new ColumnConfig({ name: "start_date", type: ColumnType.DateTime }),
      new ColumnConfig({ name: "completion_percentage", type: ColumnType.Float }),
      new ColumnConfig({ name: "participants_completed", type: ColumnType.Integer }),
      new ColumnConfig({ name: "total_participants", type: ColumnType.Integer }),
      new ColumnConfig({ name: "is_completed", type: ColumnType.Boolean }),
      new ColumnConfig({ name: "completion_date", type: ColumnType.DateTime }),
      new ColumnConfig({ name: "created_at", type: ColumnType.DateTime }),
      new ColumnConfig({ name: "updated_at", type: ColumnType.DateTime }),
      new ColumnConfig({ name: "user_name_created_by" }),
      new ColumnConfig({ name: "user_name_updated_by" }),
    ];

    const keywordSearchCols: string[] = [
      "id",
      "name",
      "description",
      "company.name",
      "course.title",
      // `participant_created_by_display` is DTO-only; search the underlying participant (createdBy).
      "createdBy.email",
      "createdBy.first_name",
      "createdBy.last_name",
    ];
    return new ModuleConfig({
      name: "learning-group",
      columns,
      // Allow searching by numeric id in the list keyword box (e.g. "43")
      keywordSearchCols,
      relationObjToIncludeForList: {
        company: true,
        course: true,
        createdBy: true,
      },
      relationObjToIncludeForDetail: {
        company: true,
        course: true,
        createdBy: true,
        userCreatedBy: true,
        userUpdatedBy: true,
        learningGroupParticipants: {
          include: {
            participant: true,
          },
        },
      },
      listDto: LearningGroupListDto,
      detailDto: LearningGroupDetailDto,
      addDto: LearningGroupAddDto,
      saveDto: LearningGroupSaveDto,
    });
  }
}

results matching ""

    No results matching ""