/******/ (() => { // webpackBootstrap
/******/ 	var __webpack_modules__ = ([
/* 0 */,
/* 1 */
/***/ (() => {

Date.prototype.format = function (fmt) {
    const o = {
        'M+': this.getMonth() + 1,
        'd+': this.getDate(),
        'h+': this.getHours(),
        'm+': this.getMinutes(),
        's+': this.getSeconds(),
        'q+': Math.floor((this.getMonth() + 3) / 3),
        S: this.getMilliseconds(),
    };
    if (/(y+)/.test(fmt))
        fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length));
    for (const k in o) {
        if (new RegExp('(' + k + ')').test(fmt)) {
            fmt = fmt.replace(RegExp.$1, RegExp.$1.length === 1
                ? o[k]
                : ('00' + o[k]).substr(('' + o[k]).length));
        }
    }
    return fmt;
};


/***/ }),
/* 2 */
/***/ ((module) => {

"use strict";
module.exports = require("@nestjs/common");

/***/ }),
/* 3 */
/***/ ((module) => {

"use strict";
module.exports = require("@nestjs/core");

/***/ }),
/* 4 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var _a;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.GlobalExceptionsFilter = void 0;
const common_1 = __webpack_require__(2);
const core_1 = __webpack_require__(3);
let GlobalExceptionsFilter = class GlobalExceptionsFilter {
    constructor(httpAdapterHost) {
        this.httpAdapterHost = httpAdapterHost;
    }
    catch(exception, host) {
        var _a, _b;
        console.log(exception);
        const { httpAdapter } = this.httpAdapterHost;
        const ctx = host.switchToHttp();
        const httpStatus = exception instanceof common_1.HttpException
            ? exception.getStatus()
            : common_1.HttpStatus.INTERNAL_SERVER_ERROR;
        const responseBody = {
            code: httpStatus,
            timestamp: new Date().toISOString(),
            msg: exception.sql
                ? `SQL Error: ${exception.sqlMessage}`
                : Array.isArray((_a = exception === null || exception === void 0 ? void 0 : exception.response) === null || _a === void 0 ? void 0 : _a.message)
                    ? (_b = exception === null || exception === void 0 ? void 0 : exception.response) === null || _b === void 0 ? void 0 : _b.message[0]
                    : exception,
            path: httpAdapter.getRequestUrl(ctx.getRequest()),
        };
        console.error(responseBody);
        httpAdapter.reply(ctx.getResponse(), responseBody, httpStatus);
    }
};
GlobalExceptionsFilter = __decorate([
    (0, common_1.Catch)(),
    __metadata("design:paramtypes", [typeof (_a = typeof core_1.HttpAdapterHost !== "undefined" && core_1.HttpAdapterHost) === "function" ? _a : Object])
], GlobalExceptionsFilter);
exports.GlobalExceptionsFilter = GlobalExceptionsFilter;


/***/ }),
/* 5 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ResponseInterceptor = void 0;
const common_1 = __webpack_require__(2);
const operators_1 = __webpack_require__(6);
let ResponseInterceptor = class ResponseInterceptor {
    intercept(context, next) {
        return next
            .handle()
            .pipe((0, operators_1.map)((data) => ({ data, code: 0, msg: 'success' })));
    }
};
ResponseInterceptor = __decorate([
    (0, common_1.Injectable)()
], ResponseInterceptor);
exports.ResponseInterceptor = ResponseInterceptor;


/***/ }),
/* 6 */
/***/ ((module) => {

"use strict";
module.exports = require("rxjs/operators");

/***/ }),
/* 7 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.AppModule = void 0;
const common_1 = __webpack_require__(2);
const mysql_1 = __webpack_require__(8);
const system_module_1 = __webpack_require__(13);
const online_teaching_module_1 = __webpack_require__(54);
const online_course_module_1 = __webpack_require__(89);
const assessment_evaluation_module_1 = __webpack_require__(123);
const resource_module_1 = __webpack_require__(182);
const evaluation_module_1 = __webpack_require__(195);
const initialize_module_1 = __webpack_require__(205);
const statistic_module_1 = __webpack_require__(208);
const article_manage_module_1 = __webpack_require__(212);
const manuals_manage_module_1 = __webpack_require__(220);
let AppModule = class AppModule {
};
AppModule = __decorate([
    (0, common_1.Module)({
        imports: [
            mysql_1.default,
            system_module_1.SystemModule,
            online_teaching_module_1.OnlineTeachingModule,
            online_course_module_1.OnlineCourseModule,
            assessment_evaluation_module_1.AssessmentEvaluationModule,
            resource_module_1.ResourceModule,
            evaluation_module_1.EvaluationModule,
            initialize_module_1.InitializeModule,
            statistic_module_1.StatisticModule,
            article_manage_module_1.ArticleManageModule,
            manuals_manage_module_1.ManualsManageModule,
        ],
    })
], AppModule);
exports.AppModule = AppModule;


/***/ }),
/* 8 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

"use strict";

Object.defineProperty(exports, "__esModule", ({ value: true }));
const typeorm_1 = __webpack_require__(9);
const env_1 = __webpack_require__(10);
const custom_type_orm_logger_1 = __webpack_require__(12);
exports["default"] = typeorm_1.TypeOrmModule.forRoot(global.DB_IS_SQLITE ?
    {
        type: 'sqlite',
        database: 'db.sql',
        autoLoadEntities: true,
        synchronize: true,
    } : Object.assign(Object.assign({}, env_1.default.mysql), { type: 'mysql', logger: custom_type_orm_logger_1.CustomTypeOrmLoggerr.ForConnection('default', 'all') }));


/***/ }),
/* 9 */
/***/ ((module) => {

"use strict";
module.exports = require("@nestjs/typeorm");

/***/ }),
/* 10 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

"use strict";

Object.defineProperty(exports, "__esModule", ({ value: true }));
const path_1 = __webpack_require__(11);
const IS_DEV = process.argv.includes('ENV=DEV');
const BASE_PATH = (0, path_1.join)(__dirname, '..');
exports["default"] = {
    IS_DEV,
    BASE_PATH,
    serve: {
        port: 3001,
    },
    staticAssets: {
        resource: {
            path: (0, path_1.join)(BASE_PATH, 'RESOURCE_BUCKET'),
            prefix: '/file-bucket',
        },
        front: {
            path: (0, path_1.join)(BASE_PATH, 'front'),
        },
        textBookFront: {
            path: (0, path_1.join)(BASE_PATH, 'tf'),
            prefix: '/text-book',
        },
    },
    proxys: [
        {
            target: 'http://127.0.0.1:8080/',
            port: 3002,
            httpsOptions: {},
        },
        {
            target: 'http://127.0.0.1:1985/',
            port: 8091,
            httpsOptions: {},
        },
    ],
    mysql: {
        host: 'localhost',
        port: 3306,
        username: 'root',
        password: '123456',
        database: 'huai_li',
        synchronize: true,
        autoLoadEntities: true,
    },
    swagger: {
        title: '接口文档',
        version: '1.0',
        path: 'api-docs',
    },
};


/***/ }),
/* 11 */
/***/ ((module) => {

"use strict";
module.exports = require("path");

/***/ }),
/* 12 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

"use strict";

Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CustomTypeOrmLoggerr = void 0;
const common_1 = __webpack_require__(2);
class CustomTypeOrmLoggerr {
    static ForConnection(connectionName, options) {
        const logger = new common_1.Logger(`TypeORM[${connectionName}]`);
        return new CustomTypeOrmLoggerr(logger, options);
    }
    constructor(_logger, _options) {
        this._logger = _logger;
        this._options = _options;
    }
    logQuery(query, parameters) {
        if (this._options === 'all' ||
            this._options === true ||
            (this._options instanceof Array && this._options.indexOf('query') !== -1)) {
            const sql = query +
                (parameters && parameters.length
                    ? ' -- PARAMETERS: ' + this.stringifyParams(parameters)
                    : '');
            this._logger.log('query' + ': ' + sql);
        }
    }
    logQueryError(error, query, parameters) {
        if (this._options === 'all' ||
            this._options === true ||
            (this._options instanceof Array && this._options.indexOf('error') !== -1)) {
            const sql = query +
                (parameters && parameters.length
                    ? ' -- PARAMETERS: ' + this.stringifyParams(parameters)
                    : '');
            this._logger.log(`query failed: ` + sql);
            this._logger.log(`error:`, error);
        }
    }
    logQuerySlow(time, query, parameters) {
        const sql = query +
            (parameters && parameters.length
                ? ' -- PARAMETERS: ' + this.stringifyParams(parameters)
                : '');
        this._logger.log(`query is slow: ` + sql);
        this._logger.log(`execution time: ` + time);
    }
    logSchemaBuild(message) {
        if (this._options === 'all' ||
            (this._options instanceof Array && this._options.indexOf('schema') !== -1)) {
            this._logger.log(message);
        }
    }
    logMigration(message) {
        this._logger.log(message);
    }
    log(level, message) {
        switch (level) {
            case 'log':
                if (this._options === 'all' ||
                    (this._options instanceof Array &&
                        this._options.indexOf('log') !== -1))
                    this._logger.log(message);
                break;
            case 'info':
                if (this._options === 'all' ||
                    (this._options instanceof Array &&
                        this._options.indexOf('info') !== -1))
                    this._logger.debug(message);
                break;
            case 'warn':
                if (this._options === 'all' ||
                    (this._options instanceof Array &&
                        this._options.indexOf('warn') !== -1))
                    this._logger.warn(message);
                break;
        }
    }
    stringifyParams(parameters) {
        try {
            return JSON.stringify(parameters);
        }
        catch (error) {
            return parameters;
        }
    }
}
exports.CustomTypeOrmLoggerr = CustomTypeOrmLoggerr;


/***/ }),
/* 13 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.SystemModule = void 0;
const common_1 = __webpack_require__(2);
const system_service_1 = __webpack_require__(14);
const system_controller_1 = __webpack_require__(22);
const typeorm_1 = __webpack_require__(9);
const user_entity_1 = __webpack_require__(21);
const org_entity_1 = __webpack_require__(28);
const role_entity_1 = __webpack_require__(20);
const feature_entity_1 = __webpack_require__(29);
const user_service_1 = __webpack_require__(30);
const jwt_1 = __webpack_require__(15);
const core_1 = __webpack_require__(3);
const jwt_auth_guard_1 = __webpack_require__(32);
const passport_1 = __webpack_require__(33);
const jwt_strategy_1 = __webpack_require__(34);
const org_controller_1 = __webpack_require__(36);
const org_service_1 = __webpack_require__(43);
const feature_service_1 = __webpack_require__(44);
const feature_controller_1 = __webpack_require__(45);
const role_controller_1 = __webpack_require__(46);
const role_service_1 = __webpack_require__(48);
const user_controller_1 = __webpack_require__(49);
const teacher_student_entity_1 = __webpack_require__(31);
let SystemModule = class SystemModule {
};
SystemModule = __decorate([
    (0, common_1.Module)({
        imports: [
            typeorm_1.TypeOrmModule.forFeature([user_entity_1.User, org_entity_1.Org, role_entity_1.Role, feature_entity_1.Feature, teacher_student_entity_1.TeacherStudent]),
            passport_1.PassportModule,
            jwt_1.JwtModule.register({
                secret: 'jwtConstants.secret',
                signOptions: { expiresIn: '7d' },
            }),
        ],
        controllers: [
            system_controller_1.SystemController,
            user_controller_1.UserController,
            org_controller_1.OrgController,
            feature_controller_1.FeatureController,
            role_controller_1.RoleController,
        ],
        providers: [
            system_service_1.SystemService,
            user_service_1.UserService,
            org_service_1.OrgService,
            feature_service_1.FeatureService,
            role_service_1.RoleService,
            jwt_strategy_1.JwtStrategy,
            {
                provide: core_1.APP_GUARD,
                useClass: jwt_auth_guard_1.JwtAuthGuard,
            },
        ],
    })
], SystemModule);
exports.SystemModule = SystemModule;


/***/ }),
/* 14 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var _a, _b;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.SystemService = void 0;
const common_1 = __webpack_require__(2);
const jwt_1 = __webpack_require__(15);
const resource_entity_1 = __webpack_require__(16);
const typeorm_1 = __webpack_require__(18);
const role_entity_1 = __webpack_require__(20);
const user_entity_1 = __webpack_require__(21);
let SystemService = class SystemService {
    constructor(dataSource, jwtService) {
        this.dataSource = dataSource;
        this.jwtService = jwtService;
    }
    async login(loginUserDto) {
        const user = await this.dataSource
            .getRepository(user_entity_1.User)
            .findOneBy(Object.assign(Object.assign({}, loginUserDto), { delFlag: 0 }));
        if (!user)
            throw '用户名或密码错误';
        const role = await this.dataSource
            .getRepository(role_entity_1.Role)
            .findOneBy({ id: user.roleId });
        const resource = user.photo &&
            (await this.dataSource
                .getRepository(resource_entity_1.Resource)
                .findOneBy({ id: user.photo }));
        return {
            user: Object.assign(Object.assign({}, user), { roleName: role.name, baseRole: role.base, photo: resource === null || resource === void 0 ? void 0 : resource.diskname }),
            token: this.jwtService.sign({
                sub: user.id,
                auth: user.roleId,
                base: role.base,
                org: user.orgId,
            }),
        };
    }
    async checkAdminPassword(password) {
        console.log({ password });
        if (!/^(?![0-9]+$)(?![a-zA-Z]+$)[a-zA-Z0-9]{6,12}$/.test(password))
            throw '密码输入不合法，若是初始密码请修改后再试';
        if (!(await this.dataSource
            .getRepository(user_entity_1.User)
            .findOneBy({ username: 'admin', password })))
            throw '管理员密码错误';
        return true;
    }
};
SystemService = __decorate([
    (0, common_1.Injectable)(),
    __metadata("design:paramtypes", [typeof (_a = typeof typeorm_1.DataSource !== "undefined" && typeorm_1.DataSource) === "function" ? _a : Object, typeof (_b = typeof jwt_1.JwtService !== "undefined" && jwt_1.JwtService) === "function" ? _b : Object])
], SystemService);
exports.SystemService = SystemService;


/***/ }),
/* 15 */
/***/ ((module) => {

"use strict";
module.exports = require("@nestjs/jwt");

/***/ }),
/* 16 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Resource = void 0;
const increment_id_entity_1 = __webpack_require__(17);
const typeorm_1 = __webpack_require__(18);
let Resource = class Resource extends increment_id_entity_1.IncrementIdEntity {
};
__decorate([
    (0, typeorm_1.Column)({ comment: '文件名' }),
    __metadata("design:type", String)
], Resource.prototype, "name", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true, comment: '文件扩展' }),
    __metadata("design:type", String)
], Resource.prototype, "ext", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '文件类型，folder:文件夹' }),
    __metadata("design:type", String)
], Resource.prototype, "type", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true, comment: '媒体类型' }),
    __metadata("design:type", String)
], Resource.prototype, "mimetype", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true, comment: '文件大小' }),
    __metadata("design:type", Number)
], Resource.prototype, "size", void 0);
__decorate([
    (0, typeorm_1.Column)({ default: '/', comment: '路径' }),
    __metadata("design:type", String)
], Resource.prototype, "path", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true, comment: '存储在磁盘上的名称' }),
    __metadata("design:type", String)
], Resource.prototype, "diskname", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true, comment: '预览文件' }),
    __metadata("design:type", String)
], Resource.prototype, "preview", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true, name: 'classify_id', comment: '分类ID' }),
    __metadata("design:type", Number)
], Resource.prototype, "classifyId", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true, name: 'classify_ids', comment: '分类ID集合' }),
    __metadata("design:type", String)
], Resource.prototype, "classifyIds", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'share', comment: '是否共享', default: 0 }),
    __metadata("design:type", String)
], Resource.prototype, "share", void 0);
Resource = __decorate([
    (0, typeorm_1.Entity)()
], Resource);
exports.Resource = Resource;


/***/ }),
/* 17 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.IncrementIdEntity = void 0;
const typeorm_1 = __webpack_require__(18);
const base_entity_1 = __webpack_require__(19);
class IncrementIdEntity extends base_entity_1.BaseEntity {
}
__decorate([
    (0, typeorm_1.PrimaryGeneratedColumn)('increment'),
    __metadata("design:type", Number)
], IncrementIdEntity.prototype, "id", void 0);
exports.IncrementIdEntity = IncrementIdEntity;


/***/ }),
/* 18 */
/***/ ((module) => {

"use strict";
module.exports = require("typeorm");

/***/ }),
/* 19 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var _a, _b;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.BaseEntity = void 0;
const typeorm_1 = __webpack_require__(18);
class BaseEntity {
}
__decorate([
    (0, typeorm_1.CreateDateColumn)({ name: 'create_time', comment: '创建时间' }),
    __metadata("design:type", typeof (_a = typeof Date !== "undefined" && Date) === "function" ? _a : Object)
], BaseEntity.prototype, "createTime", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '创建人', default: 'SYSTEM' }),
    __metadata("design:type", String)
], BaseEntity.prototype, "creator", void 0);
__decorate([
    (0, typeorm_1.UpdateDateColumn)({
        name: 'update_time',
        comment: '更新时间',
    }),
    __metadata("design:type", typeof (_b = typeof Date !== "undefined" && Date) === "function" ? _b : Object)
], BaseEntity.prototype, "updateTime", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '更新人', default: 'SYSTEM' }),
    __metadata("design:type", String)
], BaseEntity.prototype, "updater", void 0);
__decorate([
    (0, typeorm_1.Column)({
        default: 0,
        select: false,
        name: 'del_flag',
        comment: '是否删除：0否/1是',
    }),
    __metadata("design:type", Number)
], BaseEntity.prototype, "delFlag", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true, comment: '备注说明' }),
    __metadata("design:type", String)
], BaseEntity.prototype, "remarks", void 0);
__decorate([
    (0, typeorm_1.VersionColumn)({ select: false, comment: '更新版本' }),
    __metadata("design:type", Number)
], BaseEntity.prototype, "version", void 0);
exports.BaseEntity = BaseEntity;


/***/ }),
/* 20 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Role = void 0;
const increment_id_entity_1 = __webpack_require__(17);
const typeorm_1 = __webpack_require__(18);
let Role = class Role extends increment_id_entity_1.IncrementIdEntity {
};
__decorate([
    (0, typeorm_1.Column)({ comment: '角色名称' }),
    __metadata("design:type", String)
], Role.prototype, "name", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true, comment: '角色描述' }),
    __metadata("design:type", String)
], Role.prototype, "desc", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true, comment: '基于哪个角色编辑' }),
    __metadata("design:type", Number)
], Role.prototype, "base", void 0);
Role = __decorate([
    (0, typeorm_1.Entity)()
], Role);
exports.Role = Role;


/***/ }),
/* 21 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var _a;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.User = void 0;
const base_entity_1 = __webpack_require__(19);
const typeorm_1 = __webpack_require__(18);
let User = class User extends base_entity_1.BaseEntity {
};
__decorate([
    (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
    __metadata("design:type", String)
], User.prototype, "id", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '用户名', unique: true }),
    __metadata("design:type", String)
], User.prototype, "username", void 0);
__decorate([
    (0, typeorm_1.Column)({ default: '123456', select: false, comment: '密码' }),
    __metadata("design:type", String)
], User.prototype, "password", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '姓名' }),
    __metadata("design:type", String)
], User.prototype, "name", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true, comment: '照片，对应resource表的ID' }),
    __metadata("design:type", Number)
], User.prototype, "photo", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true, comment: '性别：0/女，1/男' }),
    __metadata("design:type", Number)
], User.prototype, "sex", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true, comment: '出生年月' }),
    __metadata("design:type", typeof (_a = typeof Date !== "undefined" && Date) === "function" ? _a : Object)
], User.prototype, "birthday", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true, comment: '身份证号' }),
    __metadata("design:type", String)
], User.prototype, "idcard", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true, comment: '职位' }),
    __metadata("design:type", String)
], User.prototype, "identity", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true, comment: '电话' }),
    __metadata("design:type", String)
], User.prototype, "phone", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true, comment: '邮箱' }),
    __metadata("design:type", String)
], User.prototype, "email", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'role_id', comment: '角色 ID' }),
    __metadata("design:type", Number)
], User.prototype, "roleId", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true, name: 'org_id', comment: '组织机构 ID' }),
    __metadata("design:type", Number)
], User.prototype, "orgId", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true, name: 'org_ids', comment: '多级组织机构 ID ' }),
    __metadata("design:type", String)
], User.prototype, "orgIds", void 0);
User = __decorate([
    (0, typeorm_1.Entity)()
], User);
exports.User = User;


/***/ }),
/* 22 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.SystemController = void 0;
const common_1 = __webpack_require__(2);
const swagger_1 = __webpack_require__(23);
const system_service_1 = __webpack_require__(14);
const login_user_dto_1 = __webpack_require__(24);
const no_token_decorator_1 = __webpack_require__(26);
const decorators_1 = __webpack_require__(27);
let SystemController = class SystemController {
    constructor(systemService) {
        this.systemService = systemService;
    }
    async login(loginUserDto) {
        return this.systemService.login(loginUserDto);
    }
    async checkAdminPassword({ password }) {
        return this.systemService.checkAdminPassword(password);
    }
};
__decorate([
    (0, no_token_decorator_1.NoAuthToken)(),
    (0, common_1.Post)('login'),
    __param(0, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_b = typeof login_user_dto_1.LoginUserDto !== "undefined" && login_user_dto_1.LoginUserDto) === "function" ? _b : Object]),
    __metadata("design:returntype", Promise)
], SystemController.prototype, "login", null);
__decorate([
    (0, common_1.Get)('checkAdminPassword'),
    __param(0, (0, decorators_1.Query)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object]),
    __metadata("design:returntype", Promise)
], SystemController.prototype, "checkAdminPassword", null);
SystemController = __decorate([
    (0, swagger_1.ApiTags)('系统管理'),
    (0, common_1.Controller)('system'),
    __metadata("design:paramtypes", [typeof (_a = typeof system_service_1.SystemService !== "undefined" && system_service_1.SystemService) === "function" ? _a : Object])
], SystemController);
exports.SystemController = SystemController;


/***/ }),
/* 23 */
/***/ ((module) => {

"use strict";
module.exports = require("@nestjs/swagger");

/***/ }),
/* 24 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.LoginUserDto = void 0;
const swagger_1 = __webpack_require__(23);
const class_validator_1 = __webpack_require__(25);
class LoginUserDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '用户名' }),
    (0, class_validator_1.IsNotEmpty)({ message: '用户名不能为空' }),
    __metadata("design:type", String)
], LoginUserDto.prototype, "username", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '密码' }),
    (0, class_validator_1.IsNotEmpty)({ message: '密码不能为空' }),
    (0, class_validator_1.MaxLength)(16, { message: '密码最多16位' }),
    __metadata("design:type", String)
], LoginUserDto.prototype, "password", void 0);
exports.LoginUserDto = LoginUserDto;


/***/ }),
/* 25 */
/***/ ((module) => {

"use strict";
module.exports = require("class-validator");

/***/ }),
/* 26 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

"use strict";

Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.NoAuthToken = exports.IS_NO_AUTH_TOKEN = void 0;
const common_1 = __webpack_require__(2);
exports.IS_NO_AUTH_TOKEN = '_IS_NO_AUTH_TOKEN_';
const NoAuthToken = () => (0, common_1.SetMetadata)(exports.IS_NO_AUTH_TOKEN, true);
exports.NoAuthToken = NoAuthToken;


/***/ }),
/* 27 */
/***/ ((module) => {

"use strict";
module.exports = require("@nestjs/common/decorators");

/***/ }),
/* 28 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Org = void 0;
const increment_id_entity_1 = __webpack_require__(17);
const typeorm_1 = __webpack_require__(18);
let Org = class Org extends increment_id_entity_1.IncrementIdEntity {
};
__decorate([
    (0, typeorm_1.Column)({ comment: '机构名称' }),
    __metadata("design:type", String)
], Org.prototype, "name", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '机构描述' }),
    __metadata("design:type", String)
], Org.prototype, "desc", void 0);
__decorate([
    (0, typeorm_1.Column)({ default: 0, comment: '上级机构 ID' }),
    __metadata("design:type", Number)
], Org.prototype, "pid", void 0);
Org = __decorate([
    (0, typeorm_1.Entity)()
], Org);
exports.Org = Org;


/***/ }),
/* 29 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Feature = void 0;
const increment_id_entity_1 = __webpack_require__(17);
const typeorm_1 = __webpack_require__(18);
let Feature = class Feature extends increment_id_entity_1.IncrementIdEntity {
};
__decorate([
    (0, typeorm_1.Column)({ comment: '功能名' }),
    __metadata("design:type", String)
], Feature.prototype, "name", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '功能类型: 1/页面 2/功能权限' }),
    __metadata("design:type", Number)
], Feature.prototype, "type", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'role_id', comment: '所属角色' }),
    __metadata("design:type", Number)
], Feature.prototype, "roleId", void 0);
Feature = __decorate([
    (0, typeorm_1.Entity)()
], Feature);
exports.Feature = Feature;


/***/ }),
/* 30 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
var _a, _b;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.UserService = void 0;
const common_1 = __webpack_require__(2);
const typeorm_1 = __webpack_require__(9);
const resource_entity_1 = __webpack_require__(16);
const typeorm_2 = __webpack_require__(18);
const role_entity_1 = __webpack_require__(20);
const teacher_student_entity_1 = __webpack_require__(31);
const user_entity_1 = __webpack_require__(21);
let UserService = class UserService {
    constructor(dataSource, userRepository) {
        this.dataSource = dataSource;
        this.userRepository = userRepository;
    }
    async create(userDto) {
        const hasUser = await this.userRepository.findOneBy({
            username: userDto.username,
            delFlag: 0,
        });
        if (hasUser)
            throw '该用户名已存在';
        return this.userRepository.manager.transaction(async (entityManager) => {
            const { manageTeacher } = userDto, user = __rest(userDto, ["manageTeacher"]);
            const { id } = await entityManager.save(user_entity_1.User, user);
            await this.updateTeacherStudent(entityManager, id, manageTeacher, user);
        });
    }
    async update(id, userDto) {
        return this.userRepository.manager.transaction(async (entityManager) => {
            const { manageTeacher } = userDto, user = __rest(userDto, ["manageTeacher"]);
            await this.userRepository.update(id, user);
            await this.updateTeacherStudent(entityManager, id, manageTeacher, user);
        });
    }
    async updatePassword(updatePasswordDto) {
        if (updatePasswordDto.password !== updatePasswordDto.confirmPassword)
            throw '两次新密码不一致';
        const user = await this.userRepository.findOne({
            where: { id: updatePasswordDto.updater },
            select: ['username', 'password'],
        });
        if (updatePasswordDto.oldPassword !== user.password)
            throw '旧密码输入错误';
        return this.userRepository.update(updatePasswordDto.updater, {
            password: updatePasswordDto.password,
            updater: updatePasswordDto.updater,
        });
    }
    async resetPassword(id, updater) {
        return this.userRepository.update(id, { password: '123456', updater });
    }
    async updateTeacherStudent(entityManager, student, manageTeacher, user) {
        if (user.roleId !== 3)
            return;
        await entityManager.delete(teacher_student_entity_1.TeacherStudent, { student });
        if (!(manageTeacher === null || manageTeacher === void 0 ? void 0 : manageTeacher.length))
            return;
        const ts = manageTeacher.map((teacher) => ({
            teacher,
            student,
            creator: user.creator || user.updater,
            updater: user.updater,
        }));
        await entityManager.insert(teacher_student_entity_1.TeacherStudent, ts);
    }
    async removes(ids) {
        return this.userRepository.update(ids, { delFlag: 1 });
    }
    async findAll(pageInfo, query) {
        console.log(query);
        const [list, total] = await this.userRepository
            .createQueryBuilder('user')
            .leftJoinAndMapOne('user.photoResource', resource_entity_1.Resource, 'resource', 'resource.del_flag=0 and user.photo=resource.id')
            .leftJoinAndMapMany('user.manageTeacher', teacher_student_entity_1.TeacherStudent, 'ts', 'user.id=ts.student')
            .select([
            'user.id',
            'user.username',
            'user.name',
            'user.photo',
            'user.orgId',
            'user.orgIds',
            'user.roleId',
            'user.sex',
            'user.birthday',
            'user.idcard',
            'user.identity',
            'user.phone',
            'user.email',
            'user.createTime',
            'resource.id',
            'resource.diskname',
            'ts.id',
            'ts.teacher',
        ])
            .where([
            'user.del_flag=0',
            'user.del_flag=0',
            query.likeName && `user.name like '%${query.likeName}%'`,
            query.org && `user.org_id='${query.org}'`,
            query.role && `user.role_id='${query.role}'`,
        ]
            .filter(Boolean)
            .join(' and '))
            .orderBy('user.createTime', 'DESC')
            .skip(pageInfo.start)
            .take(pageInfo.size)
            .getManyAndCount();
        return { list, total };
    }
    findAllTeacher() {
        return this.userRepository
            .createQueryBuilder('user')
            .innerJoin(role_entity_1.Role, 'role', [
            'user.del_flag = 0',
            'role.del_flag = 0',
            'role.base = 2',
            'user.role_id = role.id',
        ].join(' and '))
            .select(['user.id', 'user.name'])
            .getMany();
    }
    findStudentByOrgId(orgId) {
        return this.userRepository
            .createQueryBuilder('user')
            .innerJoin(role_entity_1.Role, 'role', [
            'user.del_flag = 0',
            'role.del_flag = 0',
            'role.base = 3',
            'user.role_id = role.id',
        ].join(' and '))
            .select(['user.id', 'user.name'])
            .where('user.org_id=:orgId', { orgId })
            .getMany();
    }
    findStudentByTeacher(teacherId) {
        return this.userRepository
            .createQueryBuilder('user')
            .innerJoin(teacher_student_entity_1.TeacherStudent, 'ts', 'ts.student=user.id')
            .select(['user.id', 'user.name'])
            .where('ts.teacher=:teacherId', { teacherId })
            .getMany();
    }
    async batchCreate(userList, token) {
        if (Array.isArray(userList)) {
            const errList = [];
            const sucList = [];
            const allTeacher = [];
            for (const item of userList) {
                try {
                    console.log(item.manageTeacher);
                    item.creator = token.userId;
                    item.updater = token.userId;
                    await this.userRepository.save(item);
                    item.manageTeacher &&
                        allTeacher.push(...item.manageTeacher.map((tac) => ({
                            teacher: tac,
                            student: item.id,
                            creator: token.userId,
                            updater: token.userId,
                        })));
                    sucList.push(item);
                }
                catch (error) {
                    console.log(error);
                    item.errMsg = '用户名重复';
                    errList.push(item);
                }
            }
            await this.dataSource.getRepository(teacher_student_entity_1.TeacherStudent).save(allTeacher);
            return {
                errList,
                sucList,
            };
        }
    }
};
UserService = __decorate([
    (0, common_1.Injectable)(),
    __param(1, (0, typeorm_1.InjectRepository)(user_entity_1.User)),
    __metadata("design:paramtypes", [typeof (_a = typeof typeorm_2.DataSource !== "undefined" && typeorm_2.DataSource) === "function" ? _a : Object, typeof (_b = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _b : Object])
], UserService);
exports.UserService = UserService;


/***/ }),
/* 31 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.TeacherStudent = void 0;
const increment_id_entity_1 = __webpack_require__(17);
const typeorm_1 = __webpack_require__(18);
let TeacherStudent = class TeacherStudent extends increment_id_entity_1.IncrementIdEntity {
};
__decorate([
    (0, typeorm_1.Column)({ comment: '学员 ID' }),
    __metadata("design:type", String)
], TeacherStudent.prototype, "student", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '教员 ID' }),
    __metadata("design:type", String)
], TeacherStudent.prototype, "teacher", void 0);
TeacherStudent = __decorate([
    (0, typeorm_1.Entity)()
], TeacherStudent);
exports.TeacherStudent = TeacherStudent;


/***/ }),
/* 32 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var _a;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.JwtAuthGuard = void 0;
const common_1 = __webpack_require__(2);
const core_1 = __webpack_require__(3);
const passport_1 = __webpack_require__(33);
const no_token_decorator_1 = __webpack_require__(26);
let JwtAuthGuard = class JwtAuthGuard extends (0, passport_1.AuthGuard)('jwt') {
    constructor(reflector) {
        super();
        this.reflector = reflector;
    }
    canActivate(context) {
        const isNoAuthToken = this.reflector.getAllAndOverride(no_token_decorator_1.IS_NO_AUTH_TOKEN, [context.getHandler(), context.getClass()]);
        if (isNoAuthToken)
            return true;
        return super.canActivate(context);
    }
};
JwtAuthGuard = __decorate([
    (0, common_1.Injectable)(),
    __metadata("design:paramtypes", [typeof (_a = typeof core_1.Reflector !== "undefined" && core_1.Reflector) === "function" ? _a : Object])
], JwtAuthGuard);
exports.JwtAuthGuard = JwtAuthGuard;


/***/ }),
/* 33 */
/***/ ((module) => {

"use strict";
module.exports = require("@nestjs/passport");

/***/ }),
/* 34 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.JwtStrategy = void 0;
const passport_jwt_1 = __webpack_require__(35);
const passport_1 = __webpack_require__(33);
const common_1 = __webpack_require__(2);
let JwtStrategy = class JwtStrategy extends (0, passport_1.PassportStrategy)(passport_jwt_1.Strategy) {
    constructor() {
        super({
            jwtFromRequest: passport_jwt_1.ExtractJwt.fromAuthHeaderAsBearerToken(),
            ignoreExpiration: false,
            secretOrKey: 'jwtConstants.secret',
        });
    }
    async validate(payload) {
        return {
            userId: payload.sub,
            roleId: payload.auth,
            baseRole: payload.base,
            orgId: payload.org,
        };
    }
};
JwtStrategy = __decorate([
    (0, common_1.Injectable)(),
    __metadata("design:paramtypes", [])
], JwtStrategy);
exports.JwtStrategy = JwtStrategy;


/***/ }),
/* 35 */
/***/ ((module) => {

"use strict";
module.exports = require("passport-jwt");

/***/ }),
/* 36 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b, _c, _d, _e;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.OrgController = void 0;
const common_1 = __webpack_require__(2);
const swagger_1 = __webpack_require__(23);
const token_data_decorator_1 = __webpack_require__(37);
const create_org_dto_1 = __webpack_require__(38);
const update_org_dto_1 = __webpack_require__(41);
const token_data_entity_1 = __webpack_require__(42);
const org_service_1 = __webpack_require__(43);
const no_token_decorator_1 = __webpack_require__(26);
let OrgController = class OrgController {
    constructor(orgService) {
        this.orgService = orgService;
    }
    async create(createOrgDto, token) {
        createOrgDto.creator = createOrgDto.updater = token.userId;
        return this.orgService.create(createOrgDto);
    }
    async findAll() {
        return this.orgService.findAll();
    }
    async findOrgByUserId(token, query) {
        return this.orgService.findOrgByUserId(query.userId || token.userId);
    }
    async update(id, updateOrgDto) {
        return this.orgService.update(+id, updateOrgDto);
    }
    async remove(id) {
        return this.orgService.remove(+id);
    }
};
__decorate([
    (0, common_1.Post)(),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_b = typeof create_org_dto_1.CreateOrgDto !== "undefined" && create_org_dto_1.CreateOrgDto) === "function" ? _b : Object, typeof (_c = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _c : Object]),
    __metadata("design:returntype", Promise)
], OrgController.prototype, "create", null);
__decorate([
    (0, common_1.Get)(),
    (0, no_token_decorator_1.NoAuthToken)(),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Promise)
], OrgController.prototype, "findAll", null);
__decorate([
    (0, common_1.Get)('findOrgByUserId'),
    __param(0, (0, token_data_decorator_1.TokenData)()),
    __param(1, (0, common_1.Query)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_d = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _d : Object, Object]),
    __metadata("design:returntype", Promise)
], OrgController.prototype, "findOrgByUserId", null);
__decorate([
    (0, common_1.Patch)(':id'),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, typeof (_e = typeof update_org_dto_1.UpdateOrgDto !== "undefined" && update_org_dto_1.UpdateOrgDto) === "function" ? _e : Object]),
    __metadata("design:returntype", Promise)
], OrgController.prototype, "update", null);
__decorate([
    (0, common_1.Delete)(':id'),
    __param(0, (0, common_1.Param)('id')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], OrgController.prototype, "remove", null);
OrgController = __decorate([
    (0, swagger_1.ApiTags)('系统管理 - 组织机构'),
    (0, swagger_1.ApiBearerAuth)(),
    (0, common_1.Controller)('system/org'),
    __metadata("design:paramtypes", [typeof (_a = typeof org_service_1.OrgService !== "undefined" && org_service_1.OrgService) === "function" ? _a : Object])
], OrgController);
exports.OrgController = OrgController;


/***/ }),
/* 37 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

"use strict";

Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.TokenData = void 0;
const common_1 = __webpack_require__(2);
exports.TokenData = (0, common_1.createParamDecorator)((data, ctx) => {
    const request = ctx.switchToHttp().getRequest();
    return request.user;
});


/***/ }),
/* 38 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CreateOrgDto = void 0;
const swagger_1 = __webpack_require__(23);
const class_validator_1 = __webpack_require__(25);
const create_dto_1 = __webpack_require__(39);
class CreateOrgDto extends create_dto_1.CreateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '机构名称' }),
    (0, class_validator_1.IsNotEmpty)({ message: '机构名称不能为空' }),
    __metadata("design:type", String)
], CreateOrgDto.prototype, "name", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '机构描述' }),
    __metadata("design:type", String)
], CreateOrgDto.prototype, "desc", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '上级组织机构' }),
    (0, class_validator_1.IsNotEmpty)({ message: '请选择上级组织机构' }),
    __metadata("design:type", Number)
], CreateOrgDto.prototype, "pid", void 0);
exports.CreateOrgDto = CreateOrgDto;


/***/ }),
/* 39 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CreateDto = void 0;
const swagger_1 = __webpack_require__(23);
const update_dto_1 = __webpack_require__(40);
class CreateDto extends update_dto_1.UpdateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '创建人' }),
    __metadata("design:type", String)
], CreateDto.prototype, "creator", void 0);
exports.CreateDto = CreateDto;


/***/ }),
/* 40 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.UpdateDto = void 0;
const swagger_1 = __webpack_require__(23);
class UpdateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '更新人' }),
    __metadata("design:type", String)
], UpdateDto.prototype, "updater", void 0);
exports.UpdateDto = UpdateDto;


/***/ }),
/* 41 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.UpdateOrgDto = void 0;
const swagger_1 = __webpack_require__(23);
const class_validator_1 = __webpack_require__(25);
const create_dto_1 = __webpack_require__(39);
class UpdateOrgDto extends create_dto_1.CreateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '机构名称' }),
    (0, class_validator_1.IsNotEmpty)({ message: '机构名称不能为空' }),
    __metadata("design:type", String)
], UpdateOrgDto.prototype, "name", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '机构描述' }),
    __metadata("design:type", String)
], UpdateOrgDto.prototype, "desc", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '上级组织机构' }),
    (0, class_validator_1.IsNotEmpty)({ message: '请选择上级组织机构' }),
    __metadata("design:type", Number)
], UpdateOrgDto.prototype, "pid", void 0);
exports.UpdateOrgDto = UpdateOrgDto;


/***/ }),
/* 42 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.TokenDataEntity = void 0;
const swagger_1 = __webpack_require__(23);
class TokenDataEntity {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '用户 ID' }),
    __metadata("design:type", String)
], TokenDataEntity.prototype, "userId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '角色 ID' }),
    __metadata("design:type", Number)
], TokenDataEntity.prototype, "roleId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '基础角色' }),
    __metadata("design:type", Number)
], TokenDataEntity.prototype, "baseRole", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '组织 ID' }),
    __metadata("design:type", Number)
], TokenDataEntity.prototype, "orgId", void 0);
exports.TokenDataEntity = TokenDataEntity;


/***/ }),
/* 43 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.OrgService = void 0;
const common_1 = __webpack_require__(2);
const typeorm_1 = __webpack_require__(9);
const typeorm_2 = __webpack_require__(18);
const org_entity_1 = __webpack_require__(28);
const user_entity_1 = __webpack_require__(21);
let OrgService = class OrgService {
    constructor(orgRepository) {
        this.orgRepository = orgRepository;
    }
    async create(createOrgDto) {
        await this.orgRepository.insert(createOrgDto);
        return true;
    }
    async findAll() {
        return this.orgRepository.find({
            select: ['id', 'name', 'desc', 'pid'],
            where: { delFlag: 0 },
        });
    }
    async findOrgByUserId(userId) {
        return this.orgRepository
            .createQueryBuilder('org')
            .innerJoin(user_entity_1.User, 'user', ['org.del_flag=0', 'user.del_flag=0', 'user.orgId=org.id'].join(' and '))
            .select(['org.id', 'org.name', 'org.pid'])
            .where('user.id = :userId', { userId })
            .getMany();
    }
    async update(id, updateOrgDto) {
        return this.orgRepository.update(id, updateOrgDto);
    }
    async remove(id) {
        return this.orgRepository.update(id, { delFlag: 1 });
    }
};
OrgService = __decorate([
    (0, common_1.Injectable)(),
    __param(0, (0, typeorm_1.InjectRepository)(org_entity_1.Org)),
    __metadata("design:paramtypes", [typeof (_a = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _a : Object])
], OrgService);
exports.OrgService = OrgService;


/***/ }),
/* 44 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.FeatureService = void 0;
const common_1 = __webpack_require__(2);
const typeorm_1 = __webpack_require__(9);
const typeorm_2 = __webpack_require__(18);
const feature_entity_1 = __webpack_require__(29);
let FeatureService = class FeatureService {
    constructor(featureRepository) {
        this.featureRepository = featureRepository;
    }
    async findRoleFeatureApi(roleId) {
        return this.featureRepository.find({
            where: { roleId },
            select: ['id', 'name', 'type'],
        });
    }
};
FeatureService = __decorate([
    (0, common_1.Injectable)(),
    __param(0, (0, typeorm_1.InjectRepository)(feature_entity_1.Feature)),
    __metadata("design:paramtypes", [typeof (_a = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _a : Object])
], FeatureService);
exports.FeatureService = FeatureService;


/***/ }),
/* 45 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.FeatureController = void 0;
const common_1 = __webpack_require__(2);
const swagger_1 = __webpack_require__(23);
const token_data_decorator_1 = __webpack_require__(37);
const token_data_entity_1 = __webpack_require__(42);
const feature_service_1 = __webpack_require__(44);
let FeatureController = class FeatureController {
    constructor(featureService) {
        this.featureService = featureService;
    }
    async findRoleFeatureApi(token) {
        return this.featureService.findRoleFeatureApi(token.roleId);
    }
};
__decorate([
    (0, common_1.Get)(),
    __param(0, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_b = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _b : Object]),
    __metadata("design:returntype", Promise)
], FeatureController.prototype, "findRoleFeatureApi", null);
FeatureController = __decorate([
    (0, swagger_1.ApiTags)('系统管理 - 功能'),
    (0, swagger_1.ApiBearerAuth)(),
    (0, common_1.Controller)('system/feature'),
    __metadata("design:paramtypes", [typeof (_a = typeof feature_service_1.FeatureService !== "undefined" && feature_service_1.FeatureService) === "function" ? _a : Object])
], FeatureController);
exports.FeatureController = FeatureController;


/***/ }),
/* 46 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b, _c, _d;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.RoleController = void 0;
const common_1 = __webpack_require__(2);
const swagger_1 = __webpack_require__(23);
const token_data_decorator_1 = __webpack_require__(37);
const role_dto_1 = __webpack_require__(47);
const token_data_entity_1 = __webpack_require__(42);
const role_service_1 = __webpack_require__(48);
let RoleController = class RoleController {
    constructor(roleService) {
        this.roleService = roleService;
    }
    async create(roleDto, token) {
        roleDto.creator = roleDto.updater = token.userId;
        return this.roleService.create(roleDto);
    }
    async findAll() {
        return this.roleService.findAll();
    }
    async update(id, roleDto) {
        return this.roleService.update(+id, roleDto);
    }
    async remove(id) {
        return this.roleService.remove(+id);
    }
};
__decorate([
    (0, common_1.Post)(),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_b = typeof role_dto_1.RoleDto !== "undefined" && role_dto_1.RoleDto) === "function" ? _b : Object, typeof (_c = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _c : Object]),
    __metadata("design:returntype", Promise)
], RoleController.prototype, "create", null);
__decorate([
    (0, common_1.Get)(),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Promise)
], RoleController.prototype, "findAll", null);
__decorate([
    (0, common_1.Patch)(':id'),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, typeof (_d = typeof role_dto_1.RoleDto !== "undefined" && role_dto_1.RoleDto) === "function" ? _d : Object]),
    __metadata("design:returntype", Promise)
], RoleController.prototype, "update", null);
__decorate([
    (0, common_1.Delete)(':id'),
    __param(0, (0, common_1.Param)('id')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], RoleController.prototype, "remove", null);
RoleController = __decorate([
    (0, swagger_1.ApiTags)('系统管理 - 角色'),
    (0, swagger_1.ApiBearerAuth)(),
    (0, common_1.Controller)('system/role'),
    __metadata("design:paramtypes", [typeof (_a = typeof role_service_1.RoleService !== "undefined" && role_service_1.RoleService) === "function" ? _a : Object])
], RoleController);
exports.RoleController = RoleController;


/***/ }),
/* 47 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var _a;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.RoleDto = void 0;
const swagger_1 = __webpack_require__(23);
const class_validator_1 = __webpack_require__(25);
const create_dto_1 = __webpack_require__(39);
class RoleDto extends create_dto_1.CreateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '角色名称' }),
    (0, class_validator_1.IsNotEmpty)({ message: '角色名称不能为空' }),
    __metadata("design:type", String)
], RoleDto.prototype, "name", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '角色描述' }),
    __metadata("design:type", String)
], RoleDto.prototype, "desc", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '基于哪个角色编辑' }),
    __metadata("design:type", Number)
], RoleDto.prototype, "base", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '功能权限' }),
    (0, class_validator_1.IsArray)(),
    (0, class_validator_1.IsNotEmpty)({ message: '功能权限不能为空' }),
    __metadata("design:type", typeof (_a = typeof Array !== "undefined" && Array) === "function" ? _a : Object)
], RoleDto.prototype, "features", void 0);
exports.RoleDto = RoleDto;


/***/ }),
/* 48 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
var _a;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.RoleService = void 0;
const common_1 = __webpack_require__(2);
const typeorm_1 = __webpack_require__(9);
const typeorm_2 = __webpack_require__(18);
const feature_entity_1 = __webpack_require__(29);
const role_entity_1 = __webpack_require__(20);
let RoleService = class RoleService {
    constructor(roleRepository) {
        this.roleRepository = roleRepository;
    }
    async create(roleDto) {
        return await this.roleRepository.manager.transaction(async (entityManager) => {
            const { features } = roleDto, role = __rest(roleDto, ["features"]);
            const { id: roleId } = await entityManager.save(role_entity_1.Role, role);
            for (const v of features) {
                v.roleId = roleId;
                v.updater = v.creator = role.creator;
            }
            await entityManager.insert(feature_entity_1.Feature, features);
        });
    }
    async findAll() {
        return this.roleRepository
            .createQueryBuilder('role')
            .innerJoinAndMapMany('role.features', feature_entity_1.Feature, 'feature', [
            'feature.role_id=role.id',
            'feature.del_flag=0',
            'role.del_flag=0',
        ].join(' and '))
            .select([
            'role.id',
            'role.name',
            'role.desc',
            'role.base',
            'role.creator',
            'feature.name',
        ])
            .getMany();
    }
    async update(id, roleDto) {
        return await this.roleRepository.manager.transaction(async (entityManager) => {
            await entityManager.delete(feature_entity_1.Feature, { roleId: id });
            const { features } = roleDto, role = __rest(roleDto, ["features"]);
            await entityManager.update(role_entity_1.Role, { id }, role);
            for (const v of features) {
                v.roleId = id;
                v.updater = v.creator = role.creator;
            }
            await entityManager.insert(feature_entity_1.Feature, features);
        });
    }
    async remove(id) {
        return await this.roleRepository.manager.transaction(async (entityManager) => {
            await entityManager.delete(feature_entity_1.Feature, { roleId: id });
            await entityManager.update(role_entity_1.Role, { id }, { delFlag: 1 });
        });
    }
};
RoleService = __decorate([
    (0, common_1.Injectable)(),
    __param(0, (0, typeorm_1.InjectRepository)(role_entity_1.Role)),
    __metadata("design:paramtypes", [typeof (_a = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _a : Object])
], RoleService);
exports.RoleService = RoleService;


/***/ }),
/* 49 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.UserController = void 0;
const common_1 = __webpack_require__(2);
const swagger_1 = __webpack_require__(23);
const token_data_decorator_1 = __webpack_require__(37);
const user_dto_1 = __webpack_require__(50);
const token_data_entity_1 = __webpack_require__(42);
const user_service_1 = __webpack_require__(30);
const query_page_info_decorator_1 = __webpack_require__(51);
const page_info_entity_1 = __webpack_require__(52);
const update_password_dto_1 = __webpack_require__(53);
const no_token_decorator_1 = __webpack_require__(26);
let UserController = class UserController {
    constructor(userService) {
        this.userService = userService;
    }
    async batchCreate(token, userList) {
        console.log('6666666666666666666666');
        return this.userService.batchCreate(userList, token);
    }
    async create(userDto, token) {
        userDto.creator = userDto.updater = token === null || token === void 0 ? void 0 : token.userId;
        return this.userService.create(userDto);
    }
    async register(userDto) {
        userDto.creator = userDto.updater = 'resgister';
        userDto.roleId = 3;
        return this.userService.create(userDto);
    }
    async findAll(pageInfo, query) {
        return this.userService.findAll(pageInfo, query);
    }
    async update(id, token, userDto) {
        userDto.updater = token.userId;
        return this.userService.update(id, userDto);
    }
    async updatePassword(token, updatePasswordDto) {
        updatePasswordDto.updater = token.userId;
        return this.userService.updatePassword(updatePasswordDto);
    }
    async resetPassword(id, token) {
        return this.userService.resetPassword(id, token.userId);
    }
    async removes(ids) {
        return this.userService.removes(ids.split(','));
    }
    async findAllTeacher() {
        return this.userService.findAllTeacher();
    }
    async findStudentByOrgId(orgId) {
        return this.userService.findStudentByOrgId(+orgId);
    }
    async findStudentByTeacher(teacherId, token) {
        return this.userService.findStudentByTeacher(teacherId || token.userId);
    }
};
__decorate([
    (0, common_1.Post)('batchCreate'),
    __param(0, (0, token_data_decorator_1.TokenData)()),
    __param(1, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_b = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _b : Object, Object]),
    __metadata("design:returntype", Promise)
], UserController.prototype, "batchCreate", null);
__decorate([
    (0, common_1.Post)(),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_c = typeof user_dto_1.UserDto !== "undefined" && user_dto_1.UserDto) === "function" ? _c : Object, typeof (_d = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _d : Object]),
    __metadata("design:returntype", Promise)
], UserController.prototype, "create", null);
__decorate([
    (0, common_1.Post)('register'),
    (0, no_token_decorator_1.NoAuthToken)(),
    __param(0, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_e = typeof user_dto_1.UserDto !== "undefined" && user_dto_1.UserDto) === "function" ? _e : Object]),
    __metadata("design:returntype", Promise)
], UserController.prototype, "register", null);
__decorate([
    (0, common_1.Get)(),
    __param(0, (0, query_page_info_decorator_1.PageInfo)()),
    __param(1, (0, common_1.Query)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_f = typeof page_info_entity_1.PageInfoEntity !== "undefined" && page_info_entity_1.PageInfoEntity) === "function" ? _f : Object, Object]),
    __metadata("design:returntype", Promise)
], UserController.prototype, "findAll", null);
__decorate([
    (0, common_1.Patch)(':id'),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __param(2, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, typeof (_g = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _g : Object, typeof (_h = typeof user_dto_1.UserDto !== "undefined" && user_dto_1.UserDto) === "function" ? _h : Object]),
    __metadata("design:returntype", Promise)
], UserController.prototype, "update", null);
__decorate([
    (0, common_1.Post)('updatePassword'),
    __param(0, (0, token_data_decorator_1.TokenData)()),
    __param(1, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_j = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _j : Object, typeof (_k = typeof update_password_dto_1.UpdatePasswordDto !== "undefined" && update_password_dto_1.UpdatePasswordDto) === "function" ? _k : Object]),
    __metadata("design:returntype", Promise)
], UserController.prototype, "updatePassword", null);
__decorate([
    (0, common_1.Patch)('resetPassword/:id'),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, typeof (_l = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _l : Object]),
    __metadata("design:returntype", Promise)
], UserController.prototype, "resetPassword", null);
__decorate([
    (0, common_1.Delete)(),
    __param(0, (0, common_1.Query)('ids')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], UserController.prototype, "removes", null);
__decorate([
    (0, no_token_decorator_1.NoAuthToken)(),
    (0, common_1.Get)('findAllTeacher'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Promise)
], UserController.prototype, "findAllTeacher", null);
__decorate([
    (0, common_1.Get)('findStudentByOrgId'),
    __param(0, (0, common_1.Query)('orgId')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], UserController.prototype, "findStudentByOrgId", null);
__decorate([
    (0, common_1.Get)('findStudentByTeacher'),
    __param(0, (0, common_1.Query)('teacherId')),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, typeof (_m = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _m : Object]),
    __metadata("design:returntype", Promise)
], UserController.prototype, "findStudentByTeacher", null);
UserController = __decorate([
    (0, swagger_1.ApiTags)('系统管理 - 组织机构'),
    (0, swagger_1.ApiBearerAuth)(),
    (0, common_1.Controller)('system/user'),
    __metadata("design:paramtypes", [typeof (_a = typeof user_service_1.UserService !== "undefined" && user_service_1.UserService) === "function" ? _a : Object])
], UserController);
exports.UserController = UserController;


/***/ }),
/* 50 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var _a;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.UserDto = void 0;
const swagger_1 = __webpack_require__(23);
const class_validator_1 = __webpack_require__(25);
const create_dto_1 = __webpack_require__(39);
class UserDto extends create_dto_1.CreateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '用户名' }),
    (0, class_validator_1.IsNotEmpty)({ message: '用户名不能为空' }),
    __metadata("design:type", String)
], UserDto.prototype, "username", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '姓名' }),
    (0, class_validator_1.IsNotEmpty)({ message: '姓名不能为空' }),
    __metadata("design:type", String)
], UserDto.prototype, "name", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '角色 ID' }),
    (0, class_validator_1.IsNotEmpty)({ message: '角色不能为空' }),
    __metadata("design:type", Number)
], UserDto.prototype, "roleId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '组织机构 ID' }),
    (0, class_validator_1.IsNotEmpty)({ message: '组织机构不能为空' }),
    __metadata("design:type", Number)
], UserDto.prototype, "orgId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '多级组织机构 ID ' }),
    (0, class_validator_1.IsNotEmpty)({ message: '组织机构不能为空' }),
    __metadata("design:type", String)
], UserDto.prototype, "orgIds", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '管辖老师' }),
    __metadata("design:type", Array)
], UserDto.prototype, "manageTeacher", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '照片' }),
    __metadata("design:type", Number)
], UserDto.prototype, "photo", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '头像' }),
    __metadata("design:type", String)
], UserDto.prototype, "avatar", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '性别：0/女，1/男' }),
    __metadata("design:type", Number)
], UserDto.prototype, "sex", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '出生年月' }),
    __metadata("design:type", typeof (_a = typeof Date !== "undefined" && Date) === "function" ? _a : Object)
], UserDto.prototype, "birthday", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '身份证号' }),
    __metadata("design:type", String)
], UserDto.prototype, "idcard", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '职位' }),
    __metadata("design:type", String)
], UserDto.prototype, "identity", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '电话' }),
    __metadata("design:type", String)
], UserDto.prototype, "phone", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '邮箱' }),
    __metadata("design:type", String)
], UserDto.prototype, "email", void 0);
exports.UserDto = UserDto;


/***/ }),
/* 51 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

"use strict";

Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.PageInfo = void 0;
const common_1 = __webpack_require__(2);
const page_info_entity_1 = __webpack_require__(52);
exports.PageInfo = (0, common_1.createParamDecorator)((data, ctx) => {
    return new page_info_entity_1.PageInfoEntity(ctx.switchToHttp().getRequest().query);
});


/***/ }),
/* 52 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.PageInfoEntity = void 0;
const swagger_1 = __webpack_require__(23);
class PageInfoEntity {
    constructor({ current, size }) {
        this.size = +size || 10;
        this.current = +current || 1;
        this.start = (this.current - 1) * this.size;
    }
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '当前页' }),
    __metadata("design:type", Number)
], PageInfoEntity.prototype, "current", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '每页条数' }),
    __metadata("design:type", Number)
], PageInfoEntity.prototype, "size", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '起始页' }),
    __metadata("design:type", Number)
], PageInfoEntity.prototype, "start", void 0);
exports.PageInfoEntity = PageInfoEntity;


/***/ }),
/* 53 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.UpdatePasswordDto = void 0;
const swagger_1 = __webpack_require__(23);
const class_validator_1 = __webpack_require__(25);
const update_dto_1 = __webpack_require__(40);
class UpdatePasswordDto extends update_dto_1.UpdateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '旧密码' }),
    (0, class_validator_1.IsNotEmpty)({ message: '请输入旧密码' }),
    __metadata("design:type", String)
], UpdatePasswordDto.prototype, "oldPassword", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '新密码' }),
    (0, class_validator_1.IsNotEmpty)({ message: '请输入新密码' }),
    __metadata("design:type", String)
], UpdatePasswordDto.prototype, "password", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '确认新密码' }),
    (0, class_validator_1.IsNotEmpty)({ message: '请输入确认新密码' }),
    __metadata("design:type", String)
], UpdatePasswordDto.prototype, "confirmPassword", void 0);
exports.UpdatePasswordDto = UpdatePasswordDto;


/***/ }),
/* 54 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.OnlineTeachingModule = void 0;
const common_1 = __webpack_require__(2);
const live_teaching_service_1 = __webpack_require__(55);
const live_teaching_controller_1 = __webpack_require__(63);
const live_teaching_entity_1 = __webpack_require__(62);
const typeorm_1 = __webpack_require__(9);
const live_courseware_entity_1 = __webpack_require__(58);
const live_question_entity_1 = __webpack_require__(60);
const live_evaluate_entity_1 = __webpack_require__(59);
const live_student_entity_1 = __webpack_require__(61);
const live_classify_entity_1 = __webpack_require__(57);
const live_class_controller_1 = __webpack_require__(71);
const live_class_service_1 = __webpack_require__(72);
const online_teaching_gateway_1 = __webpack_require__(84);
const live_msg_data_entity_1 = __webpack_require__(88);
const live_question_answer_entity_1 = __webpack_require__(82);
const question_entity_1 = __webpack_require__(56);
const jwt_auth_guard_1 = __webpack_require__(32);
const jwt_1 = __webpack_require__(15);
const core_1 = __webpack_require__(3);
let OnlineTeachingModule = class OnlineTeachingModule {
};
OnlineTeachingModule = __decorate([
    (0, common_1.Module)({
        imports: [
            typeorm_1.TypeOrmModule.forFeature([
                live_teaching_entity_1.LiveTeaching,
                live_courseware_entity_1.LiveCourseware,
                live_question_entity_1.LiveQuestion,
                live_evaluate_entity_1.LiveEvaluate,
                live_student_entity_1.LiveStudent,
                live_classify_entity_1.LiveClassify,
                live_msg_data_entity_1.LiveMsgData,
                live_question_entity_1.LiveQuestion,
                live_question_answer_entity_1.LiveQuestionAnswer,
                question_entity_1.Question,
            ]),
            jwt_1.JwtModule.register({
                secret: 'jwtConstants.secret',
                signOptions: { expiresIn: '7d' },
            }),
        ],
        controllers: [live_teaching_controller_1.LiveTeachingController, live_class_controller_1.LiveClassController],
        providers: [
            live_teaching_service_1.LiveTeachingService,
            live_class_service_1.LiveClassService,
            online_teaching_gateway_1.OnlineTeachingGateway,
            {
                provide: core_1.APP_GUARD,
                useClass: jwt_auth_guard_1.JwtAuthGuard,
            },
        ],
    })
], OnlineTeachingModule);
exports.OnlineTeachingModule = OnlineTeachingModule;


/***/ }),
/* 55 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b, _c, _d, _e, _f;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.LiveTeachingService = void 0;
const typeorm_1 = __webpack_require__(9);
const question_entity_1 = __webpack_require__(56);
const resource_entity_1 = __webpack_require__(16);
const user_entity_1 = __webpack_require__(21);
const typeorm_2 = __webpack_require__(18);
const live_classify_entity_1 = __webpack_require__(57);
const live_courseware_entity_1 = __webpack_require__(58);
const live_evaluate_entity_1 = __webpack_require__(59);
const live_question_entity_1 = __webpack_require__(60);
const live_student_entity_1 = __webpack_require__(61);
const live_teaching_entity_1 = __webpack_require__(62);
let LiveTeachingService = class LiveTeachingService {
    constructor(Live_Sql, LiveCourseware_Sql, LiveEvaluate_Sql, LiveQuestion_Sql, LiveStudent_Sql, LiveClassify_Sql) {
        this.Live_Sql = Live_Sql;
        this.LiveCourseware_Sql = LiveCourseware_Sql;
        this.LiveEvaluate_Sql = LiveEvaluate_Sql;
        this.LiveQuestion_Sql = LiveQuestion_Sql;
        this.LiveStudent_Sql = LiveStudent_Sql;
        this.LiveClassify_Sql = LiveClassify_Sql;
    }
    async findLiveList(pageInfo, { userId }) {
        const page = pageInfo.page;
        const pageSize = pageInfo.pageSize;
        const res = await this.Live_Sql.createQueryBuilder('live')
            .leftJoinAndMapOne('live.lecturerInfo', user_entity_1.User, 'user', 'user.id = live.lecturer')
            .where({
            delFlag: 0,
            lecturer: userId,
        })
            .orderBy('live.updateTime', 'DESC')
            .skip((page - 1) * pageSize)
            .take(pageSize)
            .getManyAndCount();
        return {
            data: res[0],
            total: res[1],
        };
    }
    async createLive(liveData, tokenData) {
        liveData.creator = tokenData.userId;
        liveData.updater = tokenData.userId;
        const res = await this.Live_Sql.save(liveData);
        const liveId = res.id;
        const courseware = liveData.liveCourseware.map((ware) => {
            return { fileId: ware.fileId, liveId };
        });
        const evealuate = liveData.evalDimension.map((eveal) => {
            return {
                liveId,
                dimensionality: eveal.dimensionality,
                type: eveal.type,
            };
        });
        const question = liveData.liveQuestion.map((lq) => {
            delete lq.liveId;
            return Object.assign({ liveId }, lq);
        });
        const students = liveData.liveStudent.map((id) => {
            return {
                studentId: id,
                liveId,
            };
        });
        this.LiveCourseware_Sql.insert(courseware);
        this.LiveEvaluate_Sql.insert(evealuate);
        this.LiveQuestion_Sql.insert(question);
        this.LiveStudent_Sql.insert(students);
        return res;
    }
    async searchSomeLive(searchInfo) {
        const page = searchInfo.page - 1;
        const pageSize = searchInfo.pageSize;
        const res = await this.Live_Sql.createQueryBuilder('live')
            .leftJoinAndMapOne('live.lecturerInfo', user_entity_1.User, 'user', 'user.id = live.lecturer')
            .where({
            delFlag: 0,
            title: (0, typeorm_2.Like)(`%${searchInfo.value}%`),
        })
            .skip(page * pageSize)
            .take(pageSize)
            .getManyAndCount();
        return {
            total: res[1],
            data: res[0],
        };
    }
    async findOneInfo(id, tokenInfo) {
        const res = this.Live_Sql.createQueryBuilder('live')
            .leftJoinAndMapMany('live.liveCourseware', live_courseware_entity_1.LiveCourseware, 'lcs', `lcs.liveId = live.id AND lcs.del_flag = 0`)
            .leftJoinAndMapOne('live.lecturerInfo', user_entity_1.User, 'user', 'user.id = live.lecturer')
            .leftJoinAndMapMany('live.evalDimension', live_evaluate_entity_1.LiveEvaluate, 'le', 'le.liveId = live.id  AND le.del_flag = 0')
            .leftJoinAndMapMany('live.liveQuestion', live_question_entity_1.LiveQuestion, 'lq', 'lq.liveId = live.id  AND lq.del_flag = 0')
            .leftJoinAndMapMany('live.liveStudent', live_student_entity_1.LiveStudent, 'ls', 'ls.liveId = live.id  AND ls.del_flag = 0')
            .leftJoinAndMapOne('ls.info', user_entity_1.User, 'student', 'student.id = ls.student_id ')
            .leftJoinAndMapOne('lcs.info', resource_entity_1.Resource, 'lcsInfo', 'lcs.file_id = lcsInfo.id')
            .leftJoinAndMapOne('lq.info', question_entity_1.Question, 'lqInfo', 'lq.question_id = lqInfo.id')
            .leftJoinAndMapOne('ls.info', user_entity_1.User, 'lsInfo', 'ls.studentId = lsInfo.id')
            .where({ id })
            .getOne();
        return res;
    }
    async updateLive(liveData, tokenInfo) {
        this.Live_Sql.update(liveData.id, { delFlag: 1 });
        delete liveData.id;
        return this.createLive(liveData, tokenInfo);
    }
    async deleteLive(id, tokenInfo) {
        const res = await this.Live_Sql.update(id, {
            delFlag: 1,
            updater: tokenInfo.userId,
        });
        return res;
    }
    async getLiveInfo(id, tokenInfo) {
        const res = this.Live_Sql.createQueryBuilder('l')
            .leftJoinAndMapMany('l.courseware', live_courseware_entity_1.LiveCourseware, 'lc', 'lc.delFlag = 0 AND lc.liveId = l.id')
            .leftJoinAndMapOne('l.lecturerInfo', user_entity_1.User, 'user', 'user.id = l.lecturer')
            .leftJoinAndMapOne('user.photo', resource_entity_1.Resource, 'r', 'r.id = user.photo')
            .leftJoinAndMapMany('l.evealuate', live_evaluate_entity_1.LiveEvaluate, 'le', 'le.delFlag = 0 AND le.liveId = l.id')
            .leftJoinAndMapMany('l.question', live_question_entity_1.LiveQuestion, 'lq', 'lq.delFlag = 0 AND lq.liveId = l.id')
            .where({ id })
            .getOne();
        return res;
    }
    async updateLiveInfo(data) {
        return await this.Live_Sql.update(data.id, data);
    }
    async getclassifyList() {
        const res = await this.LiveClassify_Sql.findBy({ delFlag: 0 });
        return res;
    }
    async createclassify(classify) {
        const res = await this.LiveClassify_Sql.save(classify);
        return res;
    }
    async updateclassify(id, classify) {
        const res = await this.LiveClassify_Sql.update(id, classify);
        return res;
    }
    async deleteclassify({ id }) {
        const res = await this.LiveClassify_Sql.update(id, { delFlag: 1 });
        return res;
    }
};
LiveTeachingService = __decorate([
    __param(0, (0, typeorm_1.InjectRepository)(live_teaching_entity_1.LiveTeaching)),
    __param(1, (0, typeorm_1.InjectRepository)(live_courseware_entity_1.LiveCourseware)),
    __param(2, (0, typeorm_1.InjectRepository)(live_evaluate_entity_1.LiveEvaluate)),
    __param(3, (0, typeorm_1.InjectRepository)(live_question_entity_1.LiveQuestion)),
    __param(4, (0, typeorm_1.InjectRepository)(live_student_entity_1.LiveStudent)),
    __param(5, (0, typeorm_1.InjectRepository)(live_classify_entity_1.LiveClassify)),
    __metadata("design:paramtypes", [typeof (_a = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _a : Object, typeof (_b = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _b : Object, typeof (_c = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _c : Object, typeof (_d = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _d : Object, typeof (_e = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _e : Object, typeof (_f = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _f : Object])
], LiveTeachingService);
exports.LiveTeachingService = LiveTeachingService;


/***/ }),
/* 56 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Question = void 0;
const increment_id_entity_1 = __webpack_require__(17);
const typeorm_1 = __webpack_require__(18);
let Question = class Question extends increment_id_entity_1.IncrementIdEntity {
};
__decorate([
    (0, typeorm_1.Column)({ comment: '试题类型（对应QuestionType表）' }),
    __metadata("design:type", Number)
], Question.prototype, "type", void 0);
__decorate([
    (0, typeorm_1.Column)({
        name: 'difficulty_level',
        comment: '难易程度（对应QuestionDifficultyLevel',
    }),
    __metadata("design:type", Number)
], Question.prototype, "difficultyLevel", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'classify_id', comment: '试题分类', default: null }),
    __metadata("design:type", Number)
], Question.prototype, "classifyId", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'knowledge_id', comment: '知识点ID', default: null }),
    __metadata("design:type", Number)
], Question.prototype, "knowledgeId", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '试题题目' }),
    __metadata("design:type", String)
], Question.prototype, "title", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '选项（json）', type: global.DB_IS_SQLITE ? 'text' : 'longtext' }),
    __metadata("design:type", String)
], Question.prototype, "options", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '正确答案（json）', type: global.DB_IS_SQLITE ? 'text' : 'longtext' }),
    __metadata("design:type", String)
], Question.prototype, "answer", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '答案解析', type: global.DB_IS_SQLITE ? 'text' : 'longtext' }),
    __metadata("design:type", String)
], Question.prototype, "analysis", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '是否允许学员使用', default: 0 }),
    __metadata("design:type", Number)
], Question.prototype, "student", void 0);
Question = __decorate([
    (0, typeorm_1.Entity)()
], Question);
exports.Question = Question;


/***/ }),
/* 57 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.LiveClassify = void 0;
const typeorm_1 = __webpack_require__(18);
let LiveClassify = class LiveClassify {
};
__decorate([
    (0, typeorm_1.PrimaryGeneratedColumn)('increment'),
    __metadata("design:type", Number)
], LiveClassify.prototype, "id", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '父级ID' }),
    __metadata("design:type", Number)
], LiveClassify.prototype, "pid", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '分类名称', type: 'text' }),
    __metadata("design:type", String)
], LiveClassify.prototype, "name", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '层级' }),
    __metadata("design:type", Number)
], LiveClassify.prototype, "level", void 0);
__decorate([
    (0, typeorm_1.Column)({
        default: 0,
        select: false,
        name: 'del_flag',
        comment: '是否删除：0否/1是',
    }),
    __metadata("design:type", Number)
], LiveClassify.prototype, "delFlag", void 0);
LiveClassify = __decorate([
    (0, typeorm_1.Entity)()
], LiveClassify);
exports.LiveClassify = LiveClassify;


/***/ }),
/* 58 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.LiveCourseware = void 0;
const typeorm_1 = __webpack_require__(18);
let LiveCourseware = class LiveCourseware {
};
__decorate([
    (0, typeorm_1.PrimaryGeneratedColumn)('increment'),
    __metadata("design:type", Number)
], LiveCourseware.prototype, "id", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'file_id', comment: '课件id' }),
    __metadata("design:type", Number)
], LiveCourseware.prototype, "fileId", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'live_id', comment: '直播id' }),
    __metadata("design:type", Number)
], LiveCourseware.prototype, "liveId", void 0);
__decorate([
    (0, typeorm_1.Column)({
        default: 0,
        select: false,
        name: 'del_flag',
        comment: '是否删除：0否/1是',
    }),
    __metadata("design:type", Number)
], LiveCourseware.prototype, "delFlag", void 0);
LiveCourseware = __decorate([
    (0, typeorm_1.Entity)()
], LiveCourseware);
exports.LiveCourseware = LiveCourseware;


/***/ }),
/* 59 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.LiveEvaluate = void 0;
const typeorm_1 = __webpack_require__(18);
let LiveEvaluate = class LiveEvaluate {
};
__decorate([
    (0, typeorm_1.PrimaryGeneratedColumn)('increment'),
    __metadata("design:type", Number)
], LiveEvaluate.prototype, "id", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'coruse_id', comment: '课程ID' }),
    __metadata("design:type", Number)
], LiveEvaluate.prototype, "liveId", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '维度名称', type: 'text' }),
    __metadata("design:type", String)
], LiveEvaluate.prototype, "dimensionality", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '0/1 直播评价或学院自评', default: 0 }),
    __metadata("design:type", Number)
], LiveEvaluate.prototype, "type", void 0);
__decorate([
    (0, typeorm_1.Column)({
        default: 0,
        select: false,
        name: 'del_flag',
        comment: '是否删除：0否/1是',
    }),
    __metadata("design:type", Number)
], LiveEvaluate.prototype, "delFlag", void 0);
LiveEvaluate = __decorate([
    (0, typeorm_1.Entity)()
], LiveEvaluate);
exports.LiveEvaluate = LiveEvaluate;


/***/ }),
/* 60 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.LiveQuestion = void 0;
const typeorm_1 = __webpack_require__(18);
let LiveQuestion = class LiveQuestion {
};
__decorate([
    (0, typeorm_1.PrimaryGeneratedColumn)('increment'),
    __metadata("design:type", Number)
], LiveQuestion.prototype, "id", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'live_id', comment: '直播id' }),
    __metadata("design:type", Number)
], LiveQuestion.prototype, "liveId", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'question_id', comment: '试题ID（对应Question表）' }),
    __metadata("design:type", Number)
], LiveQuestion.prototype, "questionId", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '该题分值' }),
    __metadata("design:type", Number)
], LiveQuestion.prototype, "score", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '题类型' }),
    __metadata("design:type", Number)
], LiveQuestion.prototype, "type", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'is_fixed', comment: '固定选题、随机选题' }),
    __metadata("design:type", Number)
], LiveQuestion.prototype, "isFixed", void 0);
__decorate([
    (0, typeorm_1.Column)({
        default: 0,
        select: false,
        name: 'del_flag',
        comment: '是否删除：0否/1是',
    }),
    __metadata("design:type", Number)
], LiveQuestion.prototype, "delFlag", void 0);
LiveQuestion = __decorate([
    (0, typeorm_1.Entity)()
], LiveQuestion);
exports.LiveQuestion = LiveQuestion;


/***/ }),
/* 61 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.LiveStudent = void 0;
const typeorm_1 = __webpack_require__(18);
let LiveStudent = class LiveStudent {
};
__decorate([
    (0, typeorm_1.PrimaryGeneratedColumn)('increment'),
    __metadata("design:type", Number)
], LiveStudent.prototype, "id", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'student_id', type: global.DB_IS_SQLITE ? 'text' : 'longtext', comment: '学员id' }),
    __metadata("design:type", String)
], LiveStudent.prototype, "studentId", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'live_id', comment: '直播id' }),
    __metadata("design:type", Number)
], LiveStudent.prototype, "liveId", void 0);
__decorate([
    (0, typeorm_1.Column)({
        default: 0,
        select: false,
        name: 'del_flag',
        comment: '是否删除：0否/1是',
    }),
    __metadata("design:type", Number)
], LiveStudent.prototype, "delFlag", void 0);
LiveStudent = __decorate([
    (0, typeorm_1.Entity)()
], LiveStudent);
exports.LiveStudent = LiveStudent;


/***/ }),
/* 62 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var _a, _b, _c, _d;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.LiveTeaching = void 0;
const increment_id_entity_1 = __webpack_require__(17);
const typeorm_1 = __webpack_require__(18);
let LiveTeaching = class LiveTeaching extends increment_id_entity_1.IncrementIdEntity {
};
__decorate([
    (0, typeorm_1.Column)({ type: global.DB_IS_SQLITE ? 'text' : 'longtext', comment: '直播名称' }),
    __metadata("design:type", String)
], LiveTeaching.prototype, "title", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'start_time', comment: '开始时间' }),
    __metadata("design:type", typeof (_a = typeof Date !== "undefined" && Date) === "function" ? _a : Object)
], LiveTeaching.prototype, "startTime", void 0);
__decorate([
    (0, typeorm_1.Column)({
        name: 'actual_start_time',
        comment: '真实开始时间',
        nullable: true,
        default: null,
    }),
    __metadata("design:type", typeof (_b = typeof Date !== "undefined" && Date) === "function" ? _b : Object)
], LiveTeaching.prototype, "actualStartTime", void 0);
__decorate([
    (0, typeorm_1.Column)({
        name: 'actual_end_time',
        comment: '真实结束时间',
        nullable: true,
        default: null,
    }),
    __metadata("design:type", typeof (_c = typeof Date !== "undefined" && Date) === "function" ? _c : Object)
], LiveTeaching.prototype, "actualEndTime", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '直播时长', default: 0 }),
    __metadata("design:type", Number)
], LiveTeaching.prototype, "duration", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '直播分类' }),
    __metadata("design:type", Number)
], LiveTeaching.prototype, "classify", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '直播简介', type: global.DB_IS_SQLITE ? 'text' : 'longtext' }),
    __metadata("design:type", String)
], LiveTeaching.prototype, "explain", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '直播封面', type: global.DB_IS_SQLITE ? 'text' : 'longtext' }),
    __metadata("design:type", String)
], LiveTeaching.prototype, "cover", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '直播状态 0/1/2 未开始/进行中/已结束', default: 0 }),
    __metadata("design:type", Number)
], LiveTeaching.prototype, "status", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'warm_up_picture', comment: '暖场图片', type: global.DB_IS_SQLITE ? 'text' : 'longtext' }),
    __metadata("design:type", String)
], LiveTeaching.prototype, "warmUpPicture", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'warm_up_musice', comment: '暖场音乐', type: global.DB_IS_SQLITE ? 'text' : 'longtext' }),
    __metadata("design:type", String)
], LiveTeaching.prototype, "warmUpMusice", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '是否回放0/1' }),
    __metadata("design:type", Number)
], LiveTeaching.prototype, "playback", void 0);
__decorate([
    (0, typeorm_1.Column)({
        name: 'playback_deadline',
        comment: '回放期限',
        nullable: true,
        default: null,
    }),
    __metadata("design:type", typeof (_d = typeof Date !== "undefined" && Date) === "function" ? _d : Object)
], LiveTeaching.prototype, "playbackDeadline", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'open_quiz', comment: '0/1开启课程问答' }),
    __metadata("design:type", Number)
], LiveTeaching.prototype, "openQuiz", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: global.DB_IS_SQLITE ? 'text' : 'longtext', comment: '讲师' }),
    __metadata("design:type", String)
], LiveTeaching.prototype, "lecturer", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'open_discussion', comment: '是否开启讨论', default: 0 }),
    __metadata("design:type", Number)
], LiveTeaching.prototype, "openDiscussion", void 0);
__decorate([
    (0, typeorm_1.Column)({
        name: 'open_self_evaluation',
        default: 0,
        comment: '0/1开启学员自评',
    }),
    __metadata("design:type", Number)
], LiveTeaching.prototype, "openSelfEvaluation", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'open_eval', comment: '是否开启评价', default: 0 }),
    __metadata("design:type", Number)
], LiveTeaching.prototype, "openEval", void 0);
__decorate([
    (0, typeorm_1.Column)({
        name: 'txt_or_grade_evealute',
        comment: '文本或维度评价',
        default: 0,
    }),
    __metadata("design:type", Number)
], LiveTeaching.prototype, "txtOrGradeEvealute", void 0);
__decorate([
    (0, typeorm_1.Column)({
        type: global.DB_IS_SQLITE ? 'text' : 'longtext',
        name: 'text_evaluate_title',
        comment: '文本评价标题',
    }),
    __metadata("design:type", String)
], LiveTeaching.prototype, "textEvaluateTitle", void 0);
LiveTeaching = __decorate([
    (0, typeorm_1.Entity)()
], LiveTeaching);
exports.LiveTeaching = LiveTeaching;


/***/ }),
/* 63 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b, _c, _d, _e, _f, _g, _h;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.LiveTeachingController = void 0;
const common_1 = __webpack_require__(2);
const swagger_1 = __webpack_require__(23);
const token_data_decorator_1 = __webpack_require__(37);
const live_create_dto_1 = __webpack_require__(64);
const live_update_dto_1 = __webpack_require__(65);
const live_teaching_service_1 = __webpack_require__(55);
const pagination_dto_1 = __webpack_require__(66);
const course_classify_dto_1 = __webpack_require__(67);
const update_course_classify_dto_1 = __webpack_require__(68);
const delete_dto_1 = __webpack_require__(69);
const get_course_list_dto_1 = __webpack_require__(70);
const no_token_decorator_1 = __webpack_require__(26);
let LiveTeachingController = class LiveTeachingController {
    constructor(LiveTeachingService) {
        this.LiveTeachingService = LiveTeachingService;
    }
    findLiveList(pageInfo, tokenInfo) {
        return this.LiveTeachingService.findLiveList(pageInfo, tokenInfo);
    }
    getLiveInfo(id, tokenInfo) {
        return this.LiveTeachingService.getLiveInfo(id, tokenInfo);
    }
    findOneInfo(id, tokenInfo) {
        return this.LiveTeachingService.findOneInfo(id, tokenInfo);
    }
    searchSomeLive(searchInfo) {
        return this.LiveTeachingService.searchSomeLive(searchInfo);
    }
    createLive(LiveInfo, tokenInfo) {
        return this.LiveTeachingService.createLive(LiveInfo, tokenInfo);
    }
    updateLive(LiveInfo, tokenInfo) {
        return this.LiveTeachingService.updateLive(LiveInfo, tokenInfo);
    }
    deleteLive(id, tokenInfo) {
        let sId = id;
        sId = sId.split(',');
        return this.LiveTeachingService.deleteLive(sId, tokenInfo);
    }
    updateLiveInfo(data) {
        return this.LiveTeachingService.updateLiveInfo(data);
    }
    getclassifyList() {
        return this.LiveTeachingService.getclassifyList();
    }
    createclassify(createclassify) {
        return this.LiveTeachingService.createclassify(createclassify);
    }
    updateCourseclassify(id, updateclassify) {
        return this.LiveTeachingService.updateclassify(id, updateclassify);
    }
    deleteCourseclassify(id) {
        return this.LiveTeachingService.deleteclassify(id);
    }
};
__decorate([
    (0, common_1.Get)(),
    (0, swagger_1.ApiOperation)({ summary: '获取直播列表' }),
    __param(0, (0, common_1.Query)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_b = typeof pagination_dto_1.PaginationDTO !== "undefined" && pagination_dto_1.PaginationDTO) === "function" ? _b : Object, Object]),
    __metadata("design:returntype", void 0)
], LiveTeachingController.prototype, "findLiveList", null);
__decorate([
    (0, common_1.Get)('live-publish/:id'),
    (0, swagger_1.ApiOperation)({ summary: '教员端直播时获取直播详情' }),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Object]),
    __metadata("design:returntype", void 0)
], LiveTeachingController.prototype, "getLiveInfo", null);
__decorate([
    (0, common_1.Get)(':id'),
    (0, no_token_decorator_1.NoAuthToken)(),
    (0, swagger_1.ApiOperation)({ summary: '获取某个直播的详细信息' }),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Object]),
    __metadata("design:returntype", void 0)
], LiveTeachingController.prototype, "findOneInfo", null);
__decorate([
    (0, no_token_decorator_1.NoAuthToken)(),
    (0, common_1.Post)('search'),
    (0, swagger_1.ApiOperation)({ summary: '搜索直播' }),
    __param(0, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_c = typeof get_course_list_dto_1.SearchLsitDto !== "undefined" && get_course_list_dto_1.SearchLsitDto) === "function" ? _c : Object]),
    __metadata("design:returntype", void 0)
], LiveTeachingController.prototype, "searchSomeLive", null);
__decorate([
    (0, common_1.Post)(),
    (0, swagger_1.ApiOperation)({ summary: '新建直播' }),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_d = typeof live_create_dto_1.CreateLiveTeachingDto !== "undefined" && live_create_dto_1.CreateLiveTeachingDto) === "function" ? _d : Object, Object]),
    __metadata("design:returntype", void 0)
], LiveTeachingController.prototype, "createLive", null);
__decorate([
    (0, common_1.Patch)(),
    (0, swagger_1.ApiOperation)({ summary: '更新直播信息' }),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_e = typeof live_update_dto_1.UpdateLiveTeachingDto !== "undefined" && live_update_dto_1.UpdateLiveTeachingDto) === "function" ? _e : Object, Object]),
    __metadata("design:returntype", void 0)
], LiveTeachingController.prototype, "updateLive", null);
__decorate([
    (0, common_1.Delete)(':id'),
    (0, swagger_1.ApiOperation)({ summary: '删除直播' }),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Array, Object]),
    __metadata("design:returntype", void 0)
], LiveTeachingController.prototype, "deleteLive", null);
__decorate([
    (0, common_1.Post)('update'),
    __param(0, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object]),
    __metadata("design:returntype", void 0)
], LiveTeachingController.prototype, "updateLiveInfo", null);
__decorate([
    (0, common_1.Get)('classify'),
    (0, swagger_1.ApiOperation)({ summary: '查询所有分类' }),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", void 0)
], LiveTeachingController.prototype, "getclassifyList", null);
__decorate([
    (0, common_1.Post)('classify'),
    (0, swagger_1.ApiOperation)({ summary: '新增分类' }),
    __param(0, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_f = typeof course_classify_dto_1.CreateCourseclassifyDto !== "undefined" && course_classify_dto_1.CreateCourseclassifyDto) === "function" ? _f : Object]),
    __metadata("design:returntype", void 0)
], LiveTeachingController.prototype, "createclassify", null);
__decorate([
    (0, common_1.Patch)('classify/:id'),
    (0, swagger_1.ApiOperation)({ summary: '编辑分类' }),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, typeof (_g = typeof update_course_classify_dto_1.updateCourseclassifyDto !== "undefined" && update_course_classify_dto_1.updateCourseclassifyDto) === "function" ? _g : Object]),
    __metadata("design:returntype", void 0)
], LiveTeachingController.prototype, "updateCourseclassify", null);
__decorate([
    (0, common_1.Post)('classify/delete'),
    (0, swagger_1.ApiOperation)({ summary: '删除分类' }),
    __param(0, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_h = typeof delete_dto_1.DeleteDto !== "undefined" && delete_dto_1.DeleteDto) === "function" ? _h : Object]),
    __metadata("design:returntype", void 0)
], LiveTeachingController.prototype, "deleteCourseclassify", null);
LiveTeachingController = __decorate([
    (0, swagger_1.ApiTags)('在线教学'),
    (0, swagger_1.ApiBearerAuth)(),
    (0, common_1.Controller)('live-teaching'),
    __metadata("design:paramtypes", [typeof (_a = typeof live_teaching_service_1.LiveTeachingService !== "undefined" && live_teaching_service_1.LiveTeachingService) === "function" ? _a : Object])
], LiveTeachingController);
exports.LiveTeachingController = LiveTeachingController;


/***/ }),
/* 64 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var _a, _b, _c, _d;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CreateLiveTeachingDto = void 0;
const swagger_1 = __webpack_require__(23);
const class_validator_1 = __webpack_require__(25);
const create_dto_1 = __webpack_require__(39);
class CreateLiveTeachingDto extends create_dto_1.CreateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '直播标题' }),
    (0, class_validator_1.IsNotEmpty)({ message: '直播标题不可为空' }),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], CreateLiveTeachingDto.prototype, "title", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '直播开始时间', default: new Date() }),
    (0, class_validator_1.IsNotEmpty)({ message: '直播开始时间不可为空' }),
    __metadata("design:type", typeof (_a = typeof Date !== "undefined" && Date) === "function" ? _a : Object)
], CreateLiveTeachingDto.prototype, "startTime", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '直播真实开始时间', default: new Date() }),
    __metadata("design:type", typeof (_b = typeof Date !== "undefined" && Date) === "function" ? _b : Object)
], CreateLiveTeachingDto.prototype, "actualStartTime", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '直播真实结束时间', default: new Date() }),
    __metadata("design:type", typeof (_c = typeof Date !== "undefined" && Date) === "function" ? _c : Object)
], CreateLiveTeachingDto.prototype, "actualEndTime", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '直播时长' }),
    __metadata("design:type", Number)
], CreateLiveTeachingDto.prototype, "duration", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '直播分类' }),
    (0, class_validator_1.IsNotEmpty)({ message: '直播分类不可为空' }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", Number)
], CreateLiveTeachingDto.prototype, "classify", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '直播分类' }),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], CreateLiveTeachingDto.prototype, "explain", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '直播封面地址' }),
    __metadata("design:type", String)
], CreateLiveTeachingDto.prototype, "cover", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: ' 直播状态 0/1/2 未开始/进行中/已结束' }),
    __metadata("design:type", String)
], CreateLiveTeachingDto.prototype, "status", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '暖场图片' }),
    __metadata("design:type", String)
], CreateLiveTeachingDto.prototype, "warmUpPicture", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '暖场音乐' }),
    __metadata("design:type", String)
], CreateLiveTeachingDto.prototype, "warmUpMusice", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '是否支持回放', default: 0 }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", Number)
], CreateLiveTeachingDto.prototype, "playback", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '回放停止观看时间', default: null }),
    __metadata("design:type", typeof (_d = typeof Date !== "undefined" && Date) === "function" ? _d : Object)
], CreateLiveTeachingDto.prototype, "playbackDeadline", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '讲师' }),
    (0, class_validator_1.IsNotEmpty)({ message: '直播讲师不可为空' }),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], CreateLiveTeachingDto.prototype, "lecturer", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '是否开启讨论', default: 0 }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", Number)
], CreateLiveTeachingDto.prototype, "openDiscussion", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '是否开启评价', default: 0 }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", Number)
], CreateLiveTeachingDto.prototype, "openEval", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '文本评价或维度评价', default: 0 }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", Number)
], CreateLiveTeachingDto.prototype, "txtOrGradeEvealute", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '文本评价标题', default: '' }),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], CreateLiveTeachingDto.prototype, "textEvaluateTitle", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '可以观看直播的学生ID', default: [] }),
    (0, class_validator_1.IsArray)(),
    __metadata("design:type", Array)
], CreateLiveTeachingDto.prototype, "liveStudent", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '直播的课后试题', default: [] }),
    (0, class_validator_1.IsArray)(),
    __metadata("design:type", Array)
], CreateLiveTeachingDto.prototype, "liveQuestion", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '直播的评价维度设置', default: [] }),
    (0, class_validator_1.IsArray)(),
    __metadata("design:type", Array)
], CreateLiveTeachingDto.prototype, "evalDimension", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '直播的课件ID', default: [] }),
    (0, class_validator_1.IsArray)(),
    __metadata("design:type", Array)
], CreateLiveTeachingDto.prototype, "liveCourseware", void 0);
exports.CreateLiveTeachingDto = CreateLiveTeachingDto;


/***/ }),
/* 65 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.UpdateLiveTeachingDto = void 0;
const swagger_1 = __webpack_require__(23);
const live_create_dto_1 = __webpack_require__(64);
class UpdateLiveTeachingDto extends live_create_dto_1.CreateLiveTeachingDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '需要更新的id' }),
    __metadata("design:type", Number)
], UpdateLiveTeachingDto.prototype, "id", void 0);
exports.UpdateLiveTeachingDto = UpdateLiveTeachingDto;


/***/ }),
/* 66 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.PaginationDTO = void 0;
const swagger_1 = __webpack_require__(23);
class PaginationDTO {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: 'page' }),
    __metadata("design:type", Number)
], PaginationDTO.prototype, "page", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: 'pageSize' }),
    __metadata("design:type", Number)
], PaginationDTO.prototype, "pageSize", void 0);
exports.PaginationDTO = PaginationDTO;


/***/ }),
/* 67 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CreateCourseclassifyDto = void 0;
const swagger_1 = __webpack_require__(23);
const class_validator_1 = __webpack_require__(25);
const create_dto_1 = __webpack_require__(39);
class CreateCourseclassifyDto extends create_dto_1.CreateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '分类父级ID', default: 0 }),
    (0, class_validator_1.IsNotEmpty)({ message: '分类父级ID不可为空' }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", Number)
], CreateCourseclassifyDto.prototype, "pid", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '分类名称', default: '新增的分类' }),
    (0, class_validator_1.IsNotEmpty)({ message: '分类名称不可为空' }),
    __metadata("design:type", String)
], CreateCourseclassifyDto.prototype, "name", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '分类层级', default: 1 }),
    (0, class_validator_1.IsNotEmpty)({ message: '分类层级不可为空' }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", Number)
], CreateCourseclassifyDto.prototype, "level", void 0);
exports.CreateCourseclassifyDto = CreateCourseclassifyDto;


/***/ }),
/* 68 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.updateCourseclassifyDto = void 0;
const swagger_1 = __webpack_require__(23);
const class_validator_1 = __webpack_require__(25);
class updateCourseclassifyDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '分类名称' }),
    (0, class_validator_1.IsNotEmpty)({ message: '分类名称不能为空' }),
    __metadata("design:type", String)
], updateCourseclassifyDto.prototype, "name", void 0);
exports.updateCourseclassifyDto = updateCourseclassifyDto;


/***/ }),
/* 69 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.DeleteDto = void 0;
const swagger_1 = __webpack_require__(23);
const class_validator_1 = __webpack_require__(25);
class DeleteDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({
        description: '需要删除的id，可以为数组或单个数字',
        default: [1],
    }),
    (0, class_validator_1.IsNotEmpty)({ message: '删除的id不可为空' }),
    __metadata("design:type", Object)
], DeleteDto.prototype, "id", void 0);
exports.DeleteDto = DeleteDto;


/***/ }),
/* 70 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getCourseClassifyLsitDto = exports.SearchNoClassLsitDto = exports.SearchLsitDto = void 0;
const swagger_1 = __webpack_require__(23);
const class_validator_1 = __webpack_require__(25);
const pagination_dto_1 = __webpack_require__(66);
class SearchLsitDto extends pagination_dto_1.PaginationDTO {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '需要搜索的名称' }),
    __metadata("design:type", String)
], SearchLsitDto.prototype, "value", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '搜索内容的分类' }),
    __metadata("design:type", Number)
], SearchLsitDto.prototype, "classify", void 0);
exports.SearchLsitDto = SearchLsitDto;
class SearchNoClassLsitDto extends pagination_dto_1.PaginationDTO {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '需要搜索的名称' }),
    __metadata("design:type", String)
], SearchNoClassLsitDto.prototype, "value", void 0);
exports.SearchNoClassLsitDto = SearchNoClassLsitDto;
class getCourseClassifyLsitDto extends pagination_dto_1.PaginationDTO {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '分类不可为空' }),
    (0, class_validator_1.IsNotEmpty)({ message: '分类不可为空' }),
    __metadata("design:type", Number)
], getCourseClassifyLsitDto.prototype, "classify", void 0);
exports.getCourseClassifyLsitDto = getCourseClassifyLsitDto;


/***/ }),
/* 71 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b, _c, _d;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.LiveClassController = void 0;
const common_1 = __webpack_require__(2);
const swagger_1 = __webpack_require__(23);
const token_data_decorator_1 = __webpack_require__(37);
const live_class_service_1 = __webpack_require__(72);
const pagination_dto_1 = __webpack_require__(66);
const get_course_list_dto_1 = __webpack_require__(70);
const live_question_answer_dto_1 = __webpack_require__(83);
let LiveClassController = class LiveClassController {
    constructor(LiveClassService) {
        this.LiveClassService = LiveClassService;
    }
    findLiveForMy(pageInfo, tokenInfo) {
        return this.LiveClassService.findMyLiveList(pageInfo, tokenInfo);
    }
    searchMyLiveList(searchInfo, tokenInfo) {
        return this.LiveClassService.searchMyLiveList(searchInfo, tokenInfo);
    }
    getLiveQuestionList(liveId) {
        return this.LiveClassService.getLiveQuestionList(liveId);
    }
    getStudentList(id, tokenInfo) {
        return this.LiveClassService.getStudentList(id, tokenInfo);
    }
    getLiveInfo(id, tokenInfo) {
        return this.LiveClassService.getLiveInfo(id, tokenInfo);
    }
    answeringQuestions(answerData, tokenData) {
        return this.LiveClassService.answeringQuestions(answerData, tokenData);
    }
};
__decorate([
    (0, common_1.Get)(),
    (0, swagger_1.ApiOperation)({ summary: '获取我的直播列表' }),
    __param(0, (0, common_1.Query)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_b = typeof pagination_dto_1.PaginationDTO !== "undefined" && pagination_dto_1.PaginationDTO) === "function" ? _b : Object, Object]),
    __metadata("design:returntype", void 0)
], LiveClassController.prototype, "findLiveForMy", null);
__decorate([
    (0, common_1.Get)('search'),
    (0, swagger_1.ApiOperation)({ summary: '搜索我的直播列表' }),
    __param(0, (0, common_1.Query)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_c = typeof get_course_list_dto_1.SearchNoClassLsitDto !== "undefined" && get_course_list_dto_1.SearchNoClassLsitDto) === "function" ? _c : Object, Object]),
    __metadata("design:returntype", void 0)
], LiveClassController.prototype, "searchMyLiveList", null);
__decorate([
    (0, common_1.Get)('question/:liveId'),
    (0, swagger_1.ApiOperation)({ summary: '获取所有试题列表' }),
    __param(0, (0, common_1.Param)('liveId')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number]),
    __metadata("design:returntype", void 0)
], LiveClassController.prototype, "getLiveQuestionList", null);
__decorate([
    (0, common_1.Get)('liveStudent/:id'),
    (0, swagger_1.ApiOperation)({ summary: '参加直播时获取详情' }),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Object]),
    __metadata("design:returntype", void 0)
], LiveClassController.prototype, "getStudentList", null);
__decorate([
    (0, common_1.Get)(':id'),
    (0, swagger_1.ApiOperation)({ summary: '参加直播时获取详情' }),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Object]),
    __metadata("design:returntype", void 0)
], LiveClassController.prototype, "getLiveInfo", null);
__decorate([
    (0, common_1.Post)('answering'),
    (0, swagger_1.ApiOperation)({ summary: '回答直播的练习题' }),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_d = typeof live_question_answer_dto_1.LiveAnsweringDto !== "undefined" && live_question_answer_dto_1.LiveAnsweringDto) === "function" ? _d : Object, Object]),
    __metadata("design:returntype", void 0)
], LiveClassController.prototype, "answeringQuestions", null);
LiveClassController = __decorate([
    (0, swagger_1.ApiTags)('在线教学-学员端'),
    (0, swagger_1.ApiBearerAuth)(),
    (0, common_1.Controller)('live-class'),
    __metadata("design:paramtypes", [typeof (_a = typeof live_class_service_1.LiveClassService !== "undefined" && live_class_service_1.LiveClassService) === "function" ? _a : Object])
], LiveClassController);
exports.LiveClassController = LiveClassController;


/***/ }),
/* 72 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.LiveClassService = void 0;
const typeorm_1 = __webpack_require__(9);
const mistake_again_controller_1 = __webpack_require__(73);
const question_type_entity_1 = __webpack_require__(79);
const question_entity_1 = __webpack_require__(56);
const resource_entity_1 = __webpack_require__(16);
const user_entity_1 = __webpack_require__(21);
const typeorm_2 = __webpack_require__(18);
const live_classify_entity_1 = __webpack_require__(57);
const live_courseware_entity_1 = __webpack_require__(58);
const live_evaluate_entity_1 = __webpack_require__(59);
const live_question_answer_entity_1 = __webpack_require__(82);
const live_question_entity_1 = __webpack_require__(60);
const live_student_entity_1 = __webpack_require__(61);
const live_teaching_entity_1 = __webpack_require__(62);
let LiveClassService = class LiveClassService {
    constructor(dataSource, Live_Sql, LiveCourseware_Sql, LiveEvaluate_Sql, LiveQuestion_Sql, LiveStudent_Sql, LiveClassify_Sql, LiveQuesstionAnswer_Sql, Questions_sql) {
        this.dataSource = dataSource;
        this.Live_Sql = Live_Sql;
        this.LiveCourseware_Sql = LiveCourseware_Sql;
        this.LiveEvaluate_Sql = LiveEvaluate_Sql;
        this.LiveQuestion_Sql = LiveQuestion_Sql;
        this.LiveStudent_Sql = LiveStudent_Sql;
        this.LiveClassify_Sql = LiveClassify_Sql;
        this.LiveQuesstionAnswer_Sql = LiveQuesstionAnswer_Sql;
        this.Questions_sql = Questions_sql;
    }
    async findMyLiveList(pageInfo, tokenInfo) {
        const page = pageInfo.page - 1;
        const pageSize = pageInfo.pageSize;
        const sql = `
    SELECT
    huai_li.live_teaching.*, 
    huai_li.live_teaching.start_time AS startTime, 
    huai_li.live_teaching.create_time AS createTime, 
    huai_li.\`user\`.id AS userId, 
    huai_li.\`user\`.name AS userName
  FROM
    huai_li.live_student
    INNER JOIN
    huai_li.live_teaching
    ON 
      huai_li.live_student.live_id = huai_li.live_teaching.id
    LEFT JOIN
    huai_li.\`user\`
    ON 
      huai_li.live_teaching.lecturer = huai_li.\`user\`.id
  WHERE
    huai_li.live_student.student_id = ? AND
    huai_li.live_student.del_flag = 0 AND
    huai_li.live_teaching.del_flag = 0
  ORDER BY
    huai_li.live_teaching.update_time DESC
  LIMIT ?,? 
 `;
        let res = await this.LiveStudent_Sql.query(sql, [
            tokenInfo.userId,
            +page,
            +pageSize,
        ]);
        const total = await this.LiveStudent_Sql.query(`SELECT FOUND_ROWS() as total;`);
        res = { data: res, total: +total[0].total };
        return res;
    }
    async searchMyLiveList(searchInfo, tokenInfo) {
        const page = searchInfo.page - 1;
        const pageSize = searchInfo.pageSize;
        const sql = `
    SELECT
    huai_li.live_teaching.*, 
    huai_li.live_teaching.start_time AS startTime, 
    huai_li.live_teaching.create_time AS createTime, 
    huai_li.\`user\`.id AS userId, 
    huai_li.\`user\`.name AS userName
  FROM
  huai_li.live_student
  INNER JOIN
  huai_li.live_teaching
  ON 
    huai_li.live_student.live_id = huai_li.live_teaching.id
  LEFT JOIN
  huai_li.\`user\`
  ON 
    huai_li.live_teaching.lecturer = huai_li.\`user\`.id
  WHERE
    huai_li.live_student.student_id = ? AND
    huai_li.live_teaching.title LIKE ? AND
    huai_li.live_teaching.del_flag = 0 AND
    huai_li.live_student.del_flag = 0
  ORDER BY
    huai_li.live_teaching.update_time DESC
  LIMIT ?, ?
 `;
        let res = await this.LiveStudent_Sql.query(sql, [
            tokenInfo.userId,
            `%${searchInfo.value}%`,
            +page,
            +pageSize,
        ]);
        const total = await this.LiveStudent_Sql.query(`SELECT FOUND_ROWS() as total;`);
        res = { data: res, total: +total[0].total };
        return res;
    }
    async getLiveInfo(id, tokenInfo) {
        const judgeIsviewerSql = `ls.del_flag = 0 AND ls.liveId = l.id AND ls.studentId = '${tokenInfo.userId}'`;
        const res = this.Live_Sql.createQueryBuilder('l')
            .innerJoin(live_student_entity_1.LiveStudent, 'ls', judgeIsviewerSql)
            .leftJoinAndMapMany('l.courseware', live_courseware_entity_1.LiveCourseware, 'lc', 'lc.delFlag = 0 AND lc.liveId = l.id')
            .leftJoinAndMapMany('l.evealuate', live_evaluate_entity_1.LiveEvaluate, 'le', 'le.delFlag = 0 AND le.liveId = l.id')
            .leftJoinAndMapMany('l.question', live_question_entity_1.LiveQuestion, 'lq', 'lq.delFlag = 0 AND lq.liveId = l.id')
            .leftJoinAndMapOne('l.lecturerInfo', user_entity_1.User, 'u', 'u.id = l.lecturer')
            .leftJoinAndMapOne('u.photo', resource_entity_1.Resource, 'photo', 'photo.id = u.photo')
            .where({ id })
            .getOne();
        return res;
    }
    async getStudentList(id, tokenInfo) {
        return await this.dataSource.query(`select u.id id,u.name name,rr.diskname photo,0 status from (select ls.student_id uid from live_student ls where ls.live_id = ?
        union all (select lt.lecturer uid from live_teaching lt where lt.id = ?)) tdd left join user u on u.id = tdd.uid left join resource rr on  rr.id = u.photo`, [id, id]);
    }
    async getLiveQuestionList(liveId) {
        const res = await this.LiveQuestion_Sql.createQueryBuilder('lqs')
            .leftJoinAndMapOne('lqs.info', question_entity_1.Question, 'q', 'q.id = lqs.question_id')
            .leftJoinAndMapOne('q.typeInfo', question_type_entity_1.QuestionType, 'qt', 'qt.id = q.type')
            .leftJoinAndMapOne('lqs.answer', live_question_answer_entity_1.LiveQuestionAnswer, 'lqa', 'lqa.question_id = lqs.question_id AND lqa.del_flag = 0 AND lqa.liveId = ' +
            liveId)
            .where({ liveId })
            .getMany();
        return res;
    }
    async answeringQuestions({ answerInfo, liveId, createTime }, TokenData) {
        const ids = answerInfo.map((_) => _.questionId);
        console.log(ids, '====================>');
        const questions = await this.Questions_sql.query(`
      SELECT
      q.id as id,
      q.type as typeId,
      q.difficulty_level as  difficultyLevelId,
      q.classify_id as  classifyId,
      q.knowledge_id as knowledgeId,
      q.title as title,
      q.answer as answer ,
      q.analysis as analysis,
      q.options  as options,
      qs.score as score
     FROM question q LEFT JOIN live_question qs  ON  q.id = qs.question_id 
		where	 qs.live_id = ? AND  qs.del_flag =0 AND
     q.id IN (?)`, [liveId, ids]);
        console.log(questions);
        const res = { quesInfo: [...questions], score: 0, errorNum: 0 };
        questions.forEach((quesItem) => {
            const answerItem = answerInfo.find((an) => an.questionId === quesItem.id);
            quesItem.questionScore = quesItem.score;
            if (answerItem) {
                const result = (0, mistake_again_controller_1.checkAnswer)(quesItem, answerItem.answer);
                res.score += result.score;
                quesItem.isPass = result.pass;
                if (result.isPass)
                    res.errorNum++;
                quesItem.userAnswer = JSON.stringify(answerItem.answer);
                quesItem.score = result.score;
                quesItem.createTime = createTime;
                quesItem.mistakeScor = 0;
            }
            else {
                quesItem.score = 0;
                quesItem.createTime = new Date();
                quesItem.userAnswer = '';
            }
            quesItem.comment = '';
            quesItem.liveId = liveId;
            quesItem.questionId = quesItem.id;
            quesItem.creator = TokenData.userId;
            quesItem.updater = TokenData.userId;
            delete quesItem.id;
        });
        await this.LiveQuesstionAnswer_Sql.update({ liveId, creator: TokenData.userId }, { delFlag: 1 });
        console.log(questions);
        await this.LiveQuesstionAnswer_Sql.insert(questions);
        return res;
    }
};
LiveClassService = __decorate([
    __param(1, (0, typeorm_1.InjectRepository)(live_teaching_entity_1.LiveTeaching)),
    __param(2, (0, typeorm_1.InjectRepository)(live_courseware_entity_1.LiveCourseware)),
    __param(3, (0, typeorm_1.InjectRepository)(live_evaluate_entity_1.LiveEvaluate)),
    __param(4, (0, typeorm_1.InjectRepository)(live_question_entity_1.LiveQuestion)),
    __param(5, (0, typeorm_1.InjectRepository)(live_student_entity_1.LiveStudent)),
    __param(6, (0, typeorm_1.InjectRepository)(live_classify_entity_1.LiveClassify)),
    __param(7, (0, typeorm_1.InjectRepository)(live_question_answer_entity_1.LiveQuestionAnswer)),
    __param(8, (0, typeorm_1.InjectRepository)(question_entity_1.Question)),
    __metadata("design:paramtypes", [typeof (_a = typeof typeorm_2.DataSource !== "undefined" && typeorm_2.DataSource) === "function" ? _a : Object, typeof (_b = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _b : Object, typeof (_c = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _c : Object, typeof (_d = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _d : Object, typeof (_e = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _e : Object, typeof (_f = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _f : Object, typeof (_g = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _g : Object, typeof (_h = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _h : Object, typeof (_j = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _j : Object])
], LiveClassService);
exports.LiveClassService = LiveClassService;


/***/ }),
/* 73 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b, _c, _d, _e, _f, _g, _h;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.checkAnswer = exports.jaccard = exports.MistakeAgainController = void 0;
const common_1 = __webpack_require__(2);
const swagger_1 = __webpack_require__(23);
const token_data_decorator_1 = __webpack_require__(37);
const paging_exam_paper_dto_1 = __webpack_require__(74);
const questions_for_paper_1 = __webpack_require__(76);
const token_data_entity_1 = __webpack_require__(42);
const exam_questions_result_service_1 = __webpack_require__(80);
let MistakeAgainController = class MistakeAgainController {
    constructor(QuestionsForPaperService, ExamQuestionsResultService) {
        this.QuestionsForPaperService = QuestionsForPaperService;
        this.ExamQuestionsResultService = ExamQuestionsResultService;
    }
    async getQuestionAndExamInfoByClassifyId(classifyId, querys, token) {
        if (!querys.showUserAnswer)
            querys.showUserAnswer = 1;
        return this.ExamQuestionsResultService.getAllMistakeQuestionsByClassifyId(+classifyId, token, +querys.showUserAnswer);
    }
    async pagingMistakeList(PagingExamPaperDto, token) {
        return this.QuestionsForPaperService.pagingMistakeQuestion(PagingExamPaperDto, token);
    }
    async getLastOnlineExamHistoryInfoByQuestionClassifyId(classifyId, token) {
        return this.ExamQuestionsResultService.getLastOnlineExamHistoryInfoByQuestionClassifyId(token, +classifyId);
    }
    async submitMistakes(classifyId, answers, token) {
        console.log(answers, token);
        const questions = await this.ExamQuestionsResultService.getAllMistakeQuestionsByClassifyId(+classifyId, token, 1);
        const res = {
            pass: 0,
            faild: 0,
        };
        questions.forEach((quesItem) => {
            const ansItem = answers.find((ans) => ans.questionId === quesItem.id);
            if (ansItem) {
                const isPass = checkAnswer(quesItem, ansItem.answer);
                console.log(isPass);
                if (isPass.pass) {
                    res.pass++;
                    this.ExamQuestionsResultService.updateMiskateScore(ansItem.resultId);
                }
                else {
                    res.faild++;
                }
            }
            else {
                res.faild++;
            }
        });
        return res;
    }
};
__decorate([
    (0, common_1.Get)('questions/:classifyId'),
    (0, swagger_1.ApiOperation)({ summary: '根据分类查询所有试题' }),
    __param(0, (0, common_1.Param)('classifyId')),
    __param(1, (0, common_1.Query)()),
    __param(2, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Object, typeof (_c = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _c : Object]),
    __metadata("design:returntype", Promise)
], MistakeAgainController.prototype, "getQuestionAndExamInfoByClassifyId", null);
__decorate([
    (0, common_1.Get)('paging'),
    (0, swagger_1.ApiOperation)({ summary: '分页获取类型错题巩固列表' }),
    __param(0, (0, common_1.Query)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_d = typeof paging_exam_paper_dto_1.PagingExamPaperDto !== "undefined" && paging_exam_paper_dto_1.PagingExamPaperDto) === "function" ? _d : Object, typeof (_e = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _e : Object]),
    __metadata("design:returntype", Promise)
], MistakeAgainController.prototype, "pagingMistakeList", null);
__decorate([
    (0, common_1.Get)('lastExamHistory/:classifyId'),
    (0, swagger_1.ApiOperation)({ summary: '根据分类查最后一次考试ID' }),
    __param(0, (0, common_1.Param)('classifyId')),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, typeof (_f = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _f : Object]),
    __metadata("design:returntype", Promise)
], MistakeAgainController.prototype, "getLastOnlineExamHistoryInfoByQuestionClassifyId", null);
__decorate([
    (0, common_1.Patch)('submitMistakes/:classifyId'),
    (0, swagger_1.ApiOperation)({ summary: '将错题得分改为试题分数' }),
    __param(0, (0, common_1.Param)('classifyId')),
    __param(1, (0, common_1.Body)()),
    __param(2, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, typeof (_g = typeof Array !== "undefined" && Array) === "function" ? _g : Object, typeof (_h = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _h : Object]),
    __metadata("design:returntype", Promise)
], MistakeAgainController.prototype, "submitMistakes", null);
MistakeAgainController = __decorate([
    (0, swagger_1.ApiTags)('考核测评 - 错题巩固'),
    (0, swagger_1.ApiBearerAuth)(),
    (0, common_1.Controller)('assessmentEvaluation/mistake'),
    __metadata("design:paramtypes", [typeof (_a = typeof questions_for_paper_1.QuestionsForPaperService !== "undefined" && questions_for_paper_1.QuestionsForPaperService) === "function" ? _a : Object, typeof (_b = typeof exam_questions_result_service_1.ExamQuestionsResultService !== "undefined" && exam_questions_result_service_1.ExamQuestionsResultService) === "function" ? _b : Object])
], MistakeAgainController);
exports.MistakeAgainController = MistakeAgainController;
function jaccard(ans, uans) {
    const ansSet = new Set(ans.split(''));
    const uAnsSet = new Set(uans.split(''));
    const uAnsHasAns = new Set([...ansSet].filter((x) => uAnsSet.has(x)));
    return uAnsHasAns.size / ansSet.size;
}
exports.jaccard = jaccard;
function checkAnswer(question, userAnswer) {
    let answer = userAnswer;
    if (!answer) {
        return { pass: false, score: 0 };
    }
    let oneOptionScore;
    let checkdOptions = null;
    try {
        checkdOptions = JSON.parse(question.answer);
    }
    catch (error) {
        checkdOptions = null;
    }
    if (question.element === 'textarea') {
        answer = userAnswer[0];
    }
    if (question.element === 'input') {
        checkdOptions = JSON.parse(question.options);
    }
    let isTrue;
    if (question.element === 'textarea') {
        isTrue = { pass: false, score: 0 };
        const questionScore = question.score;
        let questionAnswer = '';
        try {
            questionAnswer = JSON.parse(question.answer);
            if (questionAnswer.length > 0) {
                const percent = jaccard(questionAnswer[0], answer);
                isTrue.score = Math.floor(questionScore * percent);
                if (percent === 1) {
                    isTrue.pass = true;
                }
            }
        }
        catch (error) {
            console.log('-?>>>>>>>>>>>>>>>>>>>>>>', error);
        }
    }
    else {
        isTrue = { pass: true, score: question.score };
        for (let ind = 0; ind < checkdOptions.length; ind++) {
            const element = checkdOptions[ind];
            if (answer.indexOf(element) == -1) {
                isTrue = { pass: false, score: 0 };
            }
            if (question.element === 'input') {
                if (element !== answer[ind]) {
                    isTrue = { pass: false, score: 0 };
                }
            }
        }
    }
    console.log(answer, checkdOptions);
    return isTrue;
}
exports.checkAnswer = checkAnswer;


/***/ }),
/* 74 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.PagingExamPaperDto = void 0;
const swagger_1 = __webpack_require__(23);
const pagination_dto_1 = __webpack_require__(75);
class PagingExamPaperDto extends pagination_dto_1.PaginationDTO {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试题分类ID', required: false }),
    __metadata("design:type", Number)
], PagingExamPaperDto.prototype, "classifyId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '是否为模拟考试', required: false }),
    __metadata("design:type", Number)
], PagingExamPaperDto.prototype, "isPractive", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试题名模糊查询', required: false }),
    __metadata("design:type", Number)
], PagingExamPaperDto.prototype, "title", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '是否为已开启试卷', required: false }),
    __metadata("design:type", Number)
], PagingExamPaperDto.prototype, "status", void 0);
exports.PagingExamPaperDto = PagingExamPaperDto;


/***/ }),
/* 75 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.PaginationDTO = void 0;
const swagger_1 = __webpack_require__(23);
const class_validator_1 = __webpack_require__(25);
class PaginationDTO {
}
__decorate([
    (0, class_validator_1.IsOptional)(),
    (0, swagger_1.ApiProperty)({ description: 'currentPage', default: 1 }),
    __metadata("design:type", Number)
], PaginationDTO.prototype, "currentPage", void 0);
__decorate([
    (0, class_validator_1.IsOptional)(),
    (0, swagger_1.ApiProperty)({ description: 'pageSize', default: 10 }),
    __metadata("design:type", Number)
], PaginationDTO.prototype, "pageSize", void 0);
exports.PaginationDTO = PaginationDTO;


/***/ }),
/* 76 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.QuestionsForPaperService = void 0;
const common_1 = __webpack_require__(2);
const typeorm_1 = __webpack_require__(9);
const questions_for_paper_entity_1 = __webpack_require__(77);
const typeorm_2 = __webpack_require__(18);
const question_type_service_1 = __webpack_require__(78);
let QuestionsForPaperService = class QuestionsForPaperService {
    constructor(QuestionsForPaperRepository, QuestionTypeService) {
        this.QuestionsForPaperRepository = QuestionsForPaperRepository;
        this.QuestionTypeService = QuestionTypeService;
    }
    async create(createQuestionsForPaperDto) {
        await this.QuestionsForPaperRepository.insert(createQuestionsForPaperDto);
        return true;
    }
    async findAll() {
        return this.QuestionsForPaperRepository.find({
            where: { delFlag: 0 },
        });
    }
    async pagingMistakeQuestion(pagingInfo, token) {
        const { currentPage, pageSize, title } = pagingInfo;
        const { userId } = token;
        let countSql = `
    select
	q.classify_id  as classifyId,
	qc.name as classify
from
	exam_questions_result eqr
left join question q on
	q.id = eqr.question_id 
	left join question_classify qc on q.classify_id = qc.id
where
	eqr.del_flag <=0 and q.del_flag <= 0
	and eqr.score < eqr.question_score and eqr.mistake_score < eqr.question_score 
    `;
        let sql = `
    select qcc.classify,qcc.classifyId,group_concat(qcc.typeId,':',qcc.count) as times  from
(

	select 	ifnull(count(1),0) as count,
	axx.classify,axx.type,axx.classifyId,axx.typeId
	from (
	
		select
			qc.name as classify,
			qt.name as type,
			q.classify_id as classifyId,
			q.type as typeId
		from
			exam_questions_result eqr
		left join question q on
			q.id = eqr.question_id 
		right join question_type qt on qt.id = q.type
		left join question_classify qc on qc.id = q.classify_id
-- 		使用试题ID查询resultID,去重
		inner join (
			select max(eqr.id) as rid from exam_questions_result eqr 
			left join online_exam_history oeh on oeh.id=eqr.history_id  
			where oeh.is_grade_paper =1
			group by eqr.question_id,eqr.creator
		) hidt on eqr.id = hidt.rid
		left join online_exam_history oeh on oeh.id=eqr.history_id
		left join exam e on oeh.exam_id  = e.id
-- 		获取所有试题对应考试的已考次数
		left join (
				select eqr.question_id qid,group_concat(oeh.id) oehids ,count(oeh.id) count,soe.user_id uid
				from exam_questions_result eqr 
				left join online_exam_history oeh on oeh.id = eqr.history_id 
				left join student_online_exam soe on soe.id = oeh.online_exam_id  
				group by eqr.question_id,oeh.online_exam_id 
			) countTable on countTable.qid = q.id and countTable.uid = eqr.creator
		where
			eqr.del_flag <=0
			and q.del_flag <= 0
			and (e.exam_end_time <now() or e.exam_times<= countTable.count)
			and eqr.score < eqr.question_score and eqr.mistake_score < eqr.question_score 
    `;
        if (userId) {
            sql += `
      and eqr.creator ='${userId}' `;
            countSql += `	and eqr.creator ='${userId}' 
      `;
        }
        sql += `
    group by eqr.question_id) axx group by
	 axx.classifyId ,axx.typeId order by  axx.classifyId ,axx.typeId 
) qcc `;
        if (title) {
            sql += `
  where qcc.classify like '%${title}%' `;
            countSql += `and qc.name like '%${title}%' `;
        }
        sql += `
group by qcc.classifyId order by qcc.classifyId desc limit ?,?
    `;
        countSql += `group by q.classify_id order by q.classify_id limit ?,?`;
        const list = await this.QuestionsForPaperRepository.query(sql, [
            +(currentPage - 1) * pageSize,
            +pageSize,
        ]);
        const count = await this.QuestionsForPaperRepository.query(countSql, [
            +(currentPage - 1) * pageSize,
            +pageSize,
        ]);
        const types = await this.QuestionTypeService.findAll();
        return { total: count.length, currentPage, pageSize, data: list, types };
    }
    async getAllPapersQuestions(id) {
        return this.QuestionsForPaperRepository.find({
            where: { delFlag: 0, examPaperId: id },
        });
    }
    async copyPapersQuestionToPaper(id, nid, uid) {
        const sql = `insert
    into
    questions_for_paper(version,exam_paper_id,creator,updater,question_id,score,type,is_fixed)
  select
    1 as version,
    ${nid} as exam_paper_id,
    ${uid} as creator,
    ${uid} as updater,
    qfp.question_id as question_id,
    qfp.score as score,
    qfp.type as type,
    qfp.is_fixed as is_fixed
  from
    questions_for_paper qfp
  where
    qfp.del_flag = 0
    and qfp.exam_paper_id = ${id}`;
        return await this.QuestionsForPaperRepository.query(sql);
    }
    async remove(id) {
        if (isNaN(+id) || !id)
            throw '缺少id';
        await this.QuestionsForPaperRepository.update(id, { delFlag: 1 });
        return true;
    }
    async getQuestionsByPaperId(id) {
        return await this.QuestionsForPaperRepository.query(`
    select
          qq.id as id,
          qq.type as typeId,
          qq.title as title,
          users.name as creator ,
          qq.creator as creatorId,
          qq.classify_id  as classifyId,
          qc.name  as classify,
          qq.options as options,
          date_format(qq.create_time, '%Y-%m-%d') as createTime,
          qq.answer as answer,
          types.name as type,
          types.element as element,
          qq.difficulty_level as difficultyLevelId,
          levels.name as difficultyLevel,
          qq.knowledge_id as knowledgeId,
          knows.name as knowledgePoint,
          qfp.score score
        from
          question qq
          inner join (select qfp.id as id,qfp.question_id as questionId,qfp.score score  from questions_for_paper qfp  
    where qfp.exam_paper_id =? and qfp.del_flag =0) qfp on qfp.questionId = qq.id
        left join question_type types on
          qq.type = types.id
        left join question_difficulty_level levels on
          qq.difficulty_level = levels.id
        left join knowledge_point knows on
          qq.knowledge_id = knows.id
          left join user users on qq.creator = users.id
          left join question_classify qc on qq.classify_id  = qc.id
       
        order by qq.type`, [+id]);
    }
};
QuestionsForPaperService = __decorate([
    (0, common_1.Injectable)(),
    __param(0, (0, typeorm_1.InjectRepository)(questions_for_paper_entity_1.QuestionsForPaper)),
    __metadata("design:paramtypes", [typeof (_a = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _a : Object, typeof (_b = typeof question_type_service_1.QuestionTypeService !== "undefined" && question_type_service_1.QuestionTypeService) === "function" ? _b : Object])
], QuestionsForPaperService);
exports.QuestionsForPaperService = QuestionsForPaperService;


/***/ }),
/* 77 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.QuestionsForPaper = void 0;
const increment_id_entity_1 = __webpack_require__(17);
const typeorm_1 = __webpack_require__(18);
let QuestionsForPaper = class QuestionsForPaper extends increment_id_entity_1.IncrementIdEntity {
};
__decorate([
    (0, typeorm_1.Column)({ name: 'exam_paper_id', comment: '考试对应试卷ID' }),
    __metadata("design:type", Number)
], QuestionsForPaper.prototype, "examPaperId", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'question_id', comment: '试题ID（对应Question表）' }),
    __metadata("design:type", Number)
], QuestionsForPaper.prototype, "questionId", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '该题分值' }),
    __metadata("design:type", Number)
], QuestionsForPaper.prototype, "score", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '题类型' }),
    __metadata("design:type", Number)
], QuestionsForPaper.prototype, "type", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'is_fixed', comment: '固定选题、随机选题' }),
    __metadata("design:type", Number)
], QuestionsForPaper.prototype, "isFixed", void 0);
QuestionsForPaper = __decorate([
    (0, typeorm_1.Entity)()
], QuestionsForPaper);
exports.QuestionsForPaper = QuestionsForPaper;


/***/ }),
/* 78 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.QuestionTypeService = void 0;
const common_1 = __webpack_require__(2);
const typeorm_1 = __webpack_require__(9);
const typeorm_2 = __webpack_require__(18);
const question_type_entity_1 = __webpack_require__(79);
let QuestionTypeService = class QuestionTypeService {
    constructor(questionTypeRepository) {
        this.questionTypeRepository = questionTypeRepository;
    }
    async create(createQuestionTypeDto) {
        await this.questionTypeRepository.insert(createQuestionTypeDto);
        return true;
    }
    async findAll() {
        return this.questionTypeRepository.find({
            select: ['id', 'name', 'element'],
            where: { delFlag: 0 },
        });
    }
    async update(id, updateQuestionTypeDto) {
        return this.questionTypeRepository.update(id, updateQuestionTypeDto);
    }
    async remove(id) {
        await this.questionTypeRepository.update(id, { delFlag: 1 });
        return true;
    }
};
QuestionTypeService = __decorate([
    (0, common_1.Injectable)(),
    __param(0, (0, typeorm_1.InjectRepository)(question_type_entity_1.QuestionType)),
    __metadata("design:paramtypes", [typeof (_a = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _a : Object])
], QuestionTypeService);
exports.QuestionTypeService = QuestionTypeService;


/***/ }),
/* 79 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.QuestionType = void 0;
const increment_id_entity_1 = __webpack_require__(17);
const typeorm_1 = __webpack_require__(18);
let QuestionType = class QuestionType extends increment_id_entity_1.IncrementIdEntity {
};
__decorate([
    (0, typeorm_1.Column)({ comment: '类型名（单选多选判断填空简答）' }),
    __metadata("design:type", String)
], QuestionType.prototype, "name", void 0);
__decorate([
    (0, typeorm_1.Column)({
        comment: '元素类型（radio、checkbox、radio*2、input、textarea、[video]）',
    }),
    __metadata("design:type", String)
], QuestionType.prototype, "element", void 0);
QuestionType = __decorate([
    (0, typeorm_1.Entity)()
], QuestionType);
exports.QuestionType = QuestionType;


/***/ }),
/* 80 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ExamQuestionsResultService = void 0;
const common_1 = __webpack_require__(2);
const typeorm_1 = __webpack_require__(9);
const exam_questions_result_entity_1 = __webpack_require__(81);
const typeorm_2 = __webpack_require__(18);
let ExamQuestionsResultService = class ExamQuestionsResultService {
    constructor(ExamQuestionsResultRepository) {
        this.ExamQuestionsResultRepository = ExamQuestionsResultRepository;
    }
    async create(CreateExamQuestionsResultDto) {
        await this.ExamQuestionsResultRepository.insert(CreateExamQuestionsResultDto);
        return true;
    }
    async findAll() {
        return this.ExamQuestionsResultRepository.find({
            where: { delFlag: 0 },
        });
    }
    async update(id, UpdateExamQuestionsResultDto) {
        return this.ExamQuestionsResultRepository.update(id, UpdateExamQuestionsResultDto);
    }
    async removeAllByHistoryId(id) {
        const rows = await this.ExamQuestionsResultRepository.query(`delete from exam_questions_result where del_flag=0 and history_id=${+id}`);
        return rows;
    }
    async remove(id) {
        await this.ExamQuestionsResultRepository.update(id, { delFlag: 1 });
        return true;
    }
    async getAllMistakeQuestionsByClassifyId(classifyId, token, showUserAnswer) {
        const { userId } = token;
        let sql = `
    select 
eqr.creator c,
eqr.question_id as id,
eqr.id as resultId,
q.type as typeId,
q.classify_id as classifyId,
qt.name as type,
qt.element as element,
q.title as title,
q.options as options,
q.answer as answer,
q.analysis  as analysis,
eqr.comment as teacherComment,`;
        if (showUserAnswer == 1) {
            sql += 'eqr.user_answer as userAnswer,';
        }
        sql += `
eqr.question_score as score,
eqr.score  as userScore,
q.knowledge_id as knowledgeId,
q.difficulty_level as difficultyLevelId
from exam_questions_result eqr 
-- 按试题去重
inner join (
	select max(eqr.id) as rid from exam_questions_result eqr 
	group by eqr.question_id,eqr.creator 
) hidt on eqr.id = hidt.rid
left join question q on q.id= eqr.question_id
left join question_type qt on q.type=qt.id
left join online_exam_history oeh on oeh.id=eqr.history_id
left join exam e on oeh.exam_id  = e.id
-- 检测所有试题对应的考试考了多少次了
left join (
	select eqr.question_id qid,group_concat(oeh.id) oehids ,count(oeh.id) count,soe.user_id uid
	from exam_questions_result eqr 
	left join online_exam_history oeh on oeh.id = eqr.history_id 
	left join student_online_exam soe on soe.id = oeh.online_exam_id  
	group by eqr.question_id,oeh.online_exam_id 
) countTable on countTable.qid = q.id and countTable.uid = eqr.creator
where 
eqr.del_flag <=0
and q.del_flag <= 0
and eqr.mistake_score <eqr.question_score 
and eqr.score < eqr.question_score 
-- 考试结束判断，考试时间过了或考试次数用尽   考试次数小于允许考试的次数则显示
and (e.exam_end_time <now() or e.exam_times<= countTable.count)
and eqr.creator = ?
and q.classify_id = ?
order by q.type,eqr.question_id,eqr.id `;
        return await this.ExamQuestionsResultRepository.query(sql, [
            userId,
            classifyId,
        ]);
    }
    async updateMiskateScore(id) {
        this.ExamQuestionsResultRepository.query(`update exam_questions_result eqr set eqr.mistake_score = eqr.question_score where eqr.id =?`, [+id]);
    }
    async getLastOnlineExamHistoryInfoByQuestionClassifyId(token, classify) {
        let sql = `select oeh.id,oeh.online_exam_id,oeh.exam_id ,oeh.exam_paper_id  from online_exam_history oeh
    inner join (
      select qfp.id,qfp.exam_paper_id from questions_for_paper qfp inner join (
        select eqr.question_id as qid,
        q.classify_id as classifyId,
        qc.name as classifyName
        from (
          select eqr.question_id  from exam_questions_result eqr 
          where eqr.score<eqr.question_score 
          and eqr.mistake_score <eqr.question_score  
          and eqr.creator='${token.userId}'
          group by eqr.question_id 
          order by eqr.create_time desc
        ) eqr 
        left join question q on q.id = eqr.question_id
        left join question_classify qc on qc.id = q.classify_id
        where q.classify_id  = ${classify} 
        group by q.classify_id 
      
      ) hq on hq.qid=qfp.question_id
    ) qfphistory on qfphistory.exam_paper_id=oeh.exam_paper_id
     where oeh.creator = '${token.userId}' order by oeh.id desc limit 1`;
        sql += '';
        return this.ExamQuestionsResultRepository.query(sql);
    }
};
ExamQuestionsResultService = __decorate([
    (0, common_1.Injectable)(),
    __param(0, (0, typeorm_1.InjectRepository)(exam_questions_result_entity_1.ExamQuestionsResult)),
    __metadata("design:paramtypes", [typeof (_a = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _a : Object])
], ExamQuestionsResultService);
exports.ExamQuestionsResultService = ExamQuestionsResultService;


/***/ }),
/* 81 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ExamQuestionsResult = void 0;
const increment_id_entity_1 = __webpack_require__(17);
const typeorm_1 = __webpack_require__(18);
let ExamQuestionsResult = class ExamQuestionsResult extends increment_id_entity_1.IncrementIdEntity {
};
__decorate([
    (0, typeorm_1.Column)({ name: 'history_id', comment: '考试记录Id' }),
    __metadata("design:type", Number)
], ExamQuestionsResult.prototype, "historyId", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'question_id', comment: '试题ID' }),
    __metadata("design:type", Number)
], ExamQuestionsResult.prototype, "questionId", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'question_score', comment: '该题分值' }),
    __metadata("design:type", Number)
], ExamQuestionsResult.prototype, "questionScore", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '我的得分' }),
    __metadata("design:type", Number)
], ExamQuestionsResult.prototype, "score", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'mistake_score', comment: '错题得分', default: 0 }),
    __metadata("design:type", Number)
], ExamQuestionsResult.prototype, "mistakeScore", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'user_answer', comment: '我的答案' }),
    __metadata("design:type", String)
], ExamQuestionsResult.prototype, "userAnswer", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '老师的评语', default: null, type: global.DB_IS_SQLITE ? 'text' : 'longtext' }),
    __metadata("design:type", String)
], ExamQuestionsResult.prototype, "comment", void 0);
ExamQuestionsResult = __decorate([
    (0, typeorm_1.Entity)()
], ExamQuestionsResult);
exports.ExamQuestionsResult = ExamQuestionsResult;


/***/ }),
/* 82 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.LiveQuestionAnswer = void 0;
const increment_id_entity_1 = __webpack_require__(17);
const typeorm_1 = __webpack_require__(18);
let LiveQuestionAnswer = class LiveQuestionAnswer extends increment_id_entity_1.IncrementIdEntity {
};
__decorate([
    (0, typeorm_1.Column)({ name: 'record_id', comment: '学习记录Id' }),
    __metadata("design:type", Number)
], LiveQuestionAnswer.prototype, "liveId", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'question_id', comment: '试题ID' }),
    __metadata("design:type", Number)
], LiveQuestionAnswer.prototype, "questionId", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'question_score', comment: '该题分值' }),
    __metadata("design:type", Number)
], LiveQuestionAnswer.prototype, "questionScore", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '我的得分' }),
    __metadata("design:type", Number)
], LiveQuestionAnswer.prototype, "score", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'mistake_score', comment: '错题得分', default: 0 }),
    __metadata("design:type", Number)
], LiveQuestionAnswer.prototype, "mistakeScore", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'user_answer', type: global.DB_IS_SQLITE ? 'text' : 'longtext', comment: '我的答案' }),
    __metadata("design:type", String)
], LiveQuestionAnswer.prototype, "userAnswer", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '老师的评语', default: null, type: global.DB_IS_SQLITE ? 'text' : 'longtext' }),
    __metadata("design:type", String)
], LiveQuestionAnswer.prototype, "comment", void 0);
LiveQuestionAnswer = __decorate([
    (0, typeorm_1.Entity)()
], LiveQuestionAnswer);
exports.LiveQuestionAnswer = LiveQuestionAnswer;


/***/ }),
/* 83 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var _a;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.LiveAnsweringDto = exports.LiveQuestionAnswerDto = void 0;
const swagger_1 = __webpack_require__(23);
const class_validator_1 = __webpack_require__(25);
const create_dto_1 = __webpack_require__(39);
class LiveQuestionAnswerDto extends create_dto_1.CreateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '所属的直播ID' }),
    (0, class_validator_1.IsNotEmpty)({ message: '所属的直播ID不能为空' }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", Number)
], LiveQuestionAnswerDto.prototype, "liveId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '练习题ID' }),
    (0, class_validator_1.IsNotEmpty)({ message: '练习题ID不能为空' }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", Number)
], LiveQuestionAnswerDto.prototype, "exerciseId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '答案信息' }),
    (0, class_validator_1.IsNotEmpty)({ message: '答案信息不可为空' }),
    __metadata("design:type", String)
], LiveQuestionAnswerDto.prototype, "answer", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '是否正确' }),
    (0, class_validator_1.IsNotEmpty)({ message: '是否正确不可为空' }),
    __metadata("design:type", Number)
], LiveQuestionAnswerDto.prototype, "isRight", void 0);
exports.LiveQuestionAnswerDto = LiveQuestionAnswerDto;
class LiveAnsweringDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '练习题答案信息提交' }),
    (0, class_validator_1.IsNotEmpty)({ message: '答题不可为空' }),
    __metadata("design:type", Array)
], LiveAnsweringDto.prototype, "answerInfo", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '当前答案所属的直播id' }),
    (0, class_validator_1.IsNotEmpty)({ message: '当前问题所属的直播id不可为空' }),
    __metadata("design:type", Number)
], LiveAnsweringDto.prototype, "liveId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '练习题创建时间' }),
    __metadata("design:type", typeof (_a = typeof Date !== "undefined" && Date) === "function" ? _a : Object)
], LiveAnsweringDto.prototype, "createTime", void 0);
exports.LiveAnsweringDto = LiveAnsweringDto;


/***/ }),
/* 84 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.OnlineTeachingGateway = void 0;
const typeorm_1 = __webpack_require__(9);
const websockets_1 = __webpack_require__(85);
const socket_io_1 = __webpack_require__(86);
const typeorm_2 = __webpack_require__(18);
const live_msg_data_dto_1 = __webpack_require__(87);
const live_msg_data_entity_1 = __webpack_require__(88);
const jwt_1 = __webpack_require__(15);
let OnlineTeachingGateway = class OnlineTeachingGateway {
    constructor(jwtService, lmdRepository) {
        this.jwtService = jwtService;
        this.lmdRepository = lmdRepository;
        this.rooms = {};
    }
    handleDisconnect(socket) {
        var _a, _b;
        const authToken = (_b = (_a = socket.handshake) === null || _a === void 0 ? void 0 : _a.auth) === null || _b === void 0 ? void 0 : _b.token;
        const user = this.jwtService.decode(authToken.replace('Bearer ', ''));
        console.log(user, this.rooms);
        let roomId = null;
        Object.keys(this.rooms).forEach((item) => {
            if (Object.keys(this.rooms[item].users).includes(user.sub)) {
                roomId = item;
            }
        });
        if ((user === null || user === void 0 ? void 0 : user.sub) && roomId) {
            const data = {
                fromId: user.sub,
                roomId: roomId,
                type: 'leave',
                msg: 'leave',
                timestamp: new Date().getTime(),
                msgStr: null,
            };
            return this.lmdRepository.insert(data);
        }
        else {
            return null;
        }
    }
    joinLiveRoom(socket, data) {
        var _a, _b;
        var _c, _d, _e;
        socket.join(data.roomId);
        (_a = (_c = this.rooms)[_d = data.roomId]) !== null && _a !== void 0 ? _a : (_c[_d] = {});
        (_b = (_e = this.rooms[data.roomId]).users) !== null && _b !== void 0 ? _b : (_e.users = {});
        this.rooms[data.roomId].users[data.from.id] = data.from;
        this.sendRoomInfo(socket, data.roomId);
        return this.sendLiveMsg(socket, data);
    }
    sendLiveMsg(socket, data) {
        data.timestamp = new Date().getTime();
        socket.to(data.roomId).emit('received_live_msg', data);
        this.saveMsg(data);
        return data;
    }
    leaveRoom(socket, data) {
        var _a, _b, _c;
        if (Array.isArray(data)) {
            data = data[0];
        }
        socket.leave(data.roomId);
        (_a = this.rooms[data.roomId]) === null || _a === void 0 ? true : delete _a.users[data.from.id];
        this.sendRoomInfo(socket, data.roomId);
        if (!Object.keys((_c = (_b = this.rooms[data.roomId]) === null || _b === void 0 ? void 0 : _b.users) !== null && _c !== void 0 ? _c : {})) {
            delete this.rooms[data.roomId];
        }
        this.saveMsg(data);
        return this.sendLiveMsg(socket, data);
    }
    findRoomInfo(socket, roomId) {
        var _a, _b;
        return {
            users: Object.values((_b = (_a = this.rooms[roomId]) === null || _a === void 0 ? void 0 : _a.users) !== null && _b !== void 0 ? _b : {}),
        };
    }
    async saveMsg(data) {
        var _a;
        const { from, roomId, type, msg, timestamp } = data, other = __rest(data, ["from", "roomId", "type", "msg", "timestamp"]);
        console.log(this.rooms);
        if (!(from === null || from === void 0 ? void 0 : from.id))
            return null;
        return this.lmdRepository.insert({
            fromId: from.id,
            roomId,
            type,
            msg,
            timestamp: timestamp ? timestamp : new Date().getTime(),
            totalUser: ((_a = this.rooms) === null || _a === void 0 ? void 0 : _a[roomId])
                ? Object.keys(this.rooms[roomId].users).length
                : 0,
            msgStr: Object.keys(other).length ? JSON.stringify(other) : null,
        });
    }
    sendRoomInfo(socket, roomId) {
        socket.to(roomId).emit('room_info', this.findRoomInfo(socket, roomId));
    }
};
__decorate([
    (0, websockets_1.SubscribeMessage)('join_live_room'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_c = typeof socket_io_1.Socket !== "undefined" && socket_io_1.Socket) === "function" ? _c : Object, typeof (_d = typeof live_msg_data_dto_1.LiveMsgDataDto !== "undefined" && live_msg_data_dto_1.LiveMsgDataDto) === "function" ? _d : Object]),
    __metadata("design:returntype", void 0)
], OnlineTeachingGateway.prototype, "joinLiveRoom", null);
__decorate([
    (0, websockets_1.SubscribeMessage)('send_live_msg'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_e = typeof socket_io_1.Socket !== "undefined" && socket_io_1.Socket) === "function" ? _e : Object, typeof (_f = typeof live_msg_data_dto_1.LiveMsgDataDto !== "undefined" && live_msg_data_dto_1.LiveMsgDataDto) === "function" ? _f : Object]),
    __metadata("design:returntype", void 0)
], OnlineTeachingGateway.prototype, "sendLiveMsg", null);
__decorate([
    (0, websockets_1.SubscribeMessage)('leave_live_room'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_g = typeof socket_io_1.Socket !== "undefined" && socket_io_1.Socket) === "function" ? _g : Object, typeof (_h = typeof live_msg_data_dto_1.LiveMsgDataDto !== "undefined" && live_msg_data_dto_1.LiveMsgDataDto) === "function" ? _h : Object]),
    __metadata("design:returntype", void 0)
], OnlineTeachingGateway.prototype, "leaveRoom", null);
__decorate([
    (0, websockets_1.SubscribeMessage)('find_room_info'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_j = typeof socket_io_1.Socket !== "undefined" && socket_io_1.Socket) === "function" ? _j : Object, String]),
    __metadata("design:returntype", void 0)
], OnlineTeachingGateway.prototype, "findRoomInfo", null);
OnlineTeachingGateway = __decorate([
    (0, websockets_1.WebSocketGateway)(),
    __param(1, (0, typeorm_1.InjectRepository)(live_msg_data_entity_1.LiveMsgData)),
    __metadata("design:paramtypes", [typeof (_a = typeof jwt_1.JwtService !== "undefined" && jwt_1.JwtService) === "function" ? _a : Object, typeof (_b = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _b : Object])
], OnlineTeachingGateway);
exports.OnlineTeachingGateway = OnlineTeachingGateway;


/***/ }),
/* 85 */
/***/ ((module) => {

"use strict";
module.exports = require("@nestjs/websockets");

/***/ }),
/* 86 */
/***/ ((module) => {

"use strict";
module.exports = require("socket.io");

/***/ }),
/* 87 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var _a;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.LiveMsgDataDto = void 0;
const swagger_1 = __webpack_require__(23);
const user_entity_1 = __webpack_require__(21);
class LiveMsgDataDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '消息发送人' }),
    __metadata("design:type", typeof (_a = typeof user_entity_1.User !== "undefined" && user_entity_1.User) === "function" ? _a : Object)
], LiveMsgDataDto.prototype, "from", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '房间ID' }),
    __metadata("design:type", String)
], LiveMsgDataDto.prototype, "roomId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '消息类型' }),
    __metadata("design:type", String)
], LiveMsgDataDto.prototype, "type", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '消息' }),
    __metadata("design:type", String)
], LiveMsgDataDto.prototype, "msg", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '发送时间' }),
    __metadata("design:type", Number)
], LiveMsgDataDto.prototype, "timestamp", void 0);
exports.LiveMsgDataDto = LiveMsgDataDto;


/***/ }),
/* 88 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.LiveMsgData = void 0;
const typeorm_1 = __webpack_require__(18);
let LiveMsgData = class LiveMsgData {
};
__decorate([
    (0, typeorm_1.PrimaryGeneratedColumn)('increment'),
    __metadata("design:type", Number)
], LiveMsgData.prototype, "id", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'from_id', type: 'text', comment: '发送人ID' }),
    __metadata("design:type", String)
], LiveMsgData.prototype, "fromId", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'room_id', type: 'text', comment: '房间ID' }),
    __metadata("design:type", String)
], LiveMsgData.prototype, "roomId", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'text', comment: '消息类型' }),
    __metadata("design:type", String)
], LiveMsgData.prototype, "type", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'text', nullable: true, comment: '消息' }),
    __metadata("design:type", String)
], LiveMsgData.prototype, "msg", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'bigint', comment: '发送时间' }),
    __metadata("design:type", Number)
], LiveMsgData.prototype, "timestamp", void 0);
__decorate([
    (0, typeorm_1.Column)({
        name: 'total_user',
        comment: '当前房间总人数',
        default: 0,
    }),
    __metadata("design:type", Number)
], LiveMsgData.prototype, "totalUser", void 0);
__decorate([
    (0, typeorm_1.Column)({
        type: 'text',
        nullable: true,
        name: 'mag_srt',
        comment: 'string 消息',
    }),
    __metadata("design:type", String)
], LiveMsgData.prototype, "msgStr", void 0);
__decorate([
    (0, typeorm_1.Column)({
        default: 0,
        select: false,
        name: 'del_flag',
        comment: '是否删除：0否/1是',
    }),
    __metadata("design:type", Number)
], LiveMsgData.prototype, "delFlag", void 0);
LiveMsgData = __decorate([
    (0, typeorm_1.Entity)()
], LiveMsgData);
exports.LiveMsgData = LiveMsgData;


/***/ }),
/* 89 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.OnlineCourseModule = void 0;
const common_1 = __webpack_require__(2);
const online_course_service_1 = __webpack_require__(90);
const course_manage_controller_1 = __webpack_require__(98);
const typeorm_1 = __webpack_require__(9);
const course_list_entity_1 = __webpack_require__(92);
const course_classify_entity_1 = __webpack_require__(91);
const course_courseware_entity_1 = __webpack_require__(93);
const course_section_content_entity_1 = __webpack_require__(94);
const course_evaluate_entity_1 = __webpack_require__(95);
const course_my_controller_1 = __webpack_require__(101);
const my_course_service_1 = __webpack_require__(106);
const course_study_courseware_entity_1 = __webpack_require__(110);
const course_study_discussion_entity_1 = __webpack_require__(107);
const course_study_evaluate_entity_1 = __webpack_require__(108);
const course_study_exercise_entity_1 = __webpack_require__(109);
const course_study_record_entity_1 = __webpack_require__(96);
const user_entity_1 = __webpack_require__(21);
const course_notes_entity_1 = __webpack_require__(113);
const course_notes_controller_1 = __webpack_require__(114);
const course_notes_service_1 = __webpack_require__(115);
const online_issues_entity_1 = __webpack_require__(117);
const online_answer_entity_1 = __webpack_require__(118);
const online_answer_controller_1 = __webpack_require__(119);
const online_issues_service_1 = __webpack_require__(120);
const teacher_student_entity_1 = __webpack_require__(31);
const course_questions_entity_1 = __webpack_require__(97);
const question_entity_1 = __webpack_require__(56);
const course_study_discussion_kudos_entity_1 = __webpack_require__(111);
let OnlineCourseModule = class OnlineCourseModule {
};
OnlineCourseModule = __decorate([
    (0, common_1.Module)({
        imports: [
            typeorm_1.TypeOrmModule.forFeature([
                course_list_entity_1.CourseList,
                course_classify_entity_1.CourseClassify,
                course_courseware_entity_1.CourseSectionCourseware,
                course_section_content_entity_1.courseSectionContent,
                course_evaluate_entity_1.courseEvaluate,
                course_study_courseware_entity_1.CourseStudyCourseware,
                course_study_discussion_entity_1.CourseStudyDiscussion,
                course_study_evaluate_entity_1.CourseStudyEvaluate,
                course_study_exercise_entity_1.CourseStudyExercise,
                course_study_record_entity_1.CourseStudyRecord,
                teacher_student_entity_1.TeacherStudent,
                user_entity_1.User,
                course_notes_entity_1.CourseNotes,
                online_issues_entity_1.OnlineIssues,
                online_answer_entity_1.OnlineIssuesAnswer,
                course_questions_entity_1.QuestionsForCourse,
                question_entity_1.Question,
                course_study_discussion_kudos_entity_1.CourseStudyDisKudos,
            ]),
        ],
        controllers: [
            course_manage_controller_1.OnlineCourseController,
            course_my_controller_1.CourseMyController,
            course_notes_controller_1.CourseNotesController,
            online_answer_controller_1.OnlineAnswerController,
        ],
        providers: [
            online_course_service_1.OnlineCourseService,
            my_course_service_1.myCourseService,
            course_notes_service_1.CourseNotesService,
            online_issues_service_1.OnlineIssuesService,
        ],
    })
], OnlineCourseModule);
exports.OnlineCourseModule = OnlineCourseModule;


/***/ }),
/* 90 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b, _c, _d, _e, _f, _g, _h;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.OnlineCourseService = void 0;
const common_1 = __webpack_require__(2);
const typeorm_1 = __webpack_require__(9);
const typeorm_2 = __webpack_require__(18);
const course_classify_entity_1 = __webpack_require__(91);
const course_list_entity_1 = __webpack_require__(92);
const course_courseware_entity_1 = __webpack_require__(93);
const course_section_content_entity_1 = __webpack_require__(94);
const course_evaluate_entity_1 = __webpack_require__(95);
const user_entity_1 = __webpack_require__(21);
const course_study_record_entity_1 = __webpack_require__(96);
const question_entity_1 = __webpack_require__(56);
const course_questions_entity_1 = __webpack_require__(97);
const resource_entity_1 = __webpack_require__(16);
let OnlineCourseService = class OnlineCourseService {
    constructor(CourseList_SQL, Course_classify_SQL, course_courseware_SQL, course_section_content_SQL, course_evaluate_SQL, User_SQL, record_SQL, QuestionsForCourse_SQL) {
        this.CourseList_SQL = CourseList_SQL;
        this.Course_classify_SQL = Course_classify_SQL;
        this.course_courseware_SQL = course_courseware_SQL;
        this.course_section_content_SQL = course_section_content_SQL;
        this.course_evaluate_SQL = course_evaluate_SQL;
        this.User_SQL = User_SQL;
        this.record_SQL = record_SQL;
        this.QuestionsForCourse_SQL = QuestionsForCourse_SQL;
    }
    async getCourseEvaluate(courseId, paging) {
        const sql = `select
    concat('[', group_concat('{"k":"', ce.dimensionality, '","v":', cse.value, '}'), ']' ) value,
    csr.self_evael eval,
    csr.student_id sid,
    u.name uname
  from
    course_study_evaluate cse
  left join course_evaluate ce on
    ce.id = cse.dimension_id
  left join course_study_record csr on
    csr.id = cse.record_id
  left join user u on
    u.id = csr.student_id
  where
    ce.course_id = ${courseId}
  group by
    csr.student_id
    `;
        const datas = await this.record_SQL.query(sql + `limit ${(paging.page - 1) * paging.pageSize},${paging.pageSize}`);
        const [{ count }] = await this.record_SQL.query(`select count(1) count from (${sql}) c`);
        return {
            data: datas,
            total: count,
            page: paging.page,
            pageSize: paging.pageSize,
        };
    }
    async create(courseInfo) {
        const saveInfo = courseInfo;
        const res = await this.CourseList_SQL.save(saveInfo);
        const evaluate = courseInfo.evalDimension;
        if (evaluate && evaluate.length > 0) {
            evaluate.forEach((item) => {
                item.courseId = res.id;
            });
            this.course_evaluate_SQL.insert(evaluate);
        }
        let courseHours = 0;
        const section = courseInfo.courseSectionContent;
        if (section && section.length > 0) {
            section.forEach((item) => {
                item.courseId = res.id;
            });
            const sectionRes = await this.course_section_content_SQL.save(section);
            const coursewareList = [];
            sectionRes.forEach((item) => {
                item.courseware.forEach((courseware) => {
                    courseware.courseId = res.id;
                    courseware.sectionId = item.id;
                    courseHours += courseware.studyTime;
                    coursewareList.push(courseware);
                });
            });
            this.course_courseware_SQL.insert(coursewareList);
        }
        saveInfo.courseHours = courseHours;
        this.CourseList_SQL.save(saveInfo);
        courseInfo.exercise.forEach((exer) => {
            exer.courseId = res.id;
        });
        await this.QuestionsForCourse_SQL.save(courseInfo.exercise);
        return res;
    }
    async createUserRecord(courseInfo, createType) {
    }
    async editorUserRecord(courseInfo, oldCourse) {
        const res = await this.User_SQL.findBy({ orgId: oldCourse[0].studyOrgId });
        const ids = courseInfo;
        const idList = res.map((user) => user.id);
        await this.record_SQL.query(`update course_study_record csr set del_flag=1 where csr.student_id in (${"'" + idList.join("','") + "'"}) and course_id=${oldCourse[0].id} and csr.del_flag=0`);
    }
    async update(id, courseInfo) {
        this.QuestionsForCourse_SQL.update({ id }, { delFlag: 1 });
        const saveInfo = courseInfo;
        const courseSectionContent = courseInfo.courseSectionContent;
        const courseEvaluate = courseInfo.evalDimension;
        const exercise = courseInfo.exercise;
        delete courseInfo.courseSectionContent;
        delete courseInfo.evalDimension;
        delete courseInfo.exercise;
        if (courseEvaluate && courseEvaluate.length > 0) {
            this.course_evaluate_SQL.save(courseEvaluate);
        }
        const coursewareLsit = [];
        let courseHours = 0;
        if (courseSectionContent && courseSectionContent.length > 0) {
            const cc = await this.course_section_content_SQL.save(courseSectionContent);
            cc.forEach((section) => {
                if (section.courseware && section.courseware.length > 0) {
                    section.courseware.forEach((courseware) => {
                        courseware.sectionId = section.id;
                        courseware.courseId = id;
                        courseHours += courseware.studyTime;
                        coursewareLsit.push(courseware);
                    });
                }
            });
            this.course_courseware_SQL.save(coursewareLsit);
        }
        saveInfo.courseHours = courseHours;
        const res = await this.CourseList_SQL.update(id, saveInfo);
        await this.QuestionsForCourse_SQL.update({ courseId: id }, { delFlag: 1 });
        this.QuestionsForCourse_SQL.insert(exercise);
        return res;
    }
    async updateStatus(id, data) {
        const res = await this.CourseList_SQL.update(id, data);
        return res;
    }
    async findAll(getInfo, tokenData) {
        const { page, pageSize } = getInfo;
        const res = await this.CourseList_SQL.createQueryBuilder('course')
            .leftJoinAndMapOne('course.creator_info', user_entity_1.User, 'user', 'course.creator = user.id')
            .andWhere({ delFlag: 0, creator: tokenData.userId })
            .andWhere(getInfo.classify == 0 ? {} : { classify: getInfo.classify })
            .skip((page - 1) * pageSize)
            .take(pageSize)
            .getManyAndCount();
        return {
            data: res[0],
            total: res[1],
        };
    }
    async searchCourseList(searchInfo, tokenData) {
        const page = searchInfo.page;
        const pageSize = searchInfo.pageSize;
        let res = await this.CourseList_SQL.createQueryBuilder('course')
            .leftJoinAndMapOne('course.creator_info', user_entity_1.User, 'user', 'course.creator = user.id')
            .andWhere({ name: (0, typeorm_2.Like)(`%${searchInfo.value}%`) })
            .andWhere({ delFlag: 0, creator: tokenData.userId })
            .andWhere(searchInfo.classify == 0 ? {} : { classify: searchInfo.classify })
            .skip((page - 1) * pageSize)
            .take(pageSize)
            .getManyAndCount();
        res = {
            total: res[1],
            data: res[0],
        };
        return res;
    }
    async findOne(id) {
        console.log(id);
        const res = await this.CourseList_SQL.createQueryBuilder('cl')
            .leftJoinAndMapMany('cl.evalDimension', course_evaluate_entity_1.courseEvaluate, 'ce', 'ce.course_id = cl.id and ce.del_flag = 0')
            .leftJoinAndMapMany('cl.courseSectionContent', course_section_content_entity_1.courseSectionContent, 'cs', 'cs.course_id = cl.id and cs.del_flag = 0')
            .leftJoinAndMapMany('cs.courseware', course_courseware_entity_1.CourseSectionCourseware, 'ccs', 'ccs.course_id = cl.id and ccs.section_id = cs.id and ccs.del_flag = 0')
            .leftJoinAndMapOne('ccs.info', resource_entity_1.Resource, 'res', 'ccs.fileId = res.id')
            .leftJoinAndMapMany('cl.exercise', course_questions_entity_1.QuestionsForCourse, 'qfc', `qfc.course_id =${id} and qfc.del_flag = 0`)
            .leftJoinAndMapOne('qfc.info', question_entity_1.Question, 'q', 'qfc.question_id = q.id')
            .where({
            id,
            delFlag: 0,
        })
            .getOne();
        return res;
    }
    async batchDeleteCourse(data) {
        const res = await this.CourseList_SQL.update(data.id, { delFlag: 1 });
        if (typeof data.id == 'number') {
            this.record_SQL.update({ courseId: data.id }, { delFlag: 0 });
        }
        else {
            this.record_SQL.query(`update course_study_record csr set del_flag=1 where csr.course_id in (${"'" + data.id.join("','") + "'"})`);
        }
        return res;
    }
    async remove(id) {
        const res = await this.CourseList_SQL.update(id, { delFlag: 1 });
        this.course_section_content_SQL.update({ courseId: id }, { delFlag: 1 });
        this.course_evaluate_SQL.update({ courseId: id }, { delFlag: 1 });
        this.course_courseware_SQL.update({ courseId: id }, { delFlag: 1 });
        this.record_SQL.update({ courseId: id }, { delFlag: 1 });
        return res;
    }
    async getclassifyList() {
        const res = await this.Course_classify_SQL.findBy({ delFlag: 0 });
        return res;
    }
    async createclassify(classify) {
        const res = await this.Course_classify_SQL.save(classify);
        return res;
    }
    async updateclassify(id, classify) {
        const res = await this.Course_classify_SQL.update(id, classify);
        return res;
    }
    async deleteclassify({ id }) {
        const res = await this.Course_classify_SQL.update(id, { delFlag: 1 });
        return res;
    }
};
OnlineCourseService = __decorate([
    (0, common_1.Injectable)(),
    __param(0, (0, typeorm_1.InjectRepository)(course_list_entity_1.CourseList)),
    __param(1, (0, typeorm_1.InjectRepository)(course_classify_entity_1.CourseClassify)),
    __param(2, (0, typeorm_1.InjectRepository)(course_courseware_entity_1.CourseSectionCourseware)),
    __param(3, (0, typeorm_1.InjectRepository)(course_section_content_entity_1.courseSectionContent)),
    __param(4, (0, typeorm_1.InjectRepository)(course_evaluate_entity_1.courseEvaluate)),
    __param(5, (0, typeorm_1.InjectRepository)(user_entity_1.User)),
    __param(6, (0, typeorm_1.InjectRepository)(course_study_record_entity_1.CourseStudyRecord)),
    __param(7, (0, typeorm_1.InjectRepository)(course_questions_entity_1.QuestionsForCourse)),
    __metadata("design:paramtypes", [typeof (_a = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _a : Object, typeof (_b = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _b : Object, typeof (_c = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _c : Object, typeof (_d = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _d : Object, typeof (_e = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _e : Object, typeof (_f = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _f : Object, typeof (_g = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _g : Object, typeof (_h = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _h : Object])
], OnlineCourseService);
exports.OnlineCourseService = OnlineCourseService;


/***/ }),
/* 91 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CourseClassify = void 0;
const typeorm_1 = __webpack_require__(18);
let CourseClassify = class CourseClassify {
};
__decorate([
    (0, typeorm_1.PrimaryGeneratedColumn)('increment'),
    __metadata("design:type", Number)
], CourseClassify.prototype, "id", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '父级ID' }),
    __metadata("design:type", Number)
], CourseClassify.prototype, "pid", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: global.DB_IS_SQLITE ? 'text' : 'longtext', comment: '分类名称' }),
    __metadata("design:type", String)
], CourseClassify.prototype, "name", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '层级' }),
    __metadata("design:type", Number)
], CourseClassify.prototype, "level", void 0);
__decorate([
    (0, typeorm_1.Column)({
        default: 0,
        select: false,
        name: 'del_flag',
        comment: '是否删除：0否/1是',
    }),
    __metadata("design:type", Number)
], CourseClassify.prototype, "delFlag", void 0);
CourseClassify = __decorate([
    (0, typeorm_1.Entity)()
], CourseClassify);
exports.CourseClassify = CourseClassify;


/***/ }),
/* 92 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CourseList = void 0;
const increment_id_entity_1 = __webpack_require__(17);
const typeorm_1 = __webpack_require__(18);
let CourseList = class CourseList extends increment_id_entity_1.IncrementIdEntity {
};
__decorate([
    (0, typeorm_1.Column)({ type: global.DB_IS_SQLITE ? 'text' : 'longtext', comment: '课程名称' }),
    __metadata("design:type", String)
], CourseList.prototype, "name", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '所属分类ID' }),
    __metadata("design:type", Number)
], CourseList.prototype, "classify", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'section_count', comment: '章节数' }),
    __metadata("design:type", Number)
], CourseList.prototype, "sectionCount", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '难度' }),
    __metadata("design:type", Number)
], CourseList.prototype, "difficulty", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '课程状态0|1' }),
    __metadata("design:type", Number)
], CourseList.prototype, "status", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '课程分数' }),
    __metadata("design:type", Number)
], CourseList.prototype, "grade", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: global.DB_IS_SQLITE ? 'text' : 'longtext', comment: '课程封面' }),
    __metadata("design:type", String)
], CourseList.prototype, "cover", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: global.DB_IS_SQLITE ? 'text' : 'longtext', comment: '课程简介' }),
    __metadata("design:type", String)
], CourseList.prototype, "explain", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'study_org_id', comment: '学习该课程的组织' }),
    __metadata("design:type", Number)
], CourseList.prototype, "studyOrgId", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'section_sort_study', comment: '0/1章节顺序学习？' }),
    __metadata("design:type", Number)
], CourseList.prototype, "sectionSortStudy", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'courseware_sort_study', comment: '课件顺序学习？' }),
    __metadata("design:type", Number)
], CourseList.prototype, "coursewareSortStudy", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'open_quiz', comment: '0/1开启课程问答' }),
    __metadata("design:type", Number)
], CourseList.prototype, "openQuiz", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'open_discussion', comment: '0/1开启讨论' }),
    __metadata("design:type", Number)
], CourseList.prototype, "openDiscussion", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'open_self_evaluation', comment: '0/1开启学员自评' }),
    __metadata("design:type", Number)
], CourseList.prototype, "openSelfEvaluation", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'open_eval', comment: '0/1开启课程评价', default: 0 }),
    __metadata("design:type", Number)
], CourseList.prototype, "openEval", void 0);
__decorate([
    (0, typeorm_1.Column)({
        name: 'text_or_grade_evalute',
        comment: '0/1开启课程文本或维度评价',
        default: 0,
    }),
    __metadata("design:type", Number)
], CourseList.prototype, "txtOrGradeEvealute", void 0);
__decorate([
    (0, typeorm_1.Column)({
        name: 'text_or_grade_self-eval',
        comment: '0/1开启课程文本或维度评价',
    }),
    __metadata("design:type", Number)
], CourseList.prototype, "textOrGradeSelfEval", void 0);
__decorate([
    (0, typeorm_1.Column)({
        type: global.DB_IS_SQLITE ? 'text' : 'longtext',
        name: 'text_evaluate_title',
        comment: '文本评价的标题',
    }),
    __metadata("design:type", String)
], CourseList.prototype, "textEvaluateTitle", void 0);
__decorate([
    (0, typeorm_1.Column)({
        type: global.DB_IS_SQLITE ? 'text' : 'longtext',
        name: 'self_text_evaluate_title',
        comment: '文本评价的标题',
    }),
    __metadata("design:type", String)
], CourseList.prototype, "selfTextEvaluateTitle", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'view_number', comment: '已观看人数', default: 0 }),
    __metadata("design:type", Number)
], CourseList.prototype, "viewNumber", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'course_hours', comment: '课程学时', default: 0 }),
    __metadata("design:type", Number)
], CourseList.prototype, "courseHours", void 0);
CourseList = __decorate([
    (0, typeorm_1.Entity)()
], CourseList);
exports.CourseList = CourseList;


/***/ }),
/* 93 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CourseSectionCourseware = void 0;
const typeorm_1 = __webpack_require__(18);
let CourseSectionCourseware = class CourseSectionCourseware {
};
__decorate([
    (0, typeorm_1.PrimaryGeneratedColumn)('increment'),
    __metadata("design:type", Number)
], CourseSectionCourseware.prototype, "id", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'course_id', comment: '所属课程ID' }),
    __metadata("design:type", Number)
], CourseSectionCourseware.prototype, "courseId", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'section_id', comment: '所属章节ID' }),
    __metadata("design:type", Number)
], CourseSectionCourseware.prototype, "sectionId", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '课件的存储信息' }),
    __metadata("design:type", Number)
], CourseSectionCourseware.prototype, "fileId", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: global.DB_IS_SQLITE ? 'text' : 'longtext', comment: '课件名称' }),
    __metadata("design:type", String)
], CourseSectionCourseware.prototype, "name", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'study_time', comment: '学习时长10为10分钟' }),
    __metadata("design:type", Number)
], CourseSectionCourseware.prototype, "studyTime", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '学习占比number%' }),
    __metadata("design:type", Number)
], CourseSectionCourseware.prototype, "percentage", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'can_speed', comment: '0/1' }),
    __metadata("design:type", Number)
], CourseSectionCourseware.prototype, "canSpeed", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'serial_number', comment: '章节在当前课程中的序号' }),
    __metadata("design:type", Number)
], CourseSectionCourseware.prototype, "serialNumber", void 0);
__decorate([
    (0, typeorm_1.Column)({
        default: 0,
        name: 'del_flag',
        comment: '是否删除：0否/1是',
    }),
    __metadata("design:type", Number)
], CourseSectionCourseware.prototype, "delFlag", void 0);
CourseSectionCourseware = __decorate([
    (0, typeorm_1.Entity)()
], CourseSectionCourseware);
exports.CourseSectionCourseware = CourseSectionCourseware;


/***/ }),
/* 94 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.courseSectionContent = void 0;
const typeorm_1 = __webpack_require__(18);
let courseSectionContent = class courseSectionContent {
};
__decorate([
    (0, typeorm_1.PrimaryGeneratedColumn)('increment'),
    __metadata("design:type", Number)
], courseSectionContent.prototype, "id", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'course_id', comment: '课程ID' }),
    __metadata("design:type", Number)
], courseSectionContent.prototype, "courseId", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: global.DB_IS_SQLITE ? 'text' : 'longtext', comment: '章节名称' }),
    __metadata("design:type", String)
], courseSectionContent.prototype, "name", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '章节简介说明', type: global.DB_IS_SQLITE ? 'text' : 'longtext' }),
    __metadata("design:type", String)
], courseSectionContent.prototype, "explain", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'serial_number', comment: '章节在当前课程中的序号' }),
    __metadata("design:type", Number)
], courseSectionContent.prototype, "serialNumber", void 0);
__decorate([
    (0, typeorm_1.Column)({
        default: 0,
        select: false,
        name: 'del_flag',
        comment: '是否删除：0否/1是',
    }),
    __metadata("design:type", Number)
], courseSectionContent.prototype, "delFlag", void 0);
courseSectionContent = __decorate([
    (0, typeorm_1.Entity)()
], courseSectionContent);
exports.courseSectionContent = courseSectionContent;


/***/ }),
/* 95 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.courseEvaluate = void 0;
const typeorm_1 = __webpack_require__(18);
let courseEvaluate = class courseEvaluate {
};
__decorate([
    (0, typeorm_1.PrimaryGeneratedColumn)('increment'),
    __metadata("design:type", Number)
], courseEvaluate.prototype, "id", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'course_id', comment: '课程ID' }),
    __metadata("design:type", Number)
], courseEvaluate.prototype, "courseId", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: global.DB_IS_SQLITE ? 'text' : 'longtext', comment: '维度名称' }),
    __metadata("design:type", String)
], courseEvaluate.prototype, "dimensionality", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '0/1 课程评价或学院自评' }),
    __metadata("design:type", Number)
], courseEvaluate.prototype, "type", void 0);
__decorate([
    (0, typeorm_1.Column)({
        default: 0,
        select: false,
        name: 'del_flag',
        comment: '是否删除：0否/1是',
    }),
    __metadata("design:type", Number)
], courseEvaluate.prototype, "delFlag", void 0);
courseEvaluate = __decorate([
    (0, typeorm_1.Entity)()
], courseEvaluate);
exports.courseEvaluate = courseEvaluate;


/***/ }),
/* 96 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CourseStudyRecord = void 0;
const increment_id_entity_1 = __webpack_require__(17);
const typeorm_1 = __webpack_require__(18);
let CourseStudyRecord = class CourseStudyRecord extends increment_id_entity_1.IncrementIdEntity {
};
__decorate([
    (0, typeorm_1.Column)({ type: global.DB_IS_SQLITE ? 'text' : 'longtext', name: 'student_id', comment: '学员id' }),
    __metadata("design:type", String)
], CourseStudyRecord.prototype, "studentId", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'course_id', comment: '相对应课程的id' }),
    __metadata("design:type", Number)
], CourseStudyRecord.prototype, "courseId", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'study_time', comment: '学习时长' }),
    __metadata("design:type", Number)
], CourseStudyRecord.prototype, "studyTime", void 0);
__decorate([
    (0, typeorm_1.Column)({
        name: 'study_progress',
        comment: '0为未开始，1为进行中，2为已完成',
    }),
    __metadata("design:type", Number)
], CourseStudyRecord.prototype, "studyProgress", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'exercise_grade', comment: '练习题分数' }),
    __metadata("design:type", Number)
], CourseStudyRecord.prototype, "exerciseGrade", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: global.DB_IS_SQLITE ? 'text' : 'longtext', name: 'self_evael', comment: '自我评价信息' }),
    __metadata("design:type", String)
], CourseStudyRecord.prototype, "selfEvael", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: global.DB_IS_SQLITE ? 'text' : 'longtext', name: 'course_eveal', comment: '课程评价信息' }),
    __metadata("design:type", String)
], CourseStudyRecord.prototype, "courseEveal", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '课程得分' }),
    __metadata("design:type", Number)
], CourseStudyRecord.prototype, "score", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '是否第一次学习', default: 1 }),
    __metadata("design:type", Number)
], CourseStudyRecord.prototype, "isFirst", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '是否参与了练习题', default: 0 }),
    __metadata("design:type", Number)
], CourseStudyRecord.prototype, "isAnswer", void 0);
CourseStudyRecord = __decorate([
    (0, typeorm_1.Entity)()
], CourseStudyRecord);
exports.CourseStudyRecord = CourseStudyRecord;


/***/ }),
/* 97 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.QuestionsForCourse = void 0;
const typeorm_1 = __webpack_require__(18);
let QuestionsForCourse = class QuestionsForCourse {
};
__decorate([
    (0, typeorm_1.PrimaryGeneratedColumn)('increment'),
    __metadata("design:type", Number)
], QuestionsForCourse.prototype, "id", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'course_id', comment: '实体对应的课程ID' }),
    __metadata("design:type", Number)
], QuestionsForCourse.prototype, "courseId", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'question_id', comment: '试题ID（对应Question表）' }),
    __metadata("design:type", Number)
], QuestionsForCourse.prototype, "questionId", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '该题分值' }),
    __metadata("design:type", Number)
], QuestionsForCourse.prototype, "score", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '题类型' }),
    __metadata("design:type", Number)
], QuestionsForCourse.prototype, "type", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'is_fixed', comment: '固定选题、随机选题' }),
    __metadata("design:type", Number)
], QuestionsForCourse.prototype, "isFixed", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'del_flag', default: 0, comment: '是否删除？软删除' }),
    __metadata("design:type", Number)
], QuestionsForCourse.prototype, "delFlag", void 0);
QuestionsForCourse = __decorate([
    (0, typeorm_1.Entity)()
], QuestionsForCourse);
exports.QuestionsForCourse = QuestionsForCourse;


/***/ }),
/* 98 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.OnlineCourseController = void 0;
const common_1 = __webpack_require__(2);
const online_course_service_1 = __webpack_require__(90);
const create_online_course_dto_1 = __webpack_require__(99);
const update_online_course_dto_1 = __webpack_require__(100);
const course_classify_dto_1 = __webpack_require__(67);
const swagger_1 = __webpack_require__(23);
const update_course_classify_dto_1 = __webpack_require__(68);
const update_online_course_dto_2 = __webpack_require__(100);
const pagination_dto_1 = __webpack_require__(66);
const delete_dto_1 = __webpack_require__(69);
const get_course_list_dto_1 = __webpack_require__(70);
const token_data_decorator_1 = __webpack_require__(37);
let OnlineCourseController = class OnlineCourseController {
    constructor(onlineCourseService) {
        this.onlineCourseService = onlineCourseService;
    }
    create(createOnlineCourseDto) {
        return this.onlineCourseService.create(createOnlineCourseDto);
    }
    findAll(getInfoDTO, tokenInfo) {
        return this.onlineCourseService.findAll(getInfoDTO, tokenInfo);
    }
    async findEvaluate(courseId, paging) {
        const datas = await this.onlineCourseService.getCourseEvaluate(+courseId, paging);
        datas.data = datas.data.map((item) => {
            return Object.assign(Object.assign({}, item), { value: JSON.parse(item.value) });
        });
        return datas;
    }
    searchCourseLsit(searchInfo, tokenInfo) {
        return this.onlineCourseService.searchCourseList(searchInfo, tokenInfo);
    }
    findOne(id) {
        return this.onlineCourseService.findOne(+id);
    }
    update(id, updateOnlineCourseDto) {
        return this.onlineCourseService.update(+id, updateOnlineCourseDto);
    }
    updateStatus(id, data) {
        return this.onlineCourseService.updateStatus(+id, data);
    }
    batchDeleteCourse(data) {
        this.onlineCourseService.batchDeleteCourse(data);
    }
    remove(id) {
        return this.onlineCourseService.remove(+id);
    }
    getclassifyList() {
        return this.onlineCourseService.getclassifyList();
    }
    createclassify(createclassify) {
        return this.onlineCourseService.createclassify(createclassify);
    }
    updateCourseclassify(id, updateclassify) {
        return this.onlineCourseService.updateclassify(id, updateclassify);
    }
    deleteCourseclassify(id) {
        return this.onlineCourseService.deleteclassify(id);
    }
};
__decorate([
    (0, common_1.Post)(),
    (0, swagger_1.ApiOperation)({ summary: '新建课程' }),
    __param(0, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_b = typeof create_online_course_dto_1.CreateOnlineCourseDto !== "undefined" && create_online_course_dto_1.CreateOnlineCourseDto) === "function" ? _b : Object]),
    __metadata("design:returntype", void 0)
], OnlineCourseController.prototype, "create", null);
__decorate([
    (0, common_1.Get)('course'),
    (0, swagger_1.ApiOperation)({ summary: '获取课程列表' }),
    __param(0, (0, common_1.Query)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_c = typeof get_course_list_dto_1.getCourseClassifyLsitDto !== "undefined" && get_course_list_dto_1.getCourseClassifyLsitDto) === "function" ? _c : Object, Object]),
    __metadata("design:returntype", void 0)
], OnlineCourseController.prototype, "findAll", null);
__decorate([
    (0, common_1.Get)('course-evaluate/:courseId'),
    (0, swagger_1.ApiOperation)({ summary: '获取课程列表' }),
    __param(0, (0, common_1.Param)('courseId')),
    __param(1, (0, common_1.Query)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, typeof (_d = typeof pagination_dto_1.PaginationDTO !== "undefined" && pagination_dto_1.PaginationDTO) === "function" ? _d : Object]),
    __metadata("design:returntype", Promise)
], OnlineCourseController.prototype, "findEvaluate", null);
__decorate([
    (0, common_1.Get)('course_search'),
    (0, swagger_1.ApiOperation)({ summary: '搜索课程列表' }),
    __param(0, (0, common_1.Query)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_e = typeof get_course_list_dto_1.SearchLsitDto !== "undefined" && get_course_list_dto_1.SearchLsitDto) === "function" ? _e : Object, Object]),
    __metadata("design:returntype", void 0)
], OnlineCourseController.prototype, "searchCourseLsit", null);
__decorate([
    (0, common_1.Get)('course/:id'),
    (0, swagger_1.ApiOperation)({ summary: '查询具体某个课程' }),
    __param(0, (0, common_1.Param)('id')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", void 0)
], OnlineCourseController.prototype, "findOne", null);
__decorate([
    (0, common_1.Patch)('course/:id'),
    (0, swagger_1.ApiOperation)({ summary: '更新某个课程' }),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, typeof (_f = typeof update_online_course_dto_1.UpdateOnlineCourseDto !== "undefined" && update_online_course_dto_1.UpdateOnlineCourseDto) === "function" ? _f : Object]),
    __metadata("design:returntype", void 0)
], OnlineCourseController.prototype, "update", null);
__decorate([
    (0, common_1.Get)('course_status/:id'),
    (0, swagger_1.ApiOperation)({ summary: '更新某个课程状态' }),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, common_1.Query)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, typeof (_g = typeof update_online_course_dto_2.updateCourseStatuDto !== "undefined" && update_online_course_dto_2.updateCourseStatuDto) === "function" ? _g : Object]),
    __metadata("design:returntype", void 0)
], OnlineCourseController.prototype, "updateStatus", null);
__decorate([
    (0, common_1.Post)('batch_delete'),
    (0, swagger_1.ApiOperation)({ summary: '删除课程' }),
    __param(0, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_h = typeof delete_dto_1.DeleteDto !== "undefined" && delete_dto_1.DeleteDto) === "function" ? _h : Object]),
    __metadata("design:returntype", void 0)
], OnlineCourseController.prototype, "batchDeleteCourse", null);
__decorate([
    (0, common_1.Delete)('course/:id'),
    __param(0, (0, common_1.Param)('id')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", void 0)
], OnlineCourseController.prototype, "remove", null);
__decorate([
    (0, common_1.Get)('classify'),
    (0, swagger_1.ApiOperation)({ summary: '查询所有分类' }),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", void 0)
], OnlineCourseController.prototype, "getclassifyList", null);
__decorate([
    (0, common_1.Post)('classify'),
    (0, swagger_1.ApiOperation)({ summary: '新增分类' }),
    __param(0, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_j = typeof course_classify_dto_1.CreateCourseclassifyDto !== "undefined" && course_classify_dto_1.CreateCourseclassifyDto) === "function" ? _j : Object]),
    __metadata("design:returntype", void 0)
], OnlineCourseController.prototype, "createclassify", null);
__decorate([
    (0, common_1.Patch)('classify/:id'),
    (0, swagger_1.ApiOperation)({ summary: '编辑分类' }),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, typeof (_k = typeof update_course_classify_dto_1.updateCourseclassifyDto !== "undefined" && update_course_classify_dto_1.updateCourseclassifyDto) === "function" ? _k : Object]),
    __metadata("design:returntype", void 0)
], OnlineCourseController.prototype, "updateCourseclassify", null);
__decorate([
    (0, common_1.Post)('classify/delete'),
    (0, swagger_1.ApiOperation)({ summary: '删除分类' }),
    __param(0, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_l = typeof delete_dto_1.DeleteDto !== "undefined" && delete_dto_1.DeleteDto) === "function" ? _l : Object]),
    __metadata("design:returntype", void 0)
], OnlineCourseController.prototype, "deleteCourseclassify", null);
OnlineCourseController = __decorate([
    (0, swagger_1.ApiTags)('在线课程'),
    (0, swagger_1.ApiBearerAuth)(),
    (0, common_1.Controller)('online-course'),
    __metadata("design:paramtypes", [typeof (_a = typeof online_course_service_1.OnlineCourseService !== "undefined" && online_course_service_1.OnlineCourseService) === "function" ? _a : Object])
], OnlineCourseController);
exports.OnlineCourseController = OnlineCourseController;


/***/ }),
/* 99 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CreateOnlineCourseDto = void 0;
const swagger_1 = __webpack_require__(23);
const class_validator_1 = __webpack_require__(25);
const create_dto_1 = __webpack_require__(39);
const baseSectionInfo = [
    {
        courseId: 1,
        name: '第一章',
        explain: '第一章的说明',
        serialNumber: 1,
        courseware: [
            {
                href: 'www.baidu.com',
                name: '名称',
                studyTime: 10,
                percentage: 10,
                canSpeed: 0,
                serialNumber: 1,
            },
        ],
    },
];
const courseEvaluate = [
    {
        courseId: 1,
        dimensionality: '维度名1',
        type: 0,
    },
    {
        courseId: 1,
        dimensionality: '维度名2',
        type: 1,
    },
];
class CreateOnlineCourseDto extends create_dto_1.CreateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '课程名称' }),
    (0, class_validator_1.IsNotEmpty)({ message: '课程名称不能为空' }),
    __metadata("design:type", String)
], CreateOnlineCourseDto.prototype, "name", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '所属分类id', default: 1 }),
    (0, class_validator_1.IsNotEmpty)({ message: '课程分类不能为空' }),
    __metadata("design:type", Number)
], CreateOnlineCourseDto.prototype, "classify", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '章节数量' }),
    (0, class_validator_1.IsNotEmpty)({ message: '课程章节数量不可为空' }),
    __metadata("design:type", Number)
], CreateOnlineCourseDto.prototype, "sectionCount", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '课程难度1-2-3' }),
    (0, class_validator_1.IsNotEmpty)({ message: '课程难度不可为空' }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", Number)
], CreateOnlineCourseDto.prototype, "difficulty", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '课程状态1为开启0为关闭' }),
    (0, class_validator_1.IsNotEmpty)({ message: '' }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", Number)
], CreateOnlineCourseDto.prototype, "status", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '课程分值' }),
    (0, class_validator_1.IsNotEmpty)({ message: '课程分值不可为空' }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", Number)
], CreateOnlineCourseDto.prototype, "grade", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '课程封面地址' }),
    (0, class_validator_1.IsString)({ message: '请上传string类型数据的封面地址' }),
    __metadata("design:type", String)
], CreateOnlineCourseDto.prototype, "cover", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '课程简介' }),
    (0, class_validator_1.IsString)({ message: '请上传string类型数据的课程简介' }),
    __metadata("design:type", String)
], CreateOnlineCourseDto.prototype, "explain", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '学习该课程的组织' }),
    (0, class_validator_1.IsNotEmpty)({ message: '学习该课程的组织不可为空' }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", Number)
], CreateOnlineCourseDto.prototype, "studyOrgId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '0/1章节顺序学习？' }),
    (0, class_validator_1.IsNotEmpty)({ message: '章节是否顺序学习不可为空' }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", Number)
], CreateOnlineCourseDto.prototype, "sectionSortStudy", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '0/1课件顺序学习？' }),
    (0, class_validator_1.IsNotEmpty)({ message: '课件是否顺序学习不可为空' }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", Number)
], CreateOnlineCourseDto.prototype, "coursewareSortStudy", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '0/1开启课程问答' }),
    (0, class_validator_1.IsNotEmpty)({ message: '开启课程问答不可为空' }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", Number)
], CreateOnlineCourseDto.prototype, "openQuiz", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '0/1开启讨论' }),
    (0, class_validator_1.IsNotEmpty)({ message: '开启讨论不可为空' }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", Number)
], CreateOnlineCourseDto.prototype, "openDiscussion", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '0/1开启课程评价' }),
    (0, class_validator_1.IsNotEmpty)({ message: '开启课程评价不可为空' }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", Number)
], CreateOnlineCourseDto.prototype, "openEval", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '0/1开启学员自评' }),
    (0, class_validator_1.IsNotEmpty)({ message: '开启学员自评不可为空' }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", Number)
], CreateOnlineCourseDto.prototype, "openSelfEvaluation", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '0/1开启文本或维度评价' }),
    (0, class_validator_1.IsNotEmpty)({ message: '开启文本或维度评价不可为空' }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", Number)
], CreateOnlineCourseDto.prototype, "txtOrGradeEvealute", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '0/1开启学员自评' }),
    (0, class_validator_1.IsNotEmpty)({ message: '开启学员自评不可为空' }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", Number)
], CreateOnlineCourseDto.prototype, "textOrGradeSelfEval", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '文本评价的标题' }),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], CreateOnlineCourseDto.prototype, "textEvaluateTitle", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '自评评价时的文本评价标题' }),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], CreateOnlineCourseDto.prototype, "selfTextEvaluateTitle", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '课程下的练习题信息', default: [1] }),
    (0, class_validator_1.IsArray)(),
    __metadata("design:type", Array)
], CreateOnlineCourseDto.prototype, "exercise", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '章节课件内容', default: baseSectionInfo }),
    (0, class_validator_1.IsArray)({ message: 'courseSectionContent必须为数组' }),
    __metadata("design:type", Array)
], CreateOnlineCourseDto.prototype, "courseSectionContent", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '课件评价维度', default: courseEvaluate }),
    (0, class_validator_1.IsArray)(),
    __metadata("design:type", Array)
], CreateOnlineCourseDto.prototype, "evalDimension", void 0);
exports.CreateOnlineCourseDto = CreateOnlineCourseDto;


/***/ }),
/* 100 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.updateCourseStatuDto = exports.UpdateOnlineCourseDto = void 0;
const swagger_1 = __webpack_require__(23);
const class_validator_1 = __webpack_require__(25);
const create_online_course_dto_1 = __webpack_require__(99);
class UpdateOnlineCourseDto extends create_online_course_dto_1.CreateOnlineCourseDto {
}
exports.UpdateOnlineCourseDto = UpdateOnlineCourseDto;
class updateCourseStatuDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '课程状态' }),
    (0, class_validator_1.IsNotEmpty)({ message: '课程状态不能为空' }),
    __metadata("design:type", Number)
], updateCourseStatuDto.prototype, "status", void 0);
exports.updateCourseStatuDto = updateCourseStatuDto;


/***/ }),
/* 101 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b, _c, _d, _e, _f, _g, _h;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CourseMyController = void 0;
const common_1 = __webpack_require__(2);
const swagger_1 = __webpack_require__(23);
const course_study_discussion_dto_1 = __webpack_require__(102);
const course_study_evaluate_dto_1 = __webpack_require__(103);
const course_study_courseware_dto_1 = __webpack_require__(104);
const course_study_exercise_dto_1 = __webpack_require__(105);
const my_course_service_1 = __webpack_require__(106);
const course_study_record_dto_1 = __webpack_require__(112);
const token_data_decorator_1 = __webpack_require__(37);
let CourseMyController = class CourseMyController {
    constructor(service) {
        this.service = service;
    }
    findMycourseList_All(findInfo, tokenInfo) {
        return this.service.findAllMyCourseList(findInfo, tokenInfo);
    }
    findMycourseList(findInfo, tokenInfo) {
        return this.service.findMycourseList(findInfo, tokenInfo);
    }
    findOneRecordExercise(id, tokenInfo) {
        return this.service.findOneRecordExercise(+id, tokenInfo);
    }
    findComment(id, tokenInfo) {
        return this.service.findComment(+id);
    }
    updateStudy_ware(wareInfo, tokenInfo) {
        return this.service.updateStudy_ware(wareInfo, tokenInfo);
    }
    fingOneRecord(id, tokenInfo) {
        return this.service.fingOneRecord(+id, tokenInfo);
    }
    updateStudy_eveal(evealInfo) {
        return this.service.updateStudy_eveal(evealInfo);
    }
    updateStudy_discussion(discussionInfo, tokenInfo) {
        return this.service.updateStudy_discussion(discussionInfo, tokenInfo);
    }
    manageStudy_exercise(exercise, TokenData) {
        return this.service.manageStudy_exercise(exercise, TokenData);
    }
    updateStudyDiscussionKudos(kudos, tokenInfo) {
        return this.service.updateStudyDiscussionKudos(kudos, tokenInfo);
    }
};
__decorate([
    (0, common_1.Post)(''),
    (0, swagger_1.ApiOperation)({ summary: '查询所有课程信息' }),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_b = typeof course_study_record_dto_1.findMyCourse_All !== "undefined" && course_study_record_dto_1.findMyCourse_All) === "function" ? _b : Object, Object]),
    __metadata("design:returntype", void 0)
], CourseMyController.prototype, "findMycourseList_All", null);
__decorate([
    (0, common_1.Post)('type'),
    (0, swagger_1.ApiOperation)({ summary: '查询符合分类的课程信息' }),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_c = typeof course_study_record_dto_1.findMyCourse_Type !== "undefined" && course_study_record_dto_1.findMyCourse_Type) === "function" ? _c : Object, Object]),
    __metadata("design:returntype", void 0)
], CourseMyController.prototype, "findMycourseList", null);
__decorate([
    (0, common_1.Get)('exercise/:id'),
    (0, swagger_1.ApiOperation)({ summary: '查询课程下试题信息' }),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, Object]),
    __metadata("design:returntype", void 0)
], CourseMyController.prototype, "findOneRecordExercise", null);
__decorate([
    (0, common_1.Get)('comment/:cid'),
    (0, swagger_1.ApiOperation)({ summary: '查询课程下试题信息' }),
    __param(0, (0, common_1.Param)('cid')),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, Object]),
    __metadata("design:returntype", void 0)
], CourseMyController.prototype, "findComment", null);
__decorate([
    (0, common_1.Post)('ware'),
    (0, swagger_1.ApiOperation)({ summary: '更新课件学习信息' }),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_d = typeof course_study_courseware_dto_1.CourseStudyCoursewareDto !== "undefined" && course_study_courseware_dto_1.CourseStudyCoursewareDto) === "function" ? _d : Object, Object]),
    __metadata("design:returntype", void 0)
], CourseMyController.prototype, "updateStudy_ware", null);
__decorate([
    (0, common_1.Get)(':id'),
    (0, swagger_1.ApiOperation)({ summary: '查询某个课程的具体学习信息' }),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, Object]),
    __metadata("design:returntype", void 0)
], CourseMyController.prototype, "fingOneRecord", null);
__decorate([
    (0, common_1.Post)('eveal'),
    (0, swagger_1.ApiOperation)({ summary: '更新评价信息' }),
    __param(0, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_e = typeof course_study_evaluate_dto_1.updateEvaluate !== "undefined" && course_study_evaluate_dto_1.updateEvaluate) === "function" ? _e : Object]),
    __metadata("design:returntype", void 0)
], CourseMyController.prototype, "updateStudy_eveal", null);
__decorate([
    (0, common_1.Post)('discussion'),
    (0, swagger_1.ApiOperation)({ summary: '评论提交接口' }),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_f = typeof course_study_discussion_dto_1.CourseStudyDiscussionDto !== "undefined" && course_study_discussion_dto_1.CourseStudyDiscussionDto) === "function" ? _f : Object, Object]),
    __metadata("design:returntype", void 0)
], CourseMyController.prototype, "updateStudy_discussion", null);
__decorate([
    (0, common_1.Post)('exercise'),
    (0, swagger_1.ApiOperation)({ summary: '课程练习题答题信息' }),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_g = typeof course_study_exercise_dto_1.updateExercise !== "undefined" && course_study_exercise_dto_1.updateExercise) === "function" ? _g : Object, Object]),
    __metadata("design:returntype", void 0)
], CourseMyController.prototype, "manageStudy_exercise", null);
__decorate([
    (0, common_1.Post)('discussion/kudos'),
    (0, swagger_1.ApiOperation)({ summary: '评论点赞' }),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_h = typeof course_study_discussion_dto_1.updateStudyDiscussionkudoDto !== "undefined" && course_study_discussion_dto_1.updateStudyDiscussionkudoDto) === "function" ? _h : Object, Object]),
    __metadata("design:returntype", void 0)
], CourseMyController.prototype, "updateStudyDiscussionKudos", null);
CourseMyController = __decorate([
    (0, swagger_1.ApiTags)('我的课程'),
    (0, swagger_1.ApiBearerAuth)(),
    (0, common_1.Controller)('my-course'),
    __metadata("design:paramtypes", [typeof (_a = typeof my_course_service_1.myCourseService !== "undefined" && my_course_service_1.myCourseService) === "function" ? _a : Object])
], CourseMyController);
exports.CourseMyController = CourseMyController;


/***/ }),
/* 102 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.updateStudyDiscussionkudoDto = exports.CourseStudyDiscussionDto = void 0;
const swagger_1 = __webpack_require__(23);
const class_validator_1 = __webpack_require__(25);
const create_dto_1 = __webpack_require__(39);
class CourseStudyDiscussionDto extends create_dto_1.CreateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '所属的记录ID' }),
    (0, class_validator_1.IsNotEmpty)({ message: '所属的记录ID不能为空' }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", Number)
], CourseStudyDiscussionDto.prototype, "recordId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '所回复的评论id' }),
    __metadata("design:type", Number)
], CourseStudyDiscussionDto.prototype, "replyId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '所回复评论的用户id' }),
    __metadata("design:type", String)
], CourseStudyDiscussionDto.prototype, "replyUserId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '所回复评论内容' }),
    (0, class_validator_1.IsNotEmpty)({ message: '所回复评论内容不能为空' }),
    __metadata("design:type", String)
], CourseStudyDiscussionDto.prototype, "content", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '所回复评论的根ID' }),
    __metadata("design:type", Number)
], CourseStudyDiscussionDto.prototype, "rootDis", void 0);
exports.CourseStudyDiscussionDto = CourseStudyDiscussionDto;
class updateStudyDiscussionkudoDto extends create_dto_1.CreateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '更新的id可为空' }),
    __metadata("design:type", Number)
], updateStudyDiscussionkudoDto.prototype, "id", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '讨论的id可为空' }),
    __metadata("design:type", Number)
], updateStudyDiscussionkudoDto.prototype, "disId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '点赞或踩' }),
    __metadata("design:type", Number)
], updateStudyDiscussionkudoDto.prototype, "type", void 0);
exports.updateStudyDiscussionkudoDto = updateStudyDiscussionkudoDto;


/***/ }),
/* 103 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.updateEvaluate = exports.CourseStudyEvaluateDto = void 0;
const swagger_1 = __webpack_require__(23);
const class_validator_1 = __webpack_require__(25);
const create_dto_1 = __webpack_require__(39);
class CourseStudyEvaluateDto extends create_dto_1.CreateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '所属的记录ID' }),
    (0, class_validator_1.IsNotEmpty)({ message: '所属的记录ID不能为空' }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", Number)
], CourseStudyEvaluateDto.prototype, "recordId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '评论所属维度ID' }),
    (0, class_validator_1.IsNotEmpty)({ message: '评论所属维度ID不能为空' }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", String)
], CourseStudyEvaluateDto.prototype, "dimensionId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({
        description: '评分值1-5',
    }),
    (0, class_validator_1.IsNotEmpty)({ message: '平分值不可为空' }),
    __metadata("design:type", Number)
], CourseStudyEvaluateDto.prototype, "value", void 0);
__decorate([
    (0, class_validator_1.IsNotEmpty)({ message: '0为课程评价1为自我评价' }),
    __metadata("design:type", Number)
], CourseStudyEvaluateDto.prototype, "type", void 0);
exports.CourseStudyEvaluateDto = CourseStudyEvaluateDto;
class updateEvaluate {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '评价的集体信息' }),
    __metadata("design:type", Array)
], updateEvaluate.prototype, "evealInfo", void 0);
exports.updateEvaluate = updateEvaluate;


/***/ }),
/* 104 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CourseStudyCoursewareDto = void 0;
const swagger_1 = __webpack_require__(23);
const class_validator_1 = __webpack_require__(25);
const create_dto_1 = __webpack_require__(39);
class CourseStudyCoursewareDto extends create_dto_1.CreateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '需要更新的ID，可填可不填' }),
    __metadata("design:type", Number)
], CourseStudyCoursewareDto.prototype, "id", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '所属的记录ID' }),
    (0, class_validator_1.IsNotEmpty)({ message: '所属的记录ID不能为空' }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", Number)
], CourseStudyCoursewareDto.prototype, "recordId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '课件ID' }),
    (0, class_validator_1.IsNotEmpty)({ message: '课件的ID不可为空' }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", Number)
], CourseStudyCoursewareDto.prototype, "coursewareId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '学习进度百分比不可为空' }),
    (0, class_validator_1.IsNotEmpty)({ message: '学习进度百分比不可为空' }),
    __metadata("design:type", Number)
], CourseStudyCoursewareDto.prototype, "studyProgress", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({
        description: '学习状态：0未开始，1进行中，2已完成',
        default: 1,
    }),
    (0, class_validator_1.IsNotEmpty)({ message: '学习状态不可为空' }),
    __metadata("design:type", Number)
], CourseStudyCoursewareDto.prototype, "courseStudyOver", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({
        description: '获得的分数',
        default: 1,
    }),
    (0, class_validator_1.IsNotEmpty)({ message: '当前分数不可为空' }),
    __metadata("design:type", Number)
], CourseStudyCoursewareDto.prototype, "score", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({
        description: '学习时间',
        default: 0,
    }),
    __metadata("design:type", Number)
], CourseStudyCoursewareDto.prototype, "learningDuration", void 0);
exports.CourseStudyCoursewareDto = CourseStudyCoursewareDto;


/***/ }),
/* 105 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var _a;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.updateExercise = exports.CourseStudyExerciseDto = void 0;
const swagger_1 = __webpack_require__(23);
const class_validator_1 = __webpack_require__(25);
const create_dto_1 = __webpack_require__(39);
class CourseStudyExerciseDto extends create_dto_1.CreateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '所属的记录ID' }),
    (0, class_validator_1.IsNotEmpty)({ message: '所属的记录ID不能为空' }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", Number)
], CourseStudyExerciseDto.prototype, "recordId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '练习题ID' }),
    (0, class_validator_1.IsNotEmpty)({ message: '练习题ID不能为空' }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", Number)
], CourseStudyExerciseDto.prototype, "exerciseId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '答案信息' }),
    (0, class_validator_1.IsNotEmpty)({ message: '答案信息不可为空' }),
    __metadata("design:type", String)
], CourseStudyExerciseDto.prototype, "answer", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '是否正确' }),
    (0, class_validator_1.IsNotEmpty)({ message: '是否正确不可为空' }),
    __metadata("design:type", Number)
], CourseStudyExerciseDto.prototype, "isRight", void 0);
exports.CourseStudyExerciseDto = CourseStudyExerciseDto;
class updateExercise {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '练习题答案信息提交' }),
    (0, class_validator_1.IsNotEmpty)({ message: '答题不可为空' }),
    __metadata("design:type", Array)
], updateExercise.prototype, "answer", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '当前答案所属的课程id' }),
    (0, class_validator_1.IsNotEmpty)({ message: '当前问题所属的课程id不可为空' }),
    __metadata("design:type", Number)
], updateExercise.prototype, "coureseId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '当前答案所属的记录id' }),
    (0, class_validator_1.IsNotEmpty)({ message: '当前答案所属的记录id不可为空' }),
    __metadata("design:type", Number)
], updateExercise.prototype, "recordId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '开始时间' }),
    __metadata("design:type", typeof (_a = typeof Date !== "undefined" && Date) === "function" ? _a : Object)
], updateExercise.prototype, "createTime", void 0);
exports.updateExercise = updateExercise;


/***/ }),
/* 106 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.myCourseService = void 0;
const typeorm_1 = __webpack_require__(9);
const typeorm_2 = __webpack_require__(18);
const course_study_discussion_entity_1 = __webpack_require__(107);
const course_study_evaluate_entity_1 = __webpack_require__(108);
const course_study_exercise_entity_1 = __webpack_require__(109);
const course_study_record_entity_1 = __webpack_require__(96);
const course_study_courseware_entity_1 = __webpack_require__(110);
const user_entity_1 = __webpack_require__(21);
const course_list_entity_1 = __webpack_require__(92);
const course_classify_entity_1 = __webpack_require__(91);
const online_course_service_1 = __webpack_require__(90);
const course_questions_entity_1 = __webpack_require__(97);
const question_entity_1 = __webpack_require__(56);
const question_type_entity_1 = __webpack_require__(79);
const mistake_again_controller_1 = __webpack_require__(73);
const course_study_discussion_kudos_entity_1 = __webpack_require__(111);
let myCourseService = class myCourseService {
    constructor(study_record_Sql, study_discussion_Sql, study_evaluate_Sql, study_coursewar_Sql, study_Exercise_Sql, Course_List_sql, onlineCourseService, Questions_sql, CourseStudyDisKudos_sql) {
        this.study_record_Sql = study_record_Sql;
        this.study_discussion_Sql = study_discussion_Sql;
        this.study_evaluate_Sql = study_evaluate_Sql;
        this.study_coursewar_Sql = study_coursewar_Sql;
        this.study_Exercise_Sql = study_Exercise_Sql;
        this.Course_List_sql = Course_List_sql;
        this.onlineCourseService = onlineCourseService;
        this.Questions_sql = Questions_sql;
        this.CourseStudyDisKudos_sql = CourseStudyDisKudos_sql;
    }
    async findMycourseList(findInfo, tokenInfo) {
        const page = findInfo.page;
        const pageSize = findInfo.pageSize;
        const findString = [
            `record.course_id = course.id`,
            `course.study_org_id = ${tokenInfo.orgId}`,
            'course.del_flag = 0',
        ];
        const res = await this.study_record_Sql
            .createQueryBuilder('record')
            .innerJoinAndMapOne('record.courseInfo', course_list_entity_1.CourseList, 'course', findString.join(' AND '))
            .leftJoinAndMapMany('record.exercise', course_study_exercise_entity_1.CourseStudyExercise, 'exercise', 'exercise.recordId = record.id and exercise.del_flag = 0')
            .leftJoinAndMapOne('record.lecturer', user_entity_1.User, 'user', 'user.id = course.creator')
            .leftJoinAndMapOne('record.classify', course_classify_entity_1.CourseClassify, 'classify', 'classify.id = course.classify')
            .andWhere({
            delFlag: 0,
            studyProgress: findInfo.type,
            studentId: tokenInfo.userId,
        })
            .skip((page - 1) * pageSize)
            .take(pageSize)
            .getManyAndCount();
        return {
            data: res[0],
            total: res[1],
        };
    }
    async getListCount(tokenInfo, searchVlue) {
        const orgId = tokenInfo.orgId;
        const userId = tokenInfo.userId;
        const sqlString = `
    SELECT (
      SELECT
        COUNT( course_study_record.id ) AS countList
      FROM
        course_study_record
        INNER JOIN course_list ON course_study_record.course_id = course_list.id 
      WHERE
        course_list.study_org_id = ${orgId}
        AND course_list.del_flag = 0 
        AND course_study_record.del_flag = 0 
        AND course_study_record.student_id = '${userId}' 
        AND course_study_record.study_progress = 1 ) as 'no',(
      
      SELECT
        COUNT( course_study_record.id ) AS aaa 
      FROM
        course_study_record
        INNER JOIN course_list ON course_study_record.course_id = course_list.id 
      WHERE
        course_list.study_org_id = ${orgId}
        AND course_list.del_flag = 0 
        AND course_study_record.del_flag = 0 
        AND course_study_record.student_id = '${userId}' 
        AND course_study_record.study_progress = 2 ) as 'start',
      
      
      (
      SELECT
        COUNT( course_study_record.id ) AS aaa 
      FROM
        course_study_record
        INNER JOIN course_list ON course_study_record.course_id = course_list.id 
      WHERE
        course_list.study_org_id = ${orgId}
        AND course_list.del_flag = 0 
        AND course_study_record.del_flag = 0 
        AND course_study_record.student_id = '${userId}' 
        AND course_study_record.study_progress = 3) as 'over',
      
      (
      SELECT
        COUNT(course_list.id)
      FROM
        course_list
      WHERE
        course_list.study_org_id = ${orgId} AND
        course_list.del_flag = 0
        ) as 'all'
    `;
        return (await this.Course_List_sql.query(sqlString, []))[0];
    }
    async findAllMyCourseList(findInfo, tokenInfo) {
        console.log(findInfo);
        const a = { delFlag: 0, studyOrgId: +tokenInfo.orgId };
        const page = findInfo.page;
        const pageSize = findInfo.pageSize;
        const searchVlue = findInfo.search;
        if (searchVlue) {
            a.name = (0, typeorm_2.Like)(`%${searchVlue}%`);
        }
        const res = await this.Course_List_sql.createQueryBuilder('course')
            .leftJoinAndMapOne('course.record', course_study_record_entity_1.CourseStudyRecord, 'record', `record.del_flag = 0 AND record.courseId = course.id AND record.student_id = '${tokenInfo.userId}'`)
            .leftJoinAndMapMany('record.exercise', course_study_exercise_entity_1.CourseStudyExercise, 'exercise', 'exercise.recordId = record.id and exercise.del_flag = 0')
            .leftJoinAndMapOne('record.lecturer', user_entity_1.User, 'user', 'user.id = course.creator')
            .leftJoinAndMapOne('record.classify', course_classify_entity_1.CourseClassify, 'classify', 'course.classify = classify.id')
            .andWhere(a)
            .skip((page - 1) * pageSize)
            .take(pageSize)
            .getManyAndCount();
        const needAdd = [];
        res[0].forEach((course) => {
            console.log(course);
            if (!course.record) {
                const newRecord = {
                    studentId: tokenInfo.userId,
                    courseId: course.id,
                    studyTime: 0,
                    studyProgress: 1,
                    exerciseGrade: 0,
                    selfEvael: '',
                    courseEveal: '',
                    score: 0,
                    createTime: course.createTime,
                    creator: course.creator,
                    delFlag: 0,
                    updater: course.updater,
                    remarks: null,
                    version: 1,
                    id: undefined,
                };
                course.record = newRecord;
                needAdd.push(newRecord);
            }
        });
        needAdd.length && (await this.study_record_Sql.save(needAdd));
        return {
            data: res[0],
            count: await this.getListCount(tokenInfo, searchVlue),
        };
    }
    async findComment(courseId) {
        const discussion = await this.study_discussion_Sql
            .createQueryBuilder('sds')
            .leftJoinAndMapMany('sds.kudos', course_study_discussion_kudos_entity_1.CourseStudyDisKudos, 'csdk', `csdk.record_id = ${courseId} and csdk.dis_id = sds.id and csdk.del_flag = 0`)
            .leftJoinAndMapOne(`sds.userInfo`, user_entity_1.User, 'du', 'du.id = sds.creator')
            .where({ delFlag: 0, recordId: courseId })
            .getMany();
        const courseInfo = await this.onlineCourseService.findOne(courseId);
        return { discussion, courseInfo };
    }
    async fingOneRecord(id, tokenInfo) {
        const findString = [
            `course.id = record.course_id`,
            `course.del_flag = 0`,
            `course.study_org_id = ${tokenInfo.orgId}`,
            `course.status = 1`,
        ];
        const res = await this.study_record_Sql
            .createQueryBuilder('record')
            .leftJoinAndMapMany('record.exercise', course_study_exercise_entity_1.CourseStudyExercise, 'exercise', 'exercise.recordId = record.id and exercise.del_flag = 0')
            .leftJoinAndMapOne('exercise.answer', course_study_exercise_entity_1.CourseStudyExercise, 'cse', `exercise.question_id = exercise.question_id and cse.del_flag = 0 and cse.recordId = ${id}`)
            .leftJoinAndMapMany('record.eveal', course_study_evaluate_entity_1.CourseStudyEvaluate, 'eveal', 'eveal.recordId = record.id')
            .leftJoinAndMapMany('record.discussion', course_study_discussion_entity_1.CourseStudyDiscussion, 'discussion', 'discussion.recordId = record.courseId and discussion.del_flag = 0')
            .leftJoinAndMapMany('record.courseware', course_study_courseware_entity_1.CourseStudyCourseware, 'courseware', 'courseware.record_id = record.id and courseware.del_flag = 0')
            .leftJoinAndMapOne(`discussion.userInfo`, user_entity_1.User, 'du', 'du.id = discussion.creator')
            .leftJoinAndMapOne(`discussion.replyUserInfo`, user_entity_1.User, 'ru', 'ru.id = discussion.reply_user_id')
            .leftJoinAndMapOne('record.courseInfo', course_list_entity_1.CourseList, 'course', findString.join(' AND '))
            .leftJoinAndMapMany('discussion.kudos', course_study_discussion_kudos_entity_1.CourseStudyDisKudos, 'csdk', `csdk.record_id = record.courseId and csdk.dis_id = discussion.id and csdk.del_flag = 0`)
            .leftJoinAndMapOne('record.lecturer', user_entity_1.User, 'user', 'user.id = course.creator')
            .leftJoinAndMapOne('record.classifyInfo', course_classify_entity_1.CourseClassify, 'classify', 'classify.id = course.classify')
            .andWhere({ delFlag: 0, id })
            .getOne();
        if (res.courseInfo) {
            res.courseInfo = await this.onlineCourseService.findOne(res.courseInfo.id);
            console.log(res.courseInfo);
        }
        this.fingOneRecordThen(res);
        return res;
    }
    async fingOneRecordThen(record) {
        if (record.isFirst && record.courseInfo) {
            this.Course_List_sql.query(`update course_list set view_number=view_number+1 where  id= ${record.courseInfo.id};`);
            this.study_record_Sql.update({ id: record.id }, { isFirst: 0 });
        }
    }
    async findOneRecordExercise(id, tokenInfo) {
        const res = await this.study_record_Sql
            .createQueryBuilder('srs')
            .leftJoin(course_list_entity_1.CourseList, 'cl', 'srs.course_id = cl.id')
            .leftJoinAndMapMany('srs.exercise', course_questions_entity_1.QuestionsForCourse, 'qfc', 'qfc.course_id = cl.id AND qfc.del_flag = 0')
            .leftJoinAndMapOne('qfc.info', question_entity_1.Question, 'q', 'q.id = qfc.question_id')
            .leftJoinAndMapOne('q.typeInfo', question_type_entity_1.QuestionType, 'qt', 'qt.id = q.type')
            .leftJoinAndMapOne('qfc.answer', course_study_exercise_entity_1.CourseStudyExercise, 'cse', `qfc.question_id = cse.question_id and cse.del_flag = 0 and cse.recordId = ${id}`)
            .where({ id, studentId: tokenInfo.userId })
            .getOne();
        return res;
    }
    async updateStudy_ware(wareInfo, tokenInfo) {
        await this.study_record_Sql.update(wareInfo.recordId, {
            score: wareInfo.score,
            studyProgress: wareInfo.courseStudyOver,
        });
        delete wareInfo.courseStudyOver;
        delete wareInfo.score;
        wareInfo.creator = tokenInfo.userId;
        wareInfo.updater = tokenInfo.userId;
        console.log(wareInfo);
        const newData = wareInfo;
        const res = await this.study_coursewar_Sql.save(newData);
        return res;
    }
    async updateStudy_eveal(evealData) {
        const res = {};
        if (evealData.textEvealInfo) {
            res.textEvealInfo = await this.study_record_Sql.update(evealData.textEvealInfo.id, Object.assign({}, evealData.textEvealInfo));
        }
        if (evealData.evealInfo) {
            res.evealaute = await this.study_evaluate_Sql.save(evealData.evealInfo);
        }
        return res;
    }
    async updateStudy_discussion(discussionInfo, tokenInfo) {
        const saveData = Object.assign(Object.assign({}, discussionInfo), { creator: tokenInfo.userId, updater: tokenInfo.userId });
        const res = await this.study_discussion_Sql.save(saveData);
        return res;
    }
    async updateStudyDiscussionKudos(data, tokenInfo) {
        data.updater = tokenInfo.userId;
        data.creator = tokenInfo.userId;
        const result = await this.CourseStudyDisKudos_sql.save(data);
        const res = this.CourseStudyDisKudos_sql.findBy({
            recordId: result.recordId,
            disId: result.disId,
            delFlag: 0,
        });
        return res;
    }
    async manageStudy_exercise({ coureseId, answer, recordId, createTime }, TokenData) {
        const ids = answer.map((_) => _.questionId);
        console.log(ids);
        const questions = await this.Questions_sql.query(`
    SELECT
    q.id as id,
    q.type as typeId,
    q.difficulty_level as  difficultyLevelId,
    q.classify_id as  classifyId,
    q.knowledge_id as knowledgeId,
    q.title as title,
    q.answer as answer ,
    q.analysis as analysis,
    q.options  as options,
    qs.score as score
   FROM question q LEFT JOIN questions_for_course qs ON q.id = qs.question_id and qs.course_id = ? AND qs.del_flag =0 AND qs.course_id = ?  WHERE q.id IN (?)`, [coureseId, coureseId, ids]);
        console.log(answer);
        const res = { quesInfo: [...questions], score: 0, errorNum: 0 };
        questions.forEach((quesItem) => {
            const answerItem = answer.find((an) => an.questionId === quesItem.id);
            if (answerItem) {
                const result = (0, mistake_again_controller_1.checkAnswer)(quesItem, answerItem.answer);
                res.score += result.score;
                quesItem.isPass = result.pass;
                if (result.isPass)
                    res.errorNum++;
                quesItem.createTime = createTime;
                quesItem.userAnswer = JSON.stringify(answerItem.answer);
                quesItem.comment = '';
                quesItem.questionScore = quesItem.score;
                quesItem.recordId = recordId;
                quesItem.questionId = quesItem.id;
                quesItem.score = result.score;
                quesItem.mistakeScor = 0;
                quesItem.creator = TokenData.userId;
                quesItem.updater = TokenData.userId;
                delete quesItem.id;
            }
        });
        this.study_record_Sql.update(recordId, {
            exerciseGrade: res.score,
            isAnswer: 1,
        });
        await this.study_Exercise_Sql.update({ recordId: recordId }, { delFlag: 1 });
        console.log(questions);
        await this.study_Exercise_Sql.insert(questions);
        return res;
    }
};
myCourseService = __decorate([
    __param(0, (0, typeorm_1.InjectRepository)(course_study_record_entity_1.CourseStudyRecord)),
    __param(1, (0, typeorm_1.InjectRepository)(course_study_discussion_entity_1.CourseStudyDiscussion)),
    __param(2, (0, typeorm_1.InjectRepository)(course_study_evaluate_entity_1.CourseStudyEvaluate)),
    __param(3, (0, typeorm_1.InjectRepository)(course_study_courseware_entity_1.CourseStudyCourseware)),
    __param(4, (0, typeorm_1.InjectRepository)(course_study_exercise_entity_1.CourseStudyExercise)),
    __param(5, (0, typeorm_1.InjectRepository)(course_list_entity_1.CourseList)),
    __param(7, (0, typeorm_1.InjectRepository)(question_entity_1.Question)),
    __param(8, (0, typeorm_1.InjectRepository)(course_study_discussion_kudos_entity_1.CourseStudyDisKudos)),
    __metadata("design:paramtypes", [typeof (_a = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _a : Object, typeof (_b = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _b : Object, typeof (_c = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _c : Object, typeof (_d = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _d : Object, typeof (_e = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _e : Object, typeof (_f = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _f : Object, typeof (_g = typeof online_course_service_1.OnlineCourseService !== "undefined" && online_course_service_1.OnlineCourseService) === "function" ? _g : Object, typeof (_h = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _h : Object, typeof (_j = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _j : Object])
], myCourseService);
exports.myCourseService = myCourseService;


/***/ }),
/* 107 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CourseStudyDiscussion = void 0;
const increment_id_entity_1 = __webpack_require__(17);
const typeorm_1 = __webpack_require__(18);
let CourseStudyDiscussion = class CourseStudyDiscussion extends increment_id_entity_1.IncrementIdEntity {
};
__decorate([
    (0, typeorm_1.Column)({ name: 'record_id', comment: '所属记录id' }),
    __metadata("design:type", Number)
], CourseStudyDiscussion.prototype, "recordId", void 0);
__decorate([
    (0, typeorm_1.Column)({
        name: 'reply_id',
        comment: '所回复的评论id',
        nullable: true,
        default: null,
    }),
    __metadata("design:type", Number)
], CourseStudyDiscussion.prototype, "replyId", void 0);
__decorate([
    (0, typeorm_1.Column)({
        type: global.DB_IS_SQLITE ? 'text' : 'longtext',
        name: 'reply_user_id',
        comment: '所回复评论的用户ID',
        nullable: true,
        default: null,
    }),
    __metadata("design:type", String)
], CourseStudyDiscussion.prototype, "replyUserId", void 0);
__decorate([
    (0, typeorm_1.Column)({
        name: 'root_dis',
        comment: '所回复评论的根节点id',
        nullable: true,
        default: null,
    }),
    __metadata("design:type", Number)
], CourseStudyDiscussion.prototype, "rootDis", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: global.DB_IS_SQLITE ? 'text' : 'longtext', comment: '的评论内容' }),
    __metadata("design:type", String)
], CourseStudyDiscussion.prototype, "content", void 0);
CourseStudyDiscussion = __decorate([
    (0, typeorm_1.Entity)()
], CourseStudyDiscussion);
exports.CourseStudyDiscussion = CourseStudyDiscussion;


/***/ }),
/* 108 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CourseStudyEvaluate = void 0;
const increment_id_entity_1 = __webpack_require__(17);
const typeorm_1 = __webpack_require__(18);
let CourseStudyEvaluate = class CourseStudyEvaluate extends increment_id_entity_1.IncrementIdEntity {
};
__decorate([
    (0, typeorm_1.Column)({ name: 'record_id', comment: '所属记录id' }),
    __metadata("design:type", Number)
], CourseStudyEvaluate.prototype, "recordId", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: global.DB_IS_SQLITE ? 'text' : 'longtext', name: 'dimension_id', comment: '评价所属维度Id' }),
    __metadata("design:type", String)
], CourseStudyEvaluate.prototype, "dimensionId", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '评分值1-5' }),
    __metadata("design:type", Number)
], CourseStudyEvaluate.prototype, "value", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '评论类型，0为课程评价1为自我评价' }),
    __metadata("design:type", Number)
], CourseStudyEvaluate.prototype, "type", void 0);
CourseStudyEvaluate = __decorate([
    (0, typeorm_1.Entity)()
], CourseStudyEvaluate);
exports.CourseStudyEvaluate = CourseStudyEvaluate;


/***/ }),
/* 109 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CourseStudyExercise = void 0;
const increment_id_entity_1 = __webpack_require__(17);
const typeorm_1 = __webpack_require__(18);
let CourseStudyExercise = class CourseStudyExercise extends increment_id_entity_1.IncrementIdEntity {
};
__decorate([
    (0, typeorm_1.Column)({ name: 'record_id', comment: '学习记录Id' }),
    __metadata("design:type", Number)
], CourseStudyExercise.prototype, "recordId", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'question_id', comment: '试题ID' }),
    __metadata("design:type", Number)
], CourseStudyExercise.prototype, "questionId", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'question_score', comment: '该题分值' }),
    __metadata("design:type", Number)
], CourseStudyExercise.prototype, "questionScore", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '我的得分' }),
    __metadata("design:type", Number)
], CourseStudyExercise.prototype, "score", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'mistake_score', comment: '错题得分', default: 0 }),
    __metadata("design:type", Number)
], CourseStudyExercise.prototype, "mistakeScore", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'user_answer', comment: '我的答案' }),
    __metadata("design:type", String)
], CourseStudyExercise.prototype, "userAnswer", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '老师的评语', default: null, type: global.DB_IS_SQLITE ? 'text' : 'longtext' }),
    __metadata("design:type", String)
], CourseStudyExercise.prototype, "comment", void 0);
CourseStudyExercise = __decorate([
    (0, typeorm_1.Entity)()
], CourseStudyExercise);
exports.CourseStudyExercise = CourseStudyExercise;


/***/ }),
/* 110 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CourseStudyCourseware = void 0;
const increment_id_entity_1 = __webpack_require__(17);
const typeorm_1 = __webpack_require__(18);
let CourseStudyCourseware = class CourseStudyCourseware extends increment_id_entity_1.IncrementIdEntity {
};
__decorate([
    (0, typeorm_1.Column)({ name: 'record_id', comment: '所属记录id' }),
    __metadata("design:type", Number)
], CourseStudyCourseware.prototype, "recordId", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'courseware_id', comment: '学习的课件id' }),
    __metadata("design:type", Number)
], CourseStudyCourseware.prototype, "coursewareId", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'study_progress', comment: '学习进度%' }),
    __metadata("design:type", Number)
], CourseStudyCourseware.prototype, "studyProgress", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: ' learning_duration', comment: '学习时常' }),
    __metadata("design:type", Number)
], CourseStudyCourseware.prototype, "learningDuration", void 0);
CourseStudyCourseware = __decorate([
    (0, typeorm_1.Entity)()
], CourseStudyCourseware);
exports.CourseStudyCourseware = CourseStudyCourseware;


/***/ }),
/* 111 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CourseStudyDisKudos = void 0;
const increment_id_entity_1 = __webpack_require__(17);
const typeorm_1 = __webpack_require__(18);
let CourseStudyDisKudos = class CourseStudyDisKudos extends increment_id_entity_1.IncrementIdEntity {
};
__decorate([
    (0, typeorm_1.Column)({ name: 'record_id', comment: '所属记录id' }),
    __metadata("design:type", Number)
], CourseStudyDisKudos.prototype, "recordId", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'dis_id', comment: '讨论id' }),
    __metadata("design:type", Number)
], CourseStudyDisKudos.prototype, "disId", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'courseware_id', comment: '0/1 踩或点赞' }),
    __metadata("design:type", Number)
], CourseStudyDisKudos.prototype, "type", void 0);
CourseStudyDisKudos = __decorate([
    (0, typeorm_1.Entity)()
], CourseStudyDisKudos);
exports.CourseStudyDisKudos = CourseStudyDisKudos;


/***/ }),
/* 112 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.findMyCourse_All = exports.findMyCourse_Type = exports.CourseStudyRecordDto = void 0;
const swagger_1 = __webpack_require__(23);
const class_validator_1 = __webpack_require__(25);
const create_dto_1 = __webpack_require__(39);
class CourseStudyRecordDto extends create_dto_1.CreateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '学员ID' }),
    (0, class_validator_1.IsNotEmpty)({ message: '学员ID不能为空' }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", String)
], CourseStudyRecordDto.prototype, "studentId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '课程名ID' }),
    (0, class_validator_1.IsNotEmpty)({ message: '课程ID不能为空' }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", Number)
], CourseStudyRecordDto.prototype, "courseId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '已学习时长' }),
    (0, class_validator_1.IsNotEmpty)({ message: '已学习时长不能为空' }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", Number)
], CourseStudyRecordDto.prototype, "studyTime", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '得分' }),
    (0, class_validator_1.IsNotEmpty)({ message: '得分不能为空' }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", Number)
], CourseStudyRecordDto.prototype, "score", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '学习进度：0未开始，1进行中，2已完成' }),
    (0, class_validator_1.IsNotEmpty)({ message: '学习进度不能为空' }),
    __metadata("design:type", Number)
], CourseStudyRecordDto.prototype, "studyProgress", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '练习题分数' }),
    (0, class_validator_1.IsNotEmpty)({ message: '练习题分数不可为空' }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", Number)
], CourseStudyRecordDto.prototype, "exerciseGrade", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '自我评价的内容' }),
    __metadata("design:type", String)
], CourseStudyRecordDto.prototype, "selfEvael", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '课程评价的内容' }),
    __metadata("design:type", String)
], CourseStudyRecordDto.prototype, "courseEveal", void 0);
exports.CourseStudyRecordDto = CourseStudyRecordDto;
class findMyCourse_Type {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '要查询的课程类型' }),
    __metadata("design:type", Number)
], findMyCourse_Type.prototype, "type", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '要查询的页码' }),
    __metadata("design:type", Number)
], findMyCourse_Type.prototype, "page", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '要查询的页码大小' }),
    __metadata("design:type", Number)
], findMyCourse_Type.prototype, "pageSize", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '要搜索的内容' }),
    __metadata("design:type", String)
], findMyCourse_Type.prototype, "search", void 0);
exports.findMyCourse_Type = findMyCourse_Type;
class findMyCourse_All {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '要查询的页码' }),
    __metadata("design:type", Number)
], findMyCourse_All.prototype, "page", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '要查询的页码大小' }),
    __metadata("design:type", Number)
], findMyCourse_All.prototype, "pageSize", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '要搜索的内容' }),
    __metadata("design:type", String)
], findMyCourse_All.prototype, "search", void 0);
exports.findMyCourse_All = findMyCourse_All;


/***/ }),
/* 113 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CourseNotes = void 0;
const increment_id_entity_1 = __webpack_require__(17);
const typeorm_1 = __webpack_require__(18);
let CourseNotes = class CourseNotes extends increment_id_entity_1.IncrementIdEntity {
};
__decorate([
    (0, typeorm_1.Column)({ name: 'explain', comment: '笔记简介', type: global.DB_IS_SQLITE ? 'text' : 'longtext' }),
    __metadata("design:type", String)
], CourseNotes.prototype, "explain", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'content', comment: '笔记内容', type: global.DB_IS_SQLITE ? 'text' : 'longtext' }),
    __metadata("design:type", String)
], CourseNotes.prototype, "content", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: global.DB_IS_SQLITE ? 'text' : 'longtext', name: 'title', comment: '笔记标题' }),
    __metadata("design:type", String)
], CourseNotes.prototype, "title", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'view_count', comment: '笔记查看次数', default: 0 }),
    __metadata("design:type", Number)
], CourseNotes.prototype, "viewCount", void 0);
CourseNotes = __decorate([
    (0, typeorm_1.Entity)()
], CourseNotes);
exports.CourseNotes = CourseNotes;


/***/ }),
/* 114 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b, _c, _d;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CourseNotesController = void 0;
const common_1 = __webpack_require__(2);
const swagger_1 = __webpack_require__(23);
const token_data_decorator_1 = __webpack_require__(37);
const course_notes_service_1 = __webpack_require__(115);
const course_nots_dto_1 = __webpack_require__(116);
const pagination_dto_1 = __webpack_require__(66);
let CourseNotesController = class CourseNotesController {
    constructor(service) {
        this.service = service;
    }
    findMyNoteList(pageInfo, tokenInfo) {
        return this.service.findNotes(pageInfo, tokenInfo);
    }
    findOneNote(id, tokenInfo) {
        return this.service.findOneNote(id, tokenInfo);
    }
    createNote(noteInfo, tokenInfo) {
        return this.service.createNote(noteInfo, tokenInfo);
    }
    updateNote(id, noteInfo, tokenInfo) {
        return this.service.updateNote(id, noteInfo, tokenInfo);
    }
    deleteNote(id, tokenInfo) {
        return this.service.deleteNote(id, tokenInfo);
    }
};
__decorate([
    (0, common_1.Get)(),
    (0, swagger_1.ApiOperation)({ summary: '获取笔记列表' }),
    __param(0, (0, common_1.Query)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_b = typeof pagination_dto_1.PaginationDTO !== "undefined" && pagination_dto_1.PaginationDTO) === "function" ? _b : Object, Object]),
    __metadata("design:returntype", void 0)
], CourseNotesController.prototype, "findMyNoteList", null);
__decorate([
    (0, common_1.Get)(':id'),
    (0, swagger_1.ApiOperation)({ summary: '获取某个笔记详细信息' }),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Object]),
    __metadata("design:returntype", void 0)
], CourseNotesController.prototype, "findOneNote", null);
__decorate([
    (0, common_1.Post)(),
    (0, swagger_1.ApiOperation)({ summary: '新建笔记' }),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_c = typeof course_nots_dto_1.CourseNotesDto !== "undefined" && course_nots_dto_1.CourseNotesDto) === "function" ? _c : Object, Object]),
    __metadata("design:returntype", void 0)
], CourseNotesController.prototype, "createNote", null);
__decorate([
    (0, common_1.Patch)(':id'),
    (0, swagger_1.ApiOperation)({ summary: '更新笔记' }),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, common_1.Body)()),
    __param(2, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, typeof (_d = typeof course_nots_dto_1.updateNoteDto !== "undefined" && course_nots_dto_1.updateNoteDto) === "function" ? _d : Object, Object]),
    __metadata("design:returntype", void 0)
], CourseNotesController.prototype, "updateNote", null);
__decorate([
    (0, common_1.Delete)(':id'),
    (0, swagger_1.ApiOperation)({ summary: '删除笔记' }),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Object]),
    __metadata("design:returntype", void 0)
], CourseNotesController.prototype, "deleteNote", null);
CourseNotesController = __decorate([
    (0, swagger_1.ApiTags)('课堂笔记'),
    (0, swagger_1.ApiBearerAuth)(),
    (0, common_1.Controller)('course-notes'),
    __metadata("design:paramtypes", [typeof (_a = typeof course_notes_service_1.CourseNotesService !== "undefined" && course_notes_service_1.CourseNotesService) === "function" ? _a : Object])
], CourseNotesController);
exports.CourseNotesController = CourseNotesController;


/***/ }),
/* 115 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CourseNotesService = void 0;
const typeorm_1 = __webpack_require__(9);
const typeorm_2 = __webpack_require__(18);
const course_notes_entity_1 = __webpack_require__(113);
let CourseNotesService = class CourseNotesService {
    constructor(CourseNotes_Sql) {
        this.CourseNotes_Sql = CourseNotes_Sql;
    }
    async findNotes(pageInfo, { userId }) {
        const page = pageInfo.page;
        const pageSize = pageInfo.pageSize;
        console.log(userId);
        const res = await this.CourseNotes_Sql.createQueryBuilder('note')
            .where({
            delFlag: 0,
            creator: userId,
        })
            .select(['note.updateTime', 'note.id', 'note.title', 'note.explain'])
            .skip((page - 1) * pageSize)
            .take(pageSize)
            .getManyAndCount();
        return res;
    }
    async findOneNote(id, tokenInfo) {
        const res = await this.CourseNotes_Sql.findOneBy({
            id: id,
            creator: tokenInfo.userId,
        });
        this.CourseNotes_Sql.query(`update course_notes set view_count = view_count + 1  where id = ?
    `, [id]);
        return res;
    }
    async createNote(noteData, tokenData) {
        noteData.creator = tokenData.userId;
        noteData.updater = tokenData.userId;
        const res = await this.CourseNotes_Sql.save(noteData);
        return res;
    }
    async updateNote(id, noteInfo, tokenInfo) {
        let res = await this.CourseNotes_Sql.update(id, Object.assign(Object.assign({}, noteInfo), { updater: tokenInfo.userId }));
        res = this.CourseNotes_Sql.findOneBy({ id });
        return res;
    }
    async deleteNote(id, tokenInfo) {
        const res = await this.CourseNotes_Sql.update(id, {
            delFlag: 1,
            updater: tokenInfo.userId,
        });
        return res;
    }
};
CourseNotesService = __decorate([
    __param(0, (0, typeorm_1.InjectRepository)(course_notes_entity_1.CourseNotes)),
    __metadata("design:paramtypes", [typeof (_a = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _a : Object])
], CourseNotesService);
exports.CourseNotesService = CourseNotesService;


/***/ }),
/* 116 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.updateNoteDto = exports.CourseNotesDto = void 0;
const swagger_1 = __webpack_require__(23);
const class_validator_1 = __webpack_require__(25);
const create_dto_1 = __webpack_require__(39);
class CourseNotesDto extends create_dto_1.CreateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '笔记简介' }),
    (0, class_validator_1.IsNotEmpty)({ message: '笔记简介不可为空' }),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], CourseNotesDto.prototype, "explain", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '笔记简介' }),
    (0, class_validator_1.IsNotEmpty)({ message: '笔记标题不可为空' }),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], CourseNotesDto.prototype, "title", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '笔记内容' }),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], CourseNotesDto.prototype, "content", void 0);
exports.CourseNotesDto = CourseNotesDto;
class updateNoteDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: ' 笔记简介' }),
    __metadata("design:type", String)
], updateNoteDto.prototype, "explain", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '笔记简介' }),
    __metadata("design:type", String)
], updateNoteDto.prototype, "title", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '笔记内容' }),
    __metadata("design:type", String)
], updateNoteDto.prototype, "content", void 0);
exports.updateNoteDto = updateNoteDto;


/***/ }),
/* 117 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.OnlineIssues = void 0;
const increment_id_entity_1 = __webpack_require__(17);
const typeorm_1 = __webpack_require__(18);
let OnlineIssues = class OnlineIssues extends increment_id_entity_1.IncrementIdEntity {
};
__decorate([
    (0, typeorm_1.Column)({ type: global.DB_IS_SQLITE ? 'text' : 'longtext', comment: '问题名称' }),
    __metadata("design:type", String)
], OnlineIssues.prototype, "title", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '问题描述', type: global.DB_IS_SQLITE ? 'text' : 'longtext' }),
    __metadata("design:type", String)
], OnlineIssues.prototype, "content", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '问题简介', type: global.DB_IS_SQLITE ? 'text' : 'longtext' }),
    __metadata("design:type", String)
], OnlineIssues.prototype, "explain", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '问题回复状态', default: 0 }),
    __metadata("design:type", Number)
], OnlineIssues.prototype, "status", void 0);
OnlineIssues = __decorate([
    (0, typeorm_1.Entity)()
], OnlineIssues);
exports.OnlineIssues = OnlineIssues;


/***/ }),
/* 118 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.OnlineIssuesAnswer = void 0;
const increment_id_entity_1 = __webpack_require__(17);
const typeorm_1 = __webpack_require__(18);
let OnlineIssuesAnswer = class OnlineIssuesAnswer extends increment_id_entity_1.IncrementIdEntity {
};
__decorate([
    (0, typeorm_1.Column)({ type: global.DB_IS_SQLITE ? 'text' : 'longtext', name: 'answer_person_id', comment: '解答人ID' }),
    __metadata("design:type", String)
], OnlineIssuesAnswer.prototype, "answerPersonId", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'issues_id', comment: '问题id' }),
    __metadata("design:type", Number)
], OnlineIssuesAnswer.prototype, "issuesId", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: global.DB_IS_SQLITE ? 'text' : 'longtext', comment: '回复内容' }),
    __metadata("design:type", String)
], OnlineIssuesAnswer.prototype, "content", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '是否回复0/1', default: 0 }),
    __metadata("design:type", Number)
], OnlineIssuesAnswer.prototype, "status", void 0);
OnlineIssuesAnswer = __decorate([
    (0, typeorm_1.Entity)()
], OnlineIssuesAnswer);
exports.OnlineIssuesAnswer = OnlineIssuesAnswer;


/***/ }),
/* 119 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b, _c, _d, _e, _f;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.OnlineAnswerController = void 0;
const common_1 = __webpack_require__(2);
const swagger_1 = __webpack_require__(23);
const token_data_decorator_1 = __webpack_require__(37);
const online_issues_service_1 = __webpack_require__(120);
const pagination_dto_1 = __webpack_require__(66);
const online_issues_dto_1 = __webpack_require__(121);
const online_answer_dto_1 = __webpack_require__(122);
let OnlineAnswerController = class OnlineAnswerController {
    constructor(service) {
        this.service = service;
    }
    findMyteacher(tokenInfo) {
        return this.service.findMyteacherStudent(tokenInfo);
    }
    findMyIssuesList(pageInfo, tokenInfo) {
        return this.service.findMyIssues(pageInfo, tokenInfo);
    }
    findMyAnswerList(pageInfo, tokenInfo) {
        return this.service.findMyAnswer(pageInfo, tokenInfo);
    }
    createIssues(issues, tokenInfo) {
        console.log(tokenInfo, 'xxxxxxxxxxxxxxxxxx');
        return this.service.createIssues(issues, tokenInfo);
    }
    editorIssues(issues, tokenInfo) {
        return this.service.editorIssues(issues, tokenInfo);
    }
    answer(issues) {
        return this.service.answer(issues);
    }
    findMyIssuesOne(id, tokenInfo) {
        return this.service.findMyIssuesOne(id, tokenInfo);
    }
};
__decorate([
    (0, common_1.Get)('/myteacher'),
    (0, swagger_1.ApiOperation)({ summary: '根据token获取信息' }),
    __param(0, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object]),
    __metadata("design:returntype", void 0)
], OnlineAnswerController.prototype, "findMyteacher", null);
__decorate([
    (0, common_1.Get)(),
    (0, swagger_1.ApiOperation)({ summary: '获取我的提问列表' }),
    __param(0, (0, common_1.Query)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_b = typeof pagination_dto_1.PaginationDTO !== "undefined" && pagination_dto_1.PaginationDTO) === "function" ? _b : Object, Object]),
    __metadata("design:returntype", void 0)
], OnlineAnswerController.prototype, "findMyIssuesList", null);
__decorate([
    (0, common_1.Get)('/my-answer'),
    (0, swagger_1.ApiOperation)({ summary: '获取我的回答列表' }),
    __param(0, (0, common_1.Query)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_c = typeof pagination_dto_1.PaginationDTO !== "undefined" && pagination_dto_1.PaginationDTO) === "function" ? _c : Object, Object]),
    __metadata("design:returntype", void 0)
], OnlineAnswerController.prototype, "findMyAnswerList", null);
__decorate([
    (0, common_1.Post)(),
    (0, swagger_1.ApiOperation)({ summary: '新建问题' }),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_d = typeof online_issues_dto_1.createIssuesDto !== "undefined" && online_issues_dto_1.createIssuesDto) === "function" ? _d : Object, Object]),
    __metadata("design:returntype", void 0)
], OnlineAnswerController.prototype, "createIssues", null);
__decorate([
    (0, common_1.Post)('update-issues'),
    (0, swagger_1.ApiOperation)({ summary: '编辑问题' }),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_e = typeof online_issues_dto_1.updateIssuesDto !== "undefined" && online_issues_dto_1.updateIssuesDto) === "function" ? _e : Object, Object]),
    __metadata("design:returntype", void 0)
], OnlineAnswerController.prototype, "editorIssues", null);
__decorate([
    (0, common_1.Post)('answer'),
    (0, swagger_1.ApiOperation)({ summary: '回答问题' }),
    __param(0, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_f = typeof online_answer_dto_1.AnswerDto !== "undefined" && online_answer_dto_1.AnswerDto) === "function" ? _f : Object]),
    __metadata("design:returntype", void 0)
], OnlineAnswerController.prototype, "answer", null);
__decorate([
    (0, common_1.Get)(':id'),
    (0, swagger_1.ApiOperation)({ summary: '查询某个问题详情' }),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Object]),
    __metadata("design:returntype", void 0)
], OnlineAnswerController.prototype, "findMyIssuesOne", null);
OnlineAnswerController = __decorate([
    (0, swagger_1.ApiTags)('在线答疑'),
    (0, swagger_1.ApiBearerAuth)(),
    (0, common_1.Controller)('online-issues'),
    __metadata("design:paramtypes", [typeof (_a = typeof online_issues_service_1.OnlineIssuesService !== "undefined" && online_issues_service_1.OnlineIssuesService) === "function" ? _a : Object])
], OnlineAnswerController);
exports.OnlineAnswerController = OnlineAnswerController;


/***/ }),
/* 120 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
var _a, _b, _c, _d;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.OnlineIssuesService = void 0;
const typeorm_1 = __webpack_require__(9);
const typeorm_2 = __webpack_require__(18);
const online_issues_entity_1 = __webpack_require__(117);
const online_answer_entity_1 = __webpack_require__(118);
const user_entity_1 = __webpack_require__(21);
const teacher_student_entity_1 = __webpack_require__(31);
let OnlineIssuesService = class OnlineIssuesService {
    constructor(OnlineIssues_Sql, OnlineIssuesAnswer_Sql, TeacherStudent_Sql, user_Sql) {
        this.OnlineIssues_Sql = OnlineIssues_Sql;
        this.OnlineIssuesAnswer_Sql = OnlineIssuesAnswer_Sql;
        this.TeacherStudent_Sql = TeacherStudent_Sql;
        this.user_Sql = user_Sql;
    }
    async findMyIssues(pageInfo, tokenInfo) {
        const page = pageInfo.page;
        const pageSize = pageInfo.pageSize;
        const res = await this.OnlineIssues_Sql.query(`select oi.id as id,
      oi.title as title,
      oi.content as content,
      oi.status as status,
      oi.explain as \`explain\`,
      DATE_FORMAT(oi.create_time,'%Y/%m/%d') as create_time, 
      uname.aname as answer_person_name from online_issues oi
      left join (
        select oia.issues_id as id,GROUP_CONCAT(u.name) as aname 
        from online_issues_answer oia 
        left join user u on u.id = oia.answer_person_id 
        WHERE oia.del_flag = 0
        group by oia.issues_id
      ) 
      uname on uname.id = oi.id
       where oi.del_flag=0 and oi.creator=? order by oi.id desc limit ?,?
      `, [tokenInfo.userId, +(page - 1) * pageSize, +pageSize]);
        return res;
    }
    async findMyIssuesOne(id, tokenInfo) {
        console.log(id);
        const res = await this.OnlineIssues_Sql.createQueryBuilder('issues')
            .leftJoinAndMapMany('issues.answer', online_answer_entity_1.OnlineIssuesAnswer, 'answer', [`answer.issues_id = issues.id`, `answer.del_flag = 0`].join(' AND '))
            .leftJoinAndMapOne('answer.answer_person', user_entity_1.User, 'user', 'user.id = answer.answer_person_id')
            .leftJoinAndMapOne('issues.teacher', teacher_student_entity_1.TeacherStudent, 'teacher', 'teacher.student = issues.creator')
            .where({
            id,
            creator: tokenInfo.userId,
            delFlag: 0,
        })
            .getOne();
        return res;
    }
    async findMyAnswer(pageInfo, tokenInfo) {
        const page = pageInfo.page;
        const pageSize = pageInfo.pageSize;
        const res = await this.OnlineIssuesAnswer_Sql.query(`SELECT
    DATE_FORMAT(online_issues.create_time,'%Y/%m/%d') AS issuesCreateTime, 
    online_issues.creator, 
    ux.\`name\` AS creatorName, 
    online_issues.id AS issuesId, 
    online_issues.title, 
    online_issues.content, 
    online_issues.\`explain\`, 
    DATE_FORMAT(online_issues_answer.update_time,'%Y/%m/%d') AS answerTime, 
    online_issues_answer.status, 
    online_issues_answer.id,
    online_issues_answer.content AS answerContent, 
    online_issues_answer.id AS answerid, 
    online_issues_answer.answer_person_id, 
    \`user\`.\`name\` AS answerName
  FROM
    online_issues
    INNER JOIN
    online_issues_answer
    ON 
      online_issues.id = online_issues_answer.issues_id
    INNER JOIN
    \`user\`
    ON 
      \`user\`.id = online_issues_answer.answer_person_id
    LEFT JOIN
    \`user\` AS ux
    ON 
      ux.id = online_issues.creator
  WHERE
  online_issues_answer.answer_person_id = ? AND online_issues.del_flag = 0
  ORDER BY
    online_issues_answer.update_time DESC
  LIMIT ?, ?`, [tokenInfo.userId, +(page - 1) * pageSize, +pageSize]);
        return res;
    }
    async createIssues(data, tokenInfo) {
        data.creator = tokenInfo.userId;
        data.updater = tokenInfo.userId;
        const res = await this.OnlineIssues_Sql.save(data);
        const answerList = data.answerPersonIds.map((id) => {
            return {
                answerPersonId: id,
                issuesId: res.id,
                content: '',
                creator: tokenInfo.userId,
                updater: tokenInfo.userId,
            };
        });
        await this.OnlineIssuesAnswer_Sql.save(answerList);
        return res;
    }
    async editorIssues(data, tokenInfo) {
        data.updater = tokenInfo.userId;
        const res = await this.OnlineIssues_Sql.save(data);
        console.log(res);
        const answers = await this.OnlineIssuesAnswer_Sql.find({
            where: { answerPersonId: (0, typeorm_2.In)(data.answerPersonIds), issuesId: data.id },
        });
        const needAdd = [];
        data.answerPersonIds.forEach((id) => {
            const index = answers.findIndex((ans) => {
                if (ans.answerPersonId == id) {
                    return true;
                }
                return false;
            });
            if (index == -1) {
                needAdd.push({
                    creator: tokenInfo.userId,
                    updater: tokenInfo.userId,
                    answerPersonId: id,
                    issuesId: data.id,
                    content: '',
                });
            }
            else {
                answers[index].delFlag = 0;
                needAdd.push(answers[index]);
            }
        });
        await this.OnlineIssuesAnswer_Sql.save(needAdd);
        await this.OnlineIssuesAnswer_Sql.query(`update online_issues_answer oia set del_flag=1 where oia.answer_person_id in (${"'" + data.delAnswerPersonIds.join("','") + "'"}) and issues_id=${data.id} and oia.del_flag=0`);
        return res;
    }
    async answer(_a) {
        var { issuesId } = _a, data = __rest(_a, ["issuesId"]);
        this.OnlineIssues_Sql.update({ id: issuesId }, { status: 1 });
        const res = await this.OnlineIssuesAnswer_Sql.update({
            id: data.id,
        }, {
            status: 1,
            content: data.content,
        });
        return res;
    }
    async findMyteacherStudent(tokenInfo) {
        const info = await this.TeacherStudent_Sql.findOneBy({
            student: tokenInfo.userId,
        });
        let idList = [];
        console.log(info);
        if (info) {
            const infoList = await this.TeacherStudent_Sql.findBy({
                teacher: info.teacher,
            });
            idList = infoList.map((info) => info.student);
        }
        const res = await this.user_Sql.find({
            where: { id: (0, typeorm_2.In)(idList) },
        });
        return res;
    }
};
OnlineIssuesService = __decorate([
    __param(0, (0, typeorm_1.InjectRepository)(online_issues_entity_1.OnlineIssues)),
    __param(1, (0, typeorm_1.InjectRepository)(online_answer_entity_1.OnlineIssuesAnswer)),
    __param(2, (0, typeorm_1.InjectRepository)(teacher_student_entity_1.TeacherStudent)),
    __param(3, (0, typeorm_1.InjectRepository)(user_entity_1.User)),
    __metadata("design:paramtypes", [typeof (_a = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _a : Object, typeof (_b = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _b : Object, typeof (_c = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _c : Object, typeof (_d = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _d : Object])
], OnlineIssuesService);
exports.OnlineIssuesService = OnlineIssuesService;


/***/ }),
/* 121 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.updateIssuesDto = exports.createIssuesDto = void 0;
const swagger_1 = __webpack_require__(23);
const class_validator_1 = __webpack_require__(25);
const create_dto_1 = __webpack_require__(39);
class createIssuesDto extends create_dto_1.CreateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '问题名称' }),
    (0, class_validator_1.IsNotEmpty)({ message: '问题名称不可为空' }),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], createIssuesDto.prototype, "title", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '问题描述' }),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], createIssuesDto.prototype, "content", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '问题描述' }),
    __metadata("design:type", Array)
], createIssuesDto.prototype, "answerPersonIds", void 0);
exports.createIssuesDto = createIssuesDto;
class updateIssuesDto extends create_dto_1.CreateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '问题ID' }),
    __metadata("design:type", Number)
], updateIssuesDto.prototype, "id", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '问题名称' }),
    __metadata("design:type", String)
], updateIssuesDto.prototype, "title", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '问题描述' }),
    __metadata("design:type", String)
], updateIssuesDto.prototype, "content", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '解答人ID数组' }),
    __metadata("design:type", Array)
], updateIssuesDto.prototype, "answerPersonIds", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '删除掉的解答人ID数组' }),
    __metadata("design:type", Array)
], updateIssuesDto.prototype, "delAnswerPersonIds", void 0);
exports.updateIssuesDto = updateIssuesDto;


/***/ }),
/* 122 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.AnswerDto = void 0;
const swagger_1 = __webpack_require__(23);
const class_validator_1 = __webpack_require__(25);
const create_dto_1 = __webpack_require__(39);
class AnswerDto extends create_dto_1.CreateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '当前回答ID' }),
    (0, class_validator_1.IsNotEmpty)({ message: '当前回答ID不可为空' }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", Number)
], AnswerDto.prototype, "id", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '当前问题ID' }),
    (0, class_validator_1.IsNotEmpty)({ message: '当前问题ID不可为空' }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", Number)
], AnswerDto.prototype, "issuesId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '回复内容' }),
    (0, class_validator_1.IsNotEmpty)({ message: '回复内容不可为空' }),
    __metadata("design:type", String)
], AnswerDto.prototype, "content", void 0);
exports.AnswerDto = AnswerDto;


/***/ }),
/* 123 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.AssessmentEvaluationModule = void 0;
const common_1 = __webpack_require__(2);
const assessment_evaluation_service_1 = __webpack_require__(124);
const assessment_evaluation_controller_1 = __webpack_require__(126);
const typeorm_1 = __webpack_require__(9);
const question_manager_modules_1 = __webpack_require__(127);
const exam_paper_manager_modules_1 = __webpack_require__(151);
const exam_manager_modules_1 = __webpack_require__(163);
let AssessmentEvaluationModule = class AssessmentEvaluationModule {
};
AssessmentEvaluationModule = __decorate([
    (0, common_1.Module)({
        imports: [
            typeorm_1.TypeOrmModule.forFeature([
                ...question_manager_modules_1.default.entitis,
                ...exam_paper_manager_modules_1.default.entitis,
                ...exam_manager_modules_1.default.entitis,
            ]),
        ],
        controllers: [
            assessment_evaluation_controller_1.AssessmentEvaluationController,
            ...question_manager_modules_1.default.controllers,
            ...exam_paper_manager_modules_1.default.controllers,
            ...exam_manager_modules_1.default.controllers,
        ],
        providers: [
            assessment_evaluation_service_1.AssessmentEvaluationService,
            ...question_manager_modules_1.default.services,
            ...exam_paper_manager_modules_1.default.services,
            ...exam_manager_modules_1.default.services,
        ],
    })
], AssessmentEvaluationModule);
exports.AssessmentEvaluationModule = AssessmentEvaluationModule;


/***/ }),
/* 124 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.AssessmentEvaluationService = void 0;
const common_1 = __webpack_require__(2);
const typeorm_1 = __webpack_require__(9);
const typeorm_2 = __webpack_require__(18);
const question_difficulty_level_entity_1 = __webpack_require__(125);
const question_type_entity_1 = __webpack_require__(79);
let AssessmentEvaluationService = class AssessmentEvaluationService {
    constructor(questionTypeRepository, questionDifficultyLevelRepository) {
        this.questionTypeRepository = questionTypeRepository;
        this.questionDifficultyLevelRepository = questionDifficultyLevelRepository;
    }
    create(createAssessmentEvaluationDto) {
        return 'This action adds a new assessmentEvaluation';
    }
    findAll() {
        return `This action returns all assessmentEvaluation`;
    }
    findOne(id) {
        return `This action returns a #${id} assessmentEvaluation`;
    }
    update(id, updateAssessmentEvaluationDto) {
        return `This action updates a #${id} assessmentEvaluation`;
    }
    remove(id) {
        return `This action removes a #${id} assessmentEvaluation`;
    }
};
AssessmentEvaluationService = __decorate([
    (0, common_1.Injectable)(),
    __param(0, (0, typeorm_1.InjectRepository)(question_type_entity_1.QuestionType)),
    __param(1, (0, typeorm_1.InjectRepository)(question_difficulty_level_entity_1.QuestionDifficultyLevel)),
    __metadata("design:paramtypes", [typeof (_a = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _a : Object, typeof (_b = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _b : Object])
], AssessmentEvaluationService);
exports.AssessmentEvaluationService = AssessmentEvaluationService;


/***/ }),
/* 125 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.QuestionDifficultyLevel = void 0;
const increment_id_entity_1 = __webpack_require__(17);
const typeorm_1 = __webpack_require__(18);
let QuestionDifficultyLevel = class QuestionDifficultyLevel extends increment_id_entity_1.IncrementIdEntity {
};
__decorate([
    (0, typeorm_1.Column)({ comment: '类型名（单选多选判断填空简答）' }),
    __metadata("design:type", String)
], QuestionDifficultyLevel.prototype, "name", void 0);
QuestionDifficultyLevel = __decorate([
    (0, typeorm_1.Entity)()
], QuestionDifficultyLevel);
exports.QuestionDifficultyLevel = QuestionDifficultyLevel;


/***/ }),
/* 126 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var _a;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.AssessmentEvaluationController = void 0;
const common_1 = __webpack_require__(2);
const swagger_1 = __webpack_require__(23);
const assessment_evaluation_service_1 = __webpack_require__(124);
let AssessmentEvaluationController = class AssessmentEvaluationController {
    constructor(assessmentEvaluationService) {
        this.assessmentEvaluationService = assessmentEvaluationService;
    }
};
AssessmentEvaluationController = __decorate([
    (0, swagger_1.ApiTags)('考核测评 - 主功能'),
    (0, swagger_1.ApiBearerAuth)(),
    (0, common_1.Controller)('assessmentEvaluation'),
    __metadata("design:paramtypes", [typeof (_a = typeof assessment_evaluation_service_1.AssessmentEvaluationService !== "undefined" && assessment_evaluation_service_1.AssessmentEvaluationService) === "function" ? _a : Object])
], AssessmentEvaluationController);
exports.AssessmentEvaluationController = AssessmentEvaluationController;


/***/ }),
/* 127 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

"use strict";

Object.defineProperty(exports, "__esModule", ({ value: true }));
const question_classify_entity_1 = __webpack_require__(128);
const question_classify_controller_1 = __webpack_require__(129);
const knowledge_point_entity_1 = __webpack_require__(133);
const question_type_entity_1 = __webpack_require__(79);
const question_difficulty_level_entity_1 = __webpack_require__(125);
const question_entity_1 = __webpack_require__(56);
const knowledge_point_service_1 = __webpack_require__(134);
const knowledge_point_controller_1 = __webpack_require__(135);
const question_type_controller_1 = __webpack_require__(138);
const question_difficulty_level_controller_1 = __webpack_require__(141);
const question_controller_1 = __webpack_require__(145);
const question_type_service_1 = __webpack_require__(78);
const question_classify_service_1 = __webpack_require__(132);
const question_difficulty_level_service_1 = __webpack_require__(144);
const question_service_1 = __webpack_require__(149);
exports["default"] = {
    entitis: [
        question_classify_entity_1.QuestionClassify,
        question_entity_1.Question,
        knowledge_point_entity_1.KnowledgePoint,
        question_type_entity_1.QuestionType,
        question_difficulty_level_entity_1.QuestionDifficultyLevel,
        question_difficulty_level_entity_1.QuestionDifficultyLevel,
    ],
    controllers: [
        question_controller_1.QuestionController,
        question_classify_controller_1.QuestionClassifyController,
        knowledge_point_controller_1.KnowledgePointController,
        question_type_controller_1.QuestionTypeController,
        question_difficulty_level_controller_1.QuestionDifficultyLevelController,
    ],
    services: [
        question_classify_service_1.QuestionClassifyService,
        knowledge_point_service_1.KnowledgePointService,
        question_type_service_1.QuestionTypeService,
        question_difficulty_level_service_1.QuestionDifficultyLevelService,
        question_service_1.QuestionService,
    ],
};


/***/ }),
/* 128 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.QuestionClassify = void 0;
const increment_id_entity_1 = __webpack_require__(17);
const typeorm_1 = __webpack_require__(18);
let QuestionClassify = class QuestionClassify extends increment_id_entity_1.IncrementIdEntity {
};
__decorate([
    (0, typeorm_1.Column)({ comment: '分类名' }),
    __metadata("design:type", String)
], QuestionClassify.prototype, "name", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '父类id', default: 0 }),
    __metadata("design:type", Number)
], QuestionClassify.prototype, "pid", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '层级', default: 1 }),
    __metadata("design:type", Number)
], QuestionClassify.prototype, "level", void 0);
QuestionClassify = __decorate([
    (0, typeorm_1.Entity)()
], QuestionClassify);
exports.QuestionClassify = QuestionClassify;


/***/ }),
/* 129 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b, _c;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.QuestionClassifyController = void 0;
const common_1 = __webpack_require__(2);
const swagger_1 = __webpack_require__(23);
const token_data_decorator_1 = __webpack_require__(37);
const create_question_classify_dto_1 = __webpack_require__(130);
const update_question_classify_dto_1 = __webpack_require__(131);
const question_classify_service_1 = __webpack_require__(132);
let QuestionClassifyController = class QuestionClassifyController {
    constructor(questionClassifyService) {
        this.questionClassifyService = questionClassifyService;
    }
    async create(createQuestionClassifyDto, token) {
        createQuestionClassifyDto.creator = createQuestionClassifyDto.updater =
            token.userId;
        return this.questionClassifyService.create(createQuestionClassifyDto);
    }
    async findAll() {
        return this.questionClassifyService.findAll();
    }
    async update(id, updateQuestionClassifyDto) {
        return this.questionClassifyService.update(+id, updateQuestionClassifyDto);
    }
    async remove(id) {
        return this.questionClassifyService.remove(+id);
    }
};
__decorate([
    (0, common_1.Post)(),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_b = typeof create_question_classify_dto_1.CreateQuestionClassifyDto !== "undefined" && create_question_classify_dto_1.CreateQuestionClassifyDto) === "function" ? _b : Object, Object]),
    __metadata("design:returntype", Promise)
], QuestionClassifyController.prototype, "create", null);
__decorate([
    (0, common_1.Get)(),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Promise)
], QuestionClassifyController.prototype, "findAll", null);
__decorate([
    (0, common_1.Patch)(':id'),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, typeof (_c = typeof update_question_classify_dto_1.UpdateQuestionClassifyDto !== "undefined" && update_question_classify_dto_1.UpdateQuestionClassifyDto) === "function" ? _c : Object]),
    __metadata("design:returntype", Promise)
], QuestionClassifyController.prototype, "update", null);
__decorate([
    (0, common_1.Delete)(':id'),
    __param(0, (0, common_1.Param)('id')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], QuestionClassifyController.prototype, "remove", null);
QuestionClassifyController = __decorate([
    (0, swagger_1.ApiTags)('试题管理 - 试题分类'),
    (0, swagger_1.ApiBearerAuth)(),
    (0, common_1.Controller)('assessmentEvaluation/questionClassify'),
    __metadata("design:paramtypes", [typeof (_a = typeof question_classify_service_1.QuestionClassifyService !== "undefined" && question_classify_service_1.QuestionClassifyService) === "function" ? _a : Object])
], QuestionClassifyController);
exports.QuestionClassifyController = QuestionClassifyController;


/***/ }),
/* 130 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CreateQuestionClassifyDto = void 0;
const swagger_1 = __webpack_require__(23);
const class_validator_1 = __webpack_require__(25);
const create_dto_1 = __webpack_require__(39);
class CreateQuestionClassifyDto extends create_dto_1.CreateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试题分类名' }),
    (0, class_validator_1.IsNotEmpty)({ message: '试题分类名不能为空' }),
    __metadata("design:type", String)
], CreateQuestionClassifyDto.prototype, "name", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '上级试题分类', default: 0 }),
    (0, class_validator_1.IsNotEmpty)({ message: '上级试题分类不能为空' }),
    __metadata("design:type", Number)
], CreateQuestionClassifyDto.prototype, "pid", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试题分类层级', default: 1 }),
    (0, class_validator_1.IsNotEmpty)({ message: '层级不能为空' }),
    __metadata("design:type", Number)
], CreateQuestionClassifyDto.prototype, "level", void 0);
exports.CreateQuestionClassifyDto = CreateQuestionClassifyDto;


/***/ }),
/* 131 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.UpdateQuestionClassifyDto = void 0;
const swagger_1 = __webpack_require__(23);
const create_dto_1 = __webpack_require__(39);
class UpdateQuestionClassifyDto extends create_dto_1.CreateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试卷分类名' }),
    __metadata("design:type", String)
], UpdateQuestionClassifyDto.prototype, "name", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '上级试题分类', default: 0 }),
    __metadata("design:type", Number)
], UpdateQuestionClassifyDto.prototype, "pid", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试题分类层级', default: 1 }),
    __metadata("design:type", Number)
], UpdateQuestionClassifyDto.prototype, "level", void 0);
exports.UpdateQuestionClassifyDto = UpdateQuestionClassifyDto;


/***/ }),
/* 132 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.QuestionClassifyService = void 0;
const common_1 = __webpack_require__(2);
const typeorm_1 = __webpack_require__(9);
const typeorm_2 = __webpack_require__(18);
const question_classify_entity_1 = __webpack_require__(128);
let QuestionClassifyService = class QuestionClassifyService {
    constructor(questionClassifyRepository) {
        this.questionClassifyRepository = questionClassifyRepository;
    }
    async create(createQuestionClassifyDto) {
        await this.questionClassifyRepository.insert(createQuestionClassifyDto);
        return true;
    }
    async findAll() {
        return this.questionClassifyRepository.find({
            select: ['id', 'name', 'pid', 'level'],
            where: { delFlag: 0 },
        });
    }
    async update(id, updateQuestionClassifyDto) {
        return this.questionClassifyRepository.update(id, updateQuestionClassifyDto);
    }
    async remove(id) {
        if (isNaN(+id) || !id)
            throw '缺少id';
        await this.questionClassifyRepository.update(id, { delFlag: 1 });
        const children = await this.questionClassifyRepository.find({
            where: { pid: id },
        });
        for (let index = 0; index < children.length; index++) {
            const element = children[index];
            await this.remove(element.id);
        }
        return true;
    }
};
QuestionClassifyService = __decorate([
    (0, common_1.Injectable)(),
    __param(0, (0, typeorm_1.InjectRepository)(question_classify_entity_1.QuestionClassify)),
    __metadata("design:paramtypes", [typeof (_a = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _a : Object])
], QuestionClassifyService);
exports.QuestionClassifyService = QuestionClassifyService;


/***/ }),
/* 133 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.KnowledgePoint = void 0;
const increment_id_entity_1 = __webpack_require__(17);
const typeorm_1 = __webpack_require__(18);
let KnowledgePoint = class KnowledgePoint extends increment_id_entity_1.IncrementIdEntity {
};
__decorate([
    (0, typeorm_1.Column)({ comment: '知识点' }),
    __metadata("design:type", String)
], KnowledgePoint.prototype, "name", void 0);
KnowledgePoint = __decorate([
    (0, typeorm_1.Entity)()
], KnowledgePoint);
exports.KnowledgePoint = KnowledgePoint;


/***/ }),
/* 134 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.KnowledgePointService = void 0;
const common_1 = __webpack_require__(2);
const typeorm_1 = __webpack_require__(9);
const typeorm_2 = __webpack_require__(18);
const knowledge_point_entity_1 = __webpack_require__(133);
let KnowledgePointService = class KnowledgePointService {
    constructor(knowledgePointRepository) {
        this.knowledgePointRepository = knowledgePointRepository;
    }
    async create(createKnowledgePointDto) {
        const knowledgeItem = await this.knowledgePointRepository.findOne({
            where: { name: createKnowledgePointDto.name, delFlag: 0 },
        });
        if (!knowledgeItem) {
            return await this.knowledgePointRepository.save(createKnowledgePointDto);
        }
        return knowledgeItem;
    }
    async findAll() {
        return this.knowledgePointRepository.find({
            select: ['id', 'name'],
            where: { delFlag: 0 },
        });
    }
    async update(id, updateKnowledgePointDto) {
        return this.knowledgePointRepository.update(id, updateKnowledgePointDto);
    }
    async remove(id) {
        await this.knowledgePointRepository.update(id, { delFlag: 1 });
        return true;
    }
};
KnowledgePointService = __decorate([
    (0, common_1.Injectable)(),
    __param(0, (0, typeorm_1.InjectRepository)(knowledge_point_entity_1.KnowledgePoint)),
    __metadata("design:paramtypes", [typeof (_a = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _a : Object])
], KnowledgePointService);
exports.KnowledgePointService = KnowledgePointService;


/***/ }),
/* 135 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b, _c;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.KnowledgePointController = void 0;
const common_1 = __webpack_require__(2);
const swagger_1 = __webpack_require__(23);
const token_data_decorator_1 = __webpack_require__(37);
const create_knowledge_point_dto_1 = __webpack_require__(136);
const update_knowledge_point_dto_1 = __webpack_require__(137);
const knowledge_point_service_1 = __webpack_require__(134);
let KnowledgePointController = class KnowledgePointController {
    constructor(KnowledgePointService) {
        this.KnowledgePointService = KnowledgePointService;
    }
    async create(createKnowledgePointDto, token) {
        createKnowledgePointDto.creator = createKnowledgePointDto.updater =
            token.userId;
        return this.KnowledgePointService.create(createKnowledgePointDto);
    }
    async findAll() {
        return this.KnowledgePointService.findAll();
    }
    async update(id, updateKnowledgePointDto) {
        return this.KnowledgePointService.update(+id, updateKnowledgePointDto);
    }
    async remove(id) {
        return this.KnowledgePointService.remove(+id);
    }
};
__decorate([
    (0, common_1.Post)(),
    (0, swagger_1.ApiOperation)({
        summary: '新增知识点，会查询知识点是否存在，存在返回旧值，不存在返回新值',
    }),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_b = typeof create_knowledge_point_dto_1.CreateKnowledgePointDto !== "undefined" && create_knowledge_point_dto_1.CreateKnowledgePointDto) === "function" ? _b : Object, Object]),
    __metadata("design:returntype", Promise)
], KnowledgePointController.prototype, "create", null);
__decorate([
    (0, common_1.Get)(),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Promise)
], KnowledgePointController.prototype, "findAll", null);
__decorate([
    (0, common_1.Patch)(':id'),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, typeof (_c = typeof update_knowledge_point_dto_1.UpdateKnowledgePointDto !== "undefined" && update_knowledge_point_dto_1.UpdateKnowledgePointDto) === "function" ? _c : Object]),
    __metadata("design:returntype", Promise)
], KnowledgePointController.prototype, "update", null);
__decorate([
    (0, common_1.Delete)(':id'),
    __param(0, (0, common_1.Param)('id')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], KnowledgePointController.prototype, "remove", null);
KnowledgePointController = __decorate([
    (0, swagger_1.ApiTags)('试题管理 - 知识点管理'),
    (0, swagger_1.ApiBearerAuth)(),
    (0, common_1.Controller)('assessmentEvaluation/knowledgePoint'),
    __metadata("design:paramtypes", [typeof (_a = typeof knowledge_point_service_1.KnowledgePointService !== "undefined" && knowledge_point_service_1.KnowledgePointService) === "function" ? _a : Object])
], KnowledgePointController);
exports.KnowledgePointController = KnowledgePointController;


/***/ }),
/* 136 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CreateKnowledgePointDto = void 0;
const swagger_1 = __webpack_require__(23);
const class_validator_1 = __webpack_require__(25);
const create_dto_1 = __webpack_require__(39);
class CreateKnowledgePointDto extends create_dto_1.CreateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '知识点名' }),
    (0, class_validator_1.IsNotEmpty)({ message: '知识点名不能为空' }),
    __metadata("design:type", String)
], CreateKnowledgePointDto.prototype, "name", void 0);
exports.CreateKnowledgePointDto = CreateKnowledgePointDto;


/***/ }),
/* 137 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.UpdateKnowledgePointDto = void 0;
const swagger_1 = __webpack_require__(23);
const class_validator_1 = __webpack_require__(25);
const create_dto_1 = __webpack_require__(39);
class UpdateKnowledgePointDto extends create_dto_1.CreateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '知识点ID' }),
    (0, class_validator_1.IsNotEmpty)({ message: '知识点ID不能为空' }),
    __metadata("design:type", Number)
], UpdateKnowledgePointDto.prototype, "id", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '知识点名' }),
    (0, class_validator_1.IsNotEmpty)({ message: '知识点名不能为空' }),
    __metadata("design:type", String)
], UpdateKnowledgePointDto.prototype, "name", void 0);
exports.UpdateKnowledgePointDto = UpdateKnowledgePointDto;


/***/ }),
/* 138 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b, _c;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.QuestionTypeController = void 0;
const common_1 = __webpack_require__(2);
const swagger_1 = __webpack_require__(23);
const token_data_decorator_1 = __webpack_require__(37);
const create_question_type_dto_1 = __webpack_require__(139);
const update_question_type_dto_1 = __webpack_require__(140);
const question_type_service_1 = __webpack_require__(78);
let QuestionTypeController = class QuestionTypeController {
    constructor(QuestionTypeService) {
        this.QuestionTypeService = QuestionTypeService;
    }
    async create(createQuestionTypeDto, token) {
        createQuestionTypeDto.creator = createQuestionTypeDto.updater =
            token.userId;
        return this.QuestionTypeService.create(createQuestionTypeDto);
    }
    async findAll() {
        return this.QuestionTypeService.findAll();
    }
    async update(id, updateQuestionTypeDto) {
        return this.QuestionTypeService.update(+id, updateQuestionTypeDto);
    }
    async remove(id) {
        return this.QuestionTypeService.remove(+id);
    }
};
__decorate([
    (0, common_1.Post)(),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_b = typeof create_question_type_dto_1.CreateQuestionTypeDto !== "undefined" && create_question_type_dto_1.CreateQuestionTypeDto) === "function" ? _b : Object, Object]),
    __metadata("design:returntype", Promise)
], QuestionTypeController.prototype, "create", null);
__decorate([
    (0, common_1.Get)(),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Promise)
], QuestionTypeController.prototype, "findAll", null);
__decorate([
    (0, common_1.Patch)(':id'),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, typeof (_c = typeof update_question_type_dto_1.UpdateQuestionTypeDto !== "undefined" && update_question_type_dto_1.UpdateQuestionTypeDto) === "function" ? _c : Object]),
    __metadata("design:returntype", Promise)
], QuestionTypeController.prototype, "update", null);
__decorate([
    (0, common_1.Delete)(':id'),
    __param(0, (0, common_1.Param)('id')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], QuestionTypeController.prototype, "remove", null);
QuestionTypeController = __decorate([
    (0, swagger_1.ApiTags)('试题管理 - 试题类型'),
    (0, swagger_1.ApiBearerAuth)(),
    (0, common_1.Controller)('assessmentEvaluation/questionType'),
    __metadata("design:paramtypes", [typeof (_a = typeof question_type_service_1.QuestionTypeService !== "undefined" && question_type_service_1.QuestionTypeService) === "function" ? _a : Object])
], QuestionTypeController);
exports.QuestionTypeController = QuestionTypeController;


/***/ }),
/* 139 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CreateQuestionTypeDto = void 0;
const swagger_1 = __webpack_require__(23);
const class_validator_1 = __webpack_require__(25);
const create_dto_1 = __webpack_require__(39);
class CreateQuestionTypeDto extends create_dto_1.CreateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试题类型' }),
    (0, class_validator_1.IsNotEmpty)({ message: '试题类型名不能为空' }),
    __metadata("design:type", String)
], CreateQuestionTypeDto.prototype, "name", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '元素类型' }),
    __metadata("design:type", String)
], CreateQuestionTypeDto.prototype, "element", void 0);
exports.CreateQuestionTypeDto = CreateQuestionTypeDto;


/***/ }),
/* 140 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.UpdateQuestionTypeDto = void 0;
const swagger_1 = __webpack_require__(23);
const class_validator_1 = __webpack_require__(25);
const create_dto_1 = __webpack_require__(39);
class UpdateQuestionTypeDto extends create_dto_1.CreateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试题类型Id' }),
    (0, class_validator_1.IsNotEmpty)({ message: '试题类型ID不能为空' }),
    __metadata("design:type", Number)
], UpdateQuestionTypeDto.prototype, "id", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试题类型名' }),
    (0, class_validator_1.IsNotEmpty)({ message: '试题类型名不能为空' }),
    __metadata("design:type", String)
], UpdateQuestionTypeDto.prototype, "name", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '元素类型' }),
    __metadata("design:type", String)
], UpdateQuestionTypeDto.prototype, "element", void 0);
exports.UpdateQuestionTypeDto = UpdateQuestionTypeDto;


/***/ }),
/* 141 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b, _c;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.QuestionDifficultyLevelController = void 0;
const common_1 = __webpack_require__(2);
const swagger_1 = __webpack_require__(23);
const token_data_decorator_1 = __webpack_require__(37);
const create_question_difficulty_level_dto_1 = __webpack_require__(142);
const update_question_difficulty_level_dto_1 = __webpack_require__(143);
const question_difficulty_level_service_1 = __webpack_require__(144);
let QuestionDifficultyLevelController = class QuestionDifficultyLevelController {
    constructor(questionDifficultyLevelService) {
        this.questionDifficultyLevelService = questionDifficultyLevelService;
    }
    async create(createquestionDifficultyLevelDto, token) {
        createquestionDifficultyLevelDto.creator =
            createquestionDifficultyLevelDto.updater = token.userId;
        return this.questionDifficultyLevelService.create(createquestionDifficultyLevelDto);
    }
    async findAll() {
        return this.questionDifficultyLevelService.findAll();
    }
    async update(id, updatequestionDifficultyLevelDto) {
        return this.questionDifficultyLevelService.update(+id, updatequestionDifficultyLevelDto);
    }
    async remove(id) {
        return this.questionDifficultyLevelService.remove(+id);
    }
};
__decorate([
    (0, common_1.Post)(),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_b = typeof create_question_difficulty_level_dto_1.CreateQuestionDifficultyLevelDto !== "undefined" && create_question_difficulty_level_dto_1.CreateQuestionDifficultyLevelDto) === "function" ? _b : Object, Object]),
    __metadata("design:returntype", Promise)
], QuestionDifficultyLevelController.prototype, "create", null);
__decorate([
    (0, common_1.Get)(),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Promise)
], QuestionDifficultyLevelController.prototype, "findAll", null);
__decorate([
    (0, common_1.Patch)(':id'),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, typeof (_c = typeof update_question_difficulty_level_dto_1.UpdateQuestionDifficultyLevelDto !== "undefined" && update_question_difficulty_level_dto_1.UpdateQuestionDifficultyLevelDto) === "function" ? _c : Object]),
    __metadata("design:returntype", Promise)
], QuestionDifficultyLevelController.prototype, "update", null);
__decorate([
    (0, common_1.Delete)(':id'),
    __param(0, (0, common_1.Param)('id')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], QuestionDifficultyLevelController.prototype, "remove", null);
QuestionDifficultyLevelController = __decorate([
    (0, swagger_1.ApiTags)('试题管理 - 难易程度'),
    (0, swagger_1.ApiBearerAuth)(),
    (0, common_1.Controller)('assessmentEvaluation/questionDifficultyLevel'),
    __metadata("design:paramtypes", [typeof (_a = typeof question_difficulty_level_service_1.QuestionDifficultyLevelService !== "undefined" && question_difficulty_level_service_1.QuestionDifficultyLevelService) === "function" ? _a : Object])
], QuestionDifficultyLevelController);
exports.QuestionDifficultyLevelController = QuestionDifficultyLevelController;


/***/ }),
/* 142 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CreateQuestionDifficultyLevelDto = void 0;
const swagger_1 = __webpack_require__(23);
const class_validator_1 = __webpack_require__(25);
const create_dto_1 = __webpack_require__(39);
class CreateQuestionDifficultyLevelDto extends create_dto_1.CreateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '难易程度名' }),
    (0, class_validator_1.IsNotEmpty)({ message: '难易程度名不能为空' }),
    __metadata("design:type", String)
], CreateQuestionDifficultyLevelDto.prototype, "name", void 0);
exports.CreateQuestionDifficultyLevelDto = CreateQuestionDifficultyLevelDto;


/***/ }),
/* 143 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.UpdateQuestionDifficultyLevelDto = void 0;
const swagger_1 = __webpack_require__(23);
const class_validator_1 = __webpack_require__(25);
const create_dto_1 = __webpack_require__(39);
class UpdateQuestionDifficultyLevelDto extends create_dto_1.CreateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '难易程度Id' }),
    (0, class_validator_1.IsNotEmpty)({ message: '难易程度ID不能为空' }),
    __metadata("design:type", Number)
], UpdateQuestionDifficultyLevelDto.prototype, "id", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '难易程度名' }),
    (0, class_validator_1.IsNotEmpty)({ message: '难易程度名不能为空' }),
    __metadata("design:type", String)
], UpdateQuestionDifficultyLevelDto.prototype, "name", void 0);
exports.UpdateQuestionDifficultyLevelDto = UpdateQuestionDifficultyLevelDto;


/***/ }),
/* 144 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.QuestionDifficultyLevelService = void 0;
const common_1 = __webpack_require__(2);
const typeorm_1 = __webpack_require__(9);
const typeorm_2 = __webpack_require__(18);
const question_difficulty_level_entity_1 = __webpack_require__(125);
let QuestionDifficultyLevelService = class QuestionDifficultyLevelService {
    constructor(questionDifficultyLevelRepository) {
        this.questionDifficultyLevelRepository = questionDifficultyLevelRepository;
    }
    async create(createQuestionDifficultyLevelDto) {
        if (await this.questionDifficultyLevelRepository.findOne({
            where: { delFlag: 0, name: createQuestionDifficultyLevelDto.name },
        })) {
            throw '难易程度已存在';
        }
        return await this.questionDifficultyLevelRepository.save(createQuestionDifficultyLevelDto);
    }
    async findAll() {
        return this.questionDifficultyLevelRepository.find({
            select: ['id', 'name'],
            where: { delFlag: 0 },
        });
    }
    async update(id, updateQuestionDifficultyLevelDto) {
        return this.questionDifficultyLevelRepository.update(id, updateQuestionDifficultyLevelDto);
    }
    async remove(id) {
        await this.questionDifficultyLevelRepository.update(id, { delFlag: 1 });
        return true;
    }
};
QuestionDifficultyLevelService = __decorate([
    (0, common_1.Injectable)(),
    __param(0, (0, typeorm_1.InjectRepository)(question_difficulty_level_entity_1.QuestionDifficultyLevel)),
    __metadata("design:paramtypes", [typeof (_a = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _a : Object])
], QuestionDifficultyLevelService);
exports.QuestionDifficultyLevelService = QuestionDifficultyLevelService;


/***/ }),
/* 145 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.QuestionController = void 0;
const common_1 = __webpack_require__(2);
const swagger_1 = __webpack_require__(23);
const no_token_decorator_1 = __webpack_require__(26);
const token_data_decorator_1 = __webpack_require__(37);
const create_question_dto_1 = __webpack_require__(146);
const paging_question_dto_1 = __webpack_require__(147);
const update_question_dto_1 = __webpack_require__(148);
const question_difficulty_level_service_1 = __webpack_require__(144);
const question_type_service_1 = __webpack_require__(78);
const question_service_1 = __webpack_require__(149);
const get_question_count_dto_1 = __webpack_require__(150);
const knowledge_point_service_1 = __webpack_require__(134);
let QuestionController = class QuestionController {
    constructor(QuestionService, QuestionDifficultyLevelService, QuestionTypeService, KnowledgePointService) {
        this.QuestionService = QuestionService;
        this.QuestionDifficultyLevelService = QuestionDifficultyLevelService;
        this.QuestionTypeService = QuestionTypeService;
        this.KnowledgePointService = KnowledgePointService;
    }
    async create(createQuestionDto, token) {
        createQuestionDto.creator = createQuestionDto.updater = token.userId;
        return this.QuestionService.create(createQuestionDto);
    }
    async importQuestions(classifyId, questions, token) {
        const difficultys = await this.QuestionDifficultyLevelService.findAll();
        const types = await this.QuestionTypeService.findAll();
        const formatedQuestion = [];
        for (let ind = 0; ind < questions.length; ind++) {
            const item = questions[ind];
            const type = types.find((t) => t.name === item.type);
            const difficulty = difficultys.find((d) => d.name === item.difficulty);
            let knowledge = null;
            if (item.knowledge && item.knowledge.trim() !== '') {
                knowledge = await this.KnowledgePointService.create({
                    name: item.knowledge,
                    creator: token.userId,
                    updater: token.userId,
                });
            }
            const queTemp = {
                type: type.id,
                difficultyLevel: difficulty.id,
                classifyId,
                title: item.title,
                options: item.options,
                answer: item.answer,
                knowledgeId: knowledge ? knowledge.id : null,
                analysis: item.analysis,
                creator: token.userId,
                updater: token.userId,
                student: 0,
            };
            formatedQuestion.push(queTemp);
        }
        return await this.QuestionService.importQuestions(formatedQuestion);
    }
    async random(getQuestionCountDto) {
        console.log('===================>', getQuestionCountDto);
        return this.QuestionService.random(getQuestionCountDto);
    }
    async exportQuestion(classifyId) {
        return this.QuestionService.exportAllQuestion(+classifyId);
    }
    async findAll() {
        return this.QuestionService.findAll();
    }
    async findOne(id) {
        return this.QuestionService.findOne(+id);
    }
    async getCount(getQuestionCountDto) {
        return this.QuestionService.getCount(getQuestionCountDto);
    }
    async getQuestions(ids) {
        return this.QuestionService.getQuestions(ids);
    }
    async paging(pagingInfo) {
        console.log(pagingInfo);
        return this.QuestionService.paging(pagingInfo);
    }
    async getQueryParams() {
        const difficultyLevel = await this.QuestionDifficultyLevelService.findAll();
        const questionType = await this.QuestionTypeService.findAll();
        return { difficultyLevel, questionType };
    }
    async studentCanUse(id, body) {
        return this.QuestionService.updateStudentCanUse(+id, body);
    }
    async update(id, updateQuestionDto) {
        return this.QuestionService.update(+id, updateQuestionDto);
    }
    async remove(id) {
        return this.QuestionService.remove(+id);
    }
    async removeAll(ids) {
        try {
            for (const item of ids) {
                await this.QuestionService.remove(+item);
            }
        }
        catch (error) {
            return false;
        }
        return true;
    }
};
__decorate([
    (0, common_1.Post)(),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_e = typeof create_question_dto_1.CreateQuestionDto !== "undefined" && create_question_dto_1.CreateQuestionDto) === "function" ? _e : Object, Object]),
    __metadata("design:returntype", Promise)
], QuestionController.prototype, "create", null);
__decorate([
    (0, common_1.Post)('import/:classifyId'),
    __param(0, (0, common_1.Param)('classifyId')),
    __param(1, (0, common_1.Body)()),
    __param(2, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Array, Object]),
    __metadata("design:returntype", Promise)
], QuestionController.prototype, "importQuestions", null);
__decorate([
    (0, common_1.Get)('random'),
    (0, no_token_decorator_1.NoAuthToken)(),
    (0, swagger_1.ApiOperation)({ summary: '传入选题个数，随机从数据库中抽取对应题数' }),
    __param(0, (0, common_1.Query)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_f = typeof get_question_count_dto_1.GetQuestionCountDto !== "undefined" && get_question_count_dto_1.GetQuestionCountDto) === "function" ? _f : Object]),
    __metadata("design:returntype", Promise)
], QuestionController.prototype, "random", null);
__decorate([
    (0, common_1.Get)('export/:classifyId?'),
    (0, no_token_decorator_1.NoAuthToken)(),
    __param(0, (0, common_1.Param)('classifyId')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number]),
    __metadata("design:returntype", Promise)
], QuestionController.prototype, "exportQuestion", null);
__decorate([
    (0, common_1.Get)(),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Promise)
], QuestionController.prototype, "findAll", null);
__decorate([
    (0, common_1.Get)('item/:id'),
    __param(0, (0, common_1.Param)('id')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], QuestionController.prototype, "findOne", null);
__decorate([
    (0, common_1.Get)('count'),
    (0, no_token_decorator_1.NoAuthToken)(),
    __param(0, (0, common_1.Query)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_g = typeof get_question_count_dto_1.GetQuestionCountDto !== "undefined" && get_question_count_dto_1.GetQuestionCountDto) === "function" ? _g : Object]),
    __metadata("design:returntype", Promise)
], QuestionController.prototype, "getCount", null);
__decorate([
    (0, common_1.Post)('items'),
    (0, no_token_decorator_1.NoAuthToken)(),
    (0, swagger_1.ApiOperation)({ summary: '传入[试题ID,试题ID...]批量查询试题信息' }),
    __param(0, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Array]),
    __metadata("design:returntype", Promise)
], QuestionController.prototype, "getQuestions", null);
__decorate([
    (0, common_1.Get)('paging'),
    (0, no_token_decorator_1.NoAuthToken)(),
    __param(0, (0, common_1.Query)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_h = typeof paging_question_dto_1.PagingQuestionDto !== "undefined" && paging_question_dto_1.PagingQuestionDto) === "function" ? _h : Object]),
    __metadata("design:returntype", Promise)
], QuestionController.prototype, "paging", null);
__decorate([
    (0, common_1.Get)('queryParams'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Promise)
], QuestionController.prototype, "getQueryParams", null);
__decorate([
    (0, common_1.Patch)('item/studentCanUse/:id'),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, Object]),
    __metadata("design:returntype", Promise)
], QuestionController.prototype, "studentCanUse", null);
__decorate([
    (0, common_1.Patch)('item/:id'),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, typeof (_j = typeof update_question_dto_1.UpdateQuestionDto !== "undefined" && update_question_dto_1.UpdateQuestionDto) === "function" ? _j : Object]),
    __metadata("design:returntype", Promise)
], QuestionController.prototype, "update", null);
__decorate([
    (0, common_1.Delete)('item/:id'),
    __param(0, (0, common_1.Param)('id')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], QuestionController.prototype, "remove", null);
__decorate([
    (0, common_1.Delete)(),
    __param(0, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Array]),
    __metadata("design:returntype", Promise)
], QuestionController.prototype, "removeAll", null);
QuestionController = __decorate([
    (0, swagger_1.ApiTags)('试题管理 - 试题'),
    (0, swagger_1.ApiBearerAuth)(),
    (0, common_1.Controller)('assessmentEvaluation/questions'),
    __metadata("design:paramtypes", [typeof (_a = typeof question_service_1.QuestionService !== "undefined" && question_service_1.QuestionService) === "function" ? _a : Object, typeof (_b = typeof question_difficulty_level_service_1.QuestionDifficultyLevelService !== "undefined" && question_difficulty_level_service_1.QuestionDifficultyLevelService) === "function" ? _b : Object, typeof (_c = typeof question_type_service_1.QuestionTypeService !== "undefined" && question_type_service_1.QuestionTypeService) === "function" ? _c : Object, typeof (_d = typeof knowledge_point_service_1.KnowledgePointService !== "undefined" && knowledge_point_service_1.KnowledgePointService) === "function" ? _d : Object])
], QuestionController);
exports.QuestionController = QuestionController;


/***/ }),
/* 146 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CreateQuestionDto = void 0;
const swagger_1 = __webpack_require__(23);
const class_validator_1 = __webpack_require__(25);
const create_dto_1 = __webpack_require__(39);
class CreateQuestionDto extends create_dto_1.CreateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试题类型' }),
    (0, class_validator_1.IsNotEmpty)({ message: '试题类型名不能为空' }),
    __metadata("design:type", Number)
], CreateQuestionDto.prototype, "type", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '难易程度' }),
    (0, class_validator_1.IsNotEmpty)({ message: '难易程度不能为空' }),
    __metadata("design:type", Number)
], CreateQuestionDto.prototype, "difficultyLevel", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试题分类' }),
    (0, class_validator_1.IsNotEmpty)({ message: '试题分类不能为空' }),
    __metadata("design:type", Number)
], CreateQuestionDto.prototype, "classifyId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试题题目' }),
    (0, class_validator_1.IsNotEmpty)({ message: '试题题目不能为空' }),
    __metadata("design:type", String)
], CreateQuestionDto.prototype, "title", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试题选项' }),
    (0, class_validator_1.IsJSON)({ message: '试题选项应为JSON格式' }),
    __metadata("design:type", String)
], CreateQuestionDto.prototype, "options", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '正确答案' }),
    (0, class_validator_1.IsJSON)({ message: '正确答案应为JSON格式' }),
    __metadata("design:type", String)
], CreateQuestionDto.prototype, "answer", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '知识点ID' }),
    __metadata("design:type", Number)
], CreateQuestionDto.prototype, "knowledgeId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '答案解析' }),
    __metadata("design:type", String)
], CreateQuestionDto.prototype, "analysis", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '是否允许学员使用' }),
    __metadata("design:type", Number)
], CreateQuestionDto.prototype, "student", void 0);
exports.CreateQuestionDto = CreateQuestionDto;


/***/ }),
/* 147 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.PagingQuestionDto = void 0;
const swagger_1 = __webpack_require__(23);
const pagination_dto_1 = __webpack_require__(75);
class PagingQuestionDto extends pagination_dto_1.PaginationDTO {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试题分类ID', required: false }),
    __metadata("design:type", Number)
], PagingQuestionDto.prototype, "classifyId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试题类型ID', required: false }),
    __metadata("design:type", Number)
], PagingQuestionDto.prototype, "type", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试题难度ID', required: false }),
    __metadata("design:type", Number)
], PagingQuestionDto.prototype, "difficultyLevel", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试题名模糊查询', required: false }),
    __metadata("design:type", Number)
], PagingQuestionDto.prototype, "title", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试题名模糊查询', required: false }),
    __metadata("design:type", Array)
], PagingQuestionDto.prototype, "excludeIds", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '学生可选试题', required: false, default: 0 }),
    __metadata("design:type", Number)
], PagingQuestionDto.prototype, "student", void 0);
exports.PagingQuestionDto = PagingQuestionDto;


/***/ }),
/* 148 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.UpdateQuestionDto = void 0;
const swagger_1 = __webpack_require__(23);
const class_validator_1 = __webpack_require__(25);
const create_dto_1 = __webpack_require__(39);
class UpdateQuestionDto extends create_dto_1.CreateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试题类型' }),
    __metadata("design:type", Number)
], UpdateQuestionDto.prototype, "type", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '难易程度' }),
    __metadata("design:type", Number)
], UpdateQuestionDto.prototype, "difficultyLevel", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试题分类' }),
    __metadata("design:type", Number)
], UpdateQuestionDto.prototype, "classifyId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试题题目' }),
    __metadata("design:type", String)
], UpdateQuestionDto.prototype, "title", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试题选项' }),
    (0, class_validator_1.IsJSON)({ message: '试题选项应为JSON格式' }),
    __metadata("design:type", String)
], UpdateQuestionDto.prototype, "options", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '正确答案' }),
    (0, class_validator_1.IsJSON)({ message: '试题选项应为JSON格式' }),
    __metadata("design:type", String)
], UpdateQuestionDto.prototype, "answer", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '知识点ID' }),
    __metadata("design:type", Number)
], UpdateQuestionDto.prototype, "knowledgeId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '答案解析' }),
    __metadata("design:type", String)
], UpdateQuestionDto.prototype, "analysis", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '是否允许学员使用' }),
    __metadata("design:type", Number)
], UpdateQuestionDto.prototype, "student", void 0);
exports.UpdateQuestionDto = UpdateQuestionDto;


/***/ }),
/* 149 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b, _c, _d;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.QuestionService = void 0;
const common_1 = __webpack_require__(2);
const typeorm_1 = __webpack_require__(9);
const typeorm_2 = __webpack_require__(18);
const knowledge_point_entity_1 = __webpack_require__(133);
const question_difficulty_level_entity_1 = __webpack_require__(125);
const question_type_entity_1 = __webpack_require__(79);
const question_entity_1 = __webpack_require__(56);
let QuestionService = class QuestionService {
    constructor(QuestionRepository, QuestionTypeRepository, QuestionDifficultyLevelRepository, KnowledgePointRepository) {
        this.QuestionRepository = QuestionRepository;
        this.QuestionTypeRepository = QuestionTypeRepository;
        this.QuestionDifficultyLevelRepository = QuestionDifficultyLevelRepository;
        this.KnowledgePointRepository = KnowledgePointRepository;
    }
    async importQuestions(questions) {
        return await this.QuestionRepository.insert(questions);
    }
    async exportAllQuestion(classifyId) {
        const querys = this.QuestionRepository.createQueryBuilder('q')
            .leftJoin(question_type_entity_1.QuestionType, 'qt', 'qt.id=q.type')
            .leftJoin(question_difficulty_level_entity_1.QuestionDifficultyLevel, 'qdl', 'qdl.id = q.difficulty_level')
            .leftJoin(knowledge_point_entity_1.KnowledgePoint, 'kp', 'kp.id=q.knowledge_id')
            .select(`
        q.title as '题目',
        qt.name as '类型',
        qdl.name as '难易程度',
        kp.name as '知识点',
        q.options as '选项',
        q.answer as '答案',
        q.analysis as '答案解析'
        `)
            .where('q.del_flag=0');
        if (classifyId) {
            querys.andWhere('q.classify_id = ' + classifyId);
        }
        return await querys.getRawMany();
    }
    async create(createQuestionDto) {
        const hasType = await this.QuestionTypeRepository.findOneBy({
            delFlag: 0,
            id: createQuestionDto.type,
        });
        if (!hasType) {
            console.log(hasType);
            throw '[type]字段 - 试题类型不存在';
        }
        const hasDifficultyLevel = await this.QuestionDifficultyLevelRepository.findOneBy({
            delFlag: 0,
            id: createQuestionDto.difficultyLevel,
        });
        if (!hasDifficultyLevel) {
            throw '[difficultyLevel]字段 - 难易程度不存在';
        }
        const hasKnowledgePoint = await this.KnowledgePointRepository.findOneBy({
            delFlag: 0,
            id: createQuestionDto.knowledgeId,
        });
        if (!hasKnowledgePoint) {
            createQuestionDto.knowledgeId = null;
        }
        await this.QuestionRepository.insert(createQuestionDto);
        return true;
    }
    async findOne(id) {
        return await this.QuestionRepository.findOneBy({ id });
    }
    async random(GetQuestionCountDto) {
        let sql = `select u.*,u.type as typeId,
    qt.name as type,
    qt.element as element
    from question u
    inner join (select id from question where del_flag=0`;
        if (GetQuestionCountDto.type) {
            sql += ` AND type=${GetQuestionCountDto.type}`;
        }
        if (GetQuestionCountDto.classifyId) {
            sql += ` AND classify_id=${GetQuestionCountDto.classifyId}`;
        }
        if (GetQuestionCountDto.difficultyLevel) {
            sql += ` AND difficulty_level=${GetQuestionCountDto.difficultyLevel}`;
        }
        if (GetQuestionCountDto.student) {
            sql += ` AND student = ${GetQuestionCountDto.student}`;
        }
        if (GetQuestionCountDto.excludeIds) {
            sql += ` AND id not in (${GetQuestionCountDto.excludeIds.join(',')})`;
        }
        sql += ` order by RAND() limit ${GetQuestionCountDto.count}) as t on t.id=u.id left join question_type qt on qt.id=u.type`;
        return await this.QuestionRepository.query(sql);
    }
    async findAll() {
        return await this.QuestionRepository.createQueryBuilder('questions')
            .where({ delFlag: 0 })
            .leftJoinAndSelect(question_type_entity_1.QuestionType, 'types', 'questions.type = types.id')
            .leftJoinAndSelect(question_difficulty_level_entity_1.QuestionDifficultyLevel, 'levels', 'questions.difficultyLevel = levels.id')
            .leftJoinAndSelect(knowledge_point_entity_1.KnowledgePoint, 'knows', 'questions.knowledgeId = knows.id')
            .select(`
    questions.id as id,
    questions.id as questions_id,
    questions.type as typeId,
    types.name as type,
    questions.difficultyLevel as difficultyLevelId,
    levels.name as difficultyLevel,
    questions.knowledgeId as knowledgeId,
    knows.name as knowledgePoint
    `)
            .getRawMany();
    }
    async paging(pagingInfo) {
        const { currentPage, pageSize, classifyId, title, type, difficultyLevel, excludeIds, student, } = pagingInfo;
        let whereMap = {
            delFlag: 0,
            classifyId: null,
            title: null,
            type: null,
            difficultyLevel: null,
            id: null,
            student: null,
        };
        console.log(pagingInfo, whereMap);
        try {
            let sql = `select
      questions.id as id,
      questions.type as typeId,
      questions.title as title,
      questions.student as student,
      users.name as creator ,
      questions.creator as creatorId,
      questions.classify_id  as classifyId,
      qc.name  as classify,
      questions.options as options,
      date_format(questions.create_time, '%Y-%m-%d') as createTime,
      questions.answer as answer,
      types.name as type,
      types.element as element,
      questions.difficulty_level as difficultyLevelId,
      levels.name as difficultyLevel,
      questions.knowledge_id as knowledgeId,
      knows.name as knowledgePoint
    from
      question questions
    left join question_type types on
      questions.type = types.id
    left join question_difficulty_level levels on
      questions.difficulty_level = levels.id
    left join knowledge_point knows on
      questions.knowledge_id = knows.id
      left join user users on questions.creator = users.id
      left join question_classify qc on questions.classify_id  = qc.id
    where
    questions.del_flag = 0 `;
            if (classifyId) {
                sql += ` AND questions.classify_id = ${classifyId}`;
                whereMap.classifyId = classifyId;
            }
            if (title) {
                sql += ` AND questions.title LIKE '%${title}%'`;
                whereMap.title = (0, typeorm_2.Like)(`%${title}%`);
            }
            if (difficultyLevel) {
                sql += ` AND questions.difficulty_level = ${difficultyLevel}`;
                whereMap.difficultyLevel = difficultyLevel;
            }
            if (type) {
                sql += ` AND questions.type = ${type}`;
                whereMap.type = type;
            }
            console.log('excludeIds', excludeIds);
            if (excludeIds) {
                sql += ` AND questions.id not in (${excludeIds.join(',')})`;
                whereMap.id = (0, typeorm_2.Not)((0, typeorm_2.In)(excludeIds));
            }
            if (student) {
                sql += ` AND questions.student = ${student}`;
                whereMap.student = student;
            }
            sql += `
    order by
      questions.id desc limit ?,?`;
            const getPagingQuestions = await this.QuestionRepository.query(sql, [
                +(currentPage - 1) * pageSize,
                +pageSize,
            ]);
            const total = await this.QuestionRepository.countBy(whereMap);
            return { total, currentPage, pageSize, data: getPagingQuestions };
        }
        catch (err) {
            throw '分页查询失败，错误详情：' + err;
        }
    }
    async updateStudentCanUse(id, updateQuestionDto) {
        return this.QuestionRepository.update(id, updateQuestionDto);
    }
    async update(id, updateQuestionDto) {
        console.log('<===============>', typeof updateQuestionDto.knowledgeId);
        return this.QuestionRepository.update(id, updateQuestionDto);
    }
    async remove(id) {
        await this.QuestionRepository.update(id, { delFlag: 1 });
        return true;
    }
    async getCount(GetQuestionCountDto) {
        let sql = `SELECT COUNT(1) AS cnt FROM question Question WHERE Question.del_flag = 0`;
        if (GetQuestionCountDto.classifyId) {
            sql += ` AND Question.classify_id = ${GetQuestionCountDto.classifyId}`;
        }
        if (GetQuestionCountDto.type) {
            sql += ` AND Question.type = ${GetQuestionCountDto.type}`;
        }
        if (GetQuestionCountDto.difficultyLevel) {
            sql += ` AND Question.difficulty_level = ${GetQuestionCountDto.difficultyLevel}`;
        }
        if (GetQuestionCountDto.student) {
            sql += ` AND Question.student = ${GetQuestionCountDto.student}`;
        }
        if (GetQuestionCountDto.excludeIds) {
            sql += ` AND Question.id not in (${GetQuestionCountDto.excludeIds.join(',')})`;
        }
        const res = await this.QuestionRepository.query(sql);
        return res[0].cnt;
    }
    async getQuestions(ids) {
        return await this.QuestionRepository.query(`
    select * from question where id in (${ids.join(',')})`);
    }
};
QuestionService = __decorate([
    (0, common_1.Injectable)(),
    __param(0, (0, typeorm_1.InjectRepository)(question_entity_1.Question)),
    __param(1, (0, typeorm_1.InjectRepository)(question_type_entity_1.QuestionType)),
    __param(2, (0, typeorm_1.InjectRepository)(question_difficulty_level_entity_1.QuestionDifficultyLevel)),
    __param(3, (0, typeorm_1.InjectRepository)(knowledge_point_entity_1.KnowledgePoint)),
    __metadata("design:paramtypes", [typeof (_a = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _a : Object, typeof (_b = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _b : Object, typeof (_c = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _c : Object, typeof (_d = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _d : Object])
], QuestionService);
exports.QuestionService = QuestionService;


/***/ }),
/* 150 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.GetQuestionCountDto = void 0;
const swagger_1 = __webpack_require__(23);
class GetQuestionCountDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试题分类ID', required: false }),
    __metadata("design:type", Number)
], GetQuestionCountDto.prototype, "classifyId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试题类型ID', required: false }),
    __metadata("design:type", Number)
], GetQuestionCountDto.prototype, "type", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试题难度ID', required: false }),
    __metadata("design:type", Number)
], GetQuestionCountDto.prototype, "difficultyLevel", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '随机数量', required: false }),
    __metadata("design:type", Number)
], GetQuestionCountDto.prototype, "count", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '排除ID', required: false }),
    __metadata("design:type", Array)
], GetQuestionCountDto.prototype, "excludeIds", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '学生可选', required: false, default: 0 }),
    __metadata("design:type", Number)
], GetQuestionCountDto.prototype, "student", void 0);
exports.GetQuestionCountDto = GetQuestionCountDto;


/***/ }),
/* 151 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

"use strict";

Object.defineProperty(exports, "__esModule", ({ value: true }));
const exam_paper_classify_controller_1 = __webpack_require__(152);
const exam_paper_classify_entity_1 = __webpack_require__(156);
const exam_paper_classify_service_1 = __webpack_require__(155);
const exam_paper_controller_1 = __webpack_require__(157);
const mistake_again_controller_1 = __webpack_require__(73);
const exam_paper_entity_1 = __webpack_require__(159);
const questions_for_paper_entity_1 = __webpack_require__(77);
const exam_paper_service_1 = __webpack_require__(158);
const questions_for_paper_1 = __webpack_require__(76);
exports["default"] = {
    entitis: [exam_paper_classify_entity_1.ExamPaperClassify, exam_paper_entity_1.ExamPaper, questions_for_paper_entity_1.QuestionsForPaper],
    controllers: [
        exam_paper_classify_controller_1.ExamPaperClassifyController,
        exam_paper_controller_1.ExamPaperController,
        mistake_again_controller_1.MistakeAgainController,
    ],
    services: [
        exam_paper_classify_service_1.ExamPaperClassifyService,
        exam_paper_service_1.ExamPaperService,
        questions_for_paper_1.QuestionsForPaperService,
    ],
};


/***/ }),
/* 152 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b, _c;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ExamPaperClassifyController = void 0;
const common_1 = __webpack_require__(2);
const swagger_1 = __webpack_require__(23);
const create_exam_paper_classify_dto_1 = __webpack_require__(153);
const update_exam_paper_classify_dto_1 = __webpack_require__(154);
const exam_paper_classify_service_1 = __webpack_require__(155);
const token_data_decorator_1 = __webpack_require__(37);
let ExamPaperClassifyController = class ExamPaperClassifyController {
    constructor(ExamPaperClassifyService) {
        this.ExamPaperClassifyService = ExamPaperClassifyService;
    }
    async create(createExamPaperClassifyDto, token) {
        createExamPaperClassifyDto.creator = createExamPaperClassifyDto.updater =
            token.userId;
        return this.ExamPaperClassifyService.create(createExamPaperClassifyDto);
    }
    async findAll() {
        return this.ExamPaperClassifyService.findAll();
    }
    async update(id, updateExamPaperClassifyDto) {
        return this.ExamPaperClassifyService.update(+id, updateExamPaperClassifyDto);
    }
    async remove(id) {
        return this.ExamPaperClassifyService.remove(+id);
    }
};
__decorate([
    (0, common_1.Post)(),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_b = typeof create_exam_paper_classify_dto_1.CreateExamPaperClassifyDto !== "undefined" && create_exam_paper_classify_dto_1.CreateExamPaperClassifyDto) === "function" ? _b : Object, Object]),
    __metadata("design:returntype", Promise)
], ExamPaperClassifyController.prototype, "create", null);
__decorate([
    (0, common_1.Get)(),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Promise)
], ExamPaperClassifyController.prototype, "findAll", null);
__decorate([
    (0, common_1.Patch)(':id'),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, typeof (_c = typeof update_exam_paper_classify_dto_1.UpdateExamPaperClassifyDto !== "undefined" && update_exam_paper_classify_dto_1.UpdateExamPaperClassifyDto) === "function" ? _c : Object]),
    __metadata("design:returntype", Promise)
], ExamPaperClassifyController.prototype, "update", null);
__decorate([
    (0, common_1.Delete)(':id'),
    __param(0, (0, common_1.Param)('id')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], ExamPaperClassifyController.prototype, "remove", null);
ExamPaperClassifyController = __decorate([
    (0, swagger_1.ApiTags)('试卷管理 - 试卷分类'),
    (0, swagger_1.ApiBearerAuth)(),
    (0, common_1.Controller)('assessmentEvaluation/ExamPaperClassify'),
    __metadata("design:paramtypes", [typeof (_a = typeof exam_paper_classify_service_1.ExamPaperClassifyService !== "undefined" && exam_paper_classify_service_1.ExamPaperClassifyService) === "function" ? _a : Object])
], ExamPaperClassifyController);
exports.ExamPaperClassifyController = ExamPaperClassifyController;


/***/ }),
/* 153 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CreateExamPaperClassifyDto = void 0;
const swagger_1 = __webpack_require__(23);
const class_validator_1 = __webpack_require__(25);
const create_dto_1 = __webpack_require__(39);
class CreateExamPaperClassifyDto extends create_dto_1.CreateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试卷分类名' }),
    (0, class_validator_1.IsNotEmpty)({ message: '试卷分类名不能为空' }),
    __metadata("design:type", String)
], CreateExamPaperClassifyDto.prototype, "name", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '上级试卷分类', default: 0 }),
    (0, class_validator_1.IsNotEmpty)({ message: '上级试卷分类不能为空' }),
    __metadata("design:type", Number)
], CreateExamPaperClassifyDto.prototype, "pid", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试卷分类层级', default: 1 }),
    (0, class_validator_1.IsNotEmpty)({ message: '层级不能为空' }),
    __metadata("design:type", Number)
], CreateExamPaperClassifyDto.prototype, "level", void 0);
exports.CreateExamPaperClassifyDto = CreateExamPaperClassifyDto;


/***/ }),
/* 154 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.UpdateExamPaperClassifyDto = void 0;
const swagger_1 = __webpack_require__(23);
const create_dto_1 = __webpack_require__(39);
class UpdateExamPaperClassifyDto extends create_dto_1.CreateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试卷分类名' }),
    __metadata("design:type", String)
], UpdateExamPaperClassifyDto.prototype, "name", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '上级试卷分类', default: 0 }),
    __metadata("design:type", Number)
], UpdateExamPaperClassifyDto.prototype, "pid", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试卷分类层级', default: 1 }),
    __metadata("design:type", Number)
], UpdateExamPaperClassifyDto.prototype, "level", void 0);
exports.UpdateExamPaperClassifyDto = UpdateExamPaperClassifyDto;


/***/ }),
/* 155 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ExamPaperClassifyService = void 0;
const common_1 = __webpack_require__(2);
const typeorm_1 = __webpack_require__(9);
const exam_paper_classify_entity_1 = __webpack_require__(156);
const typeorm_2 = __webpack_require__(18);
let ExamPaperClassifyService = class ExamPaperClassifyService {
    constructor(ExamPaperClassifyRepository) {
        this.ExamPaperClassifyRepository = ExamPaperClassifyRepository;
    }
    async create(createExamPaperClassifyDto) {
        await this.ExamPaperClassifyRepository.insert(createExamPaperClassifyDto);
        return true;
    }
    async findAll() {
        return this.ExamPaperClassifyRepository.find({
            select: ['id', 'name', 'pid', 'level'],
            where: { delFlag: 0 },
        });
    }
    async update(id, updateExamPaperClassifyDto) {
        return this.ExamPaperClassifyRepository.update(id, updateExamPaperClassifyDto);
    }
    async remove(id) {
        if (isNaN(+id) || !id)
            throw '缺少id';
        await this.ExamPaperClassifyRepository.update(id, { delFlag: 1 });
        const children = await this.ExamPaperClassifyRepository.find({
            where: { pid: id },
        });
        for (let index = 0; index < children.length; index++) {
            const element = children[index];
            await this.remove(element.id);
        }
        return true;
    }
};
ExamPaperClassifyService = __decorate([
    (0, common_1.Injectable)(),
    __param(0, (0, typeorm_1.InjectRepository)(exam_paper_classify_entity_1.ExamPaperClassify)),
    __metadata("design:paramtypes", [typeof (_a = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _a : Object])
], ExamPaperClassifyService);
exports.ExamPaperClassifyService = ExamPaperClassifyService;


/***/ }),
/* 156 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ExamPaperClassify = void 0;
const increment_id_entity_1 = __webpack_require__(17);
const typeorm_1 = __webpack_require__(18);
let ExamPaperClassify = class ExamPaperClassify extends increment_id_entity_1.IncrementIdEntity {
};
__decorate([
    (0, typeorm_1.Column)({ comment: '分类名' }),
    __metadata("design:type", String)
], ExamPaperClassify.prototype, "name", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '父类id', default: 0 }),
    __metadata("design:type", Number)
], ExamPaperClassify.prototype, "pid", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '层级', default: 1 }),
    __metadata("design:type", Number)
], ExamPaperClassify.prototype, "level", void 0);
ExamPaperClassify = __decorate([
    (0, typeorm_1.Entity)()
], ExamPaperClassify);
exports.ExamPaperClassify = ExamPaperClassify;


/***/ }),
/* 157 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b, _c, _d, _e, _f;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ExamPaperController = void 0;
const common_1 = __webpack_require__(2);
const swagger_1 = __webpack_require__(23);
const no_token_decorator_1 = __webpack_require__(26);
const token_data_decorator_1 = __webpack_require__(37);
const exam_paper_service_1 = __webpack_require__(158);
const paging_exam_paper_dto_1 = __webpack_require__(74);
const create_exam_paper_dto_1 = __webpack_require__(161);
const update_exam_paper_dto_1 = __webpack_require__(162);
const questions_for_paper_1 = __webpack_require__(76);
const token_data_entity_1 = __webpack_require__(42);
let ExamPaperController = class ExamPaperController {
    constructor(ExamPaperService, QuestionsForPaperService) {
        this.ExamPaperService = ExamPaperService;
        this.QuestionsForPaperService = QuestionsForPaperService;
    }
    async getQuestionsByPaperId(id) {
        return this.QuestionsForPaperService.getQuestionsByPaperId(id);
    }
    async copyNewPaper(id, data, token) {
        const oldPaperItem = await this.ExamPaperService.findOne(id);
        delete oldPaperItem['id'];
        delete oldPaperItem['createTime'];
        delete oldPaperItem['updateTime'];
        oldPaperItem.title = data.title;
        oldPaperItem.status = 0;
        oldPaperItem.creator = oldPaperItem.updater = token.userId;
        const res = await this.create(oldPaperItem, token);
        return res;
    }
    async create(CreateExamPaperDto, token) {
        CreateExamPaperDto.creator = CreateExamPaperDto.updater = token.userId;
        const newPaper = await this.ExamPaperService.create(CreateExamPaperDto);
        const { FixRes, RandRes } = await this.saveQuestionInfo(newPaper.id, token, CreateExamPaperDto.questionInfo);
        return { newPaper, FixRes, RandRes };
    }
    async saveQuestionInfo(paperId, token, questionInfo) {
        const { fixdQuestions, randQuestions } = questionInfo;
        const fixdNew = fixdQuestions.map((fixItem) => {
            return {
                examPaperId: paperId,
                questionId: fixItem.id,
                score: fixItem['itemScore'],
                isFixed: 1,
                type: fixItem['typeId'],
                updater: token.userId,
                creator: token.userId,
            };
        });
        const randNew = randQuestions.map((fixItem) => {
            return {
                examPaperId: paperId,
                questionId: fixItem.id,
                score: fixItem['itemScore'],
                isFixed: 0,
                type: fixItem['typeId'],
                updater: token.userId,
                creator: token.userId,
            };
        });
        const FixRes = await this.QuestionsForPaperService.create(fixdNew);
        const RandRes = await this.QuestionsForPaperService.create(randNew);
        return { FixRes, RandRes };
    }
    async findOne(id) {
        return this.ExamPaperService.findOne(+id);
    }
    async checkQuote(id) {
        return this.ExamPaperService.checkPaperHasQuote(+id);
    }
    async paging(PagingExamPaperDto, token) {
        return this.ExamPaperService.paging(PagingExamPaperDto, token);
    }
    async update(id, UpdateExamPaperDto, token) {
        console.log(UpdateExamPaperDto);
        if ('questionInfo' in UpdateExamPaperDto) {
            await this.ExamPaperService.removeAllQuestionByPaperId(+id);
            const { FixRes, RandRes } = await this.saveQuestionInfo(+id, token, UpdateExamPaperDto.questionInfo);
            delete UpdateExamPaperDto.questionInfo;
        }
        const newPaper = await this.ExamPaperService.update(+id, UpdateExamPaperDto);
        return { newPaper };
    }
    async remove(id) {
        return this.ExamPaperService.remove(+id);
    }
    async removeAll(ids) {
        try {
            for (const item of ids) {
                await this.ExamPaperService.remove(+item);
            }
        }
        catch (error) {
            return false;
        }
        return true;
    }
    async putchAllClassifyId(body) {
        console.log('================>', body);
        const { ids, classifyId } = body;
        if (!ids)
            return '必须传入id';
        if (!classifyId)
            return '必须传入classifyId';
        try {
            await this.ExamPaperService.batchMovePaperToClassify(ids, classifyId);
        }
        catch (error) {
            console.log(error);
            return false;
        }
        return true;
    }
};
__decorate([
    (0, common_1.Get)('questionsByPaper/:id'),
    (0, no_token_decorator_1.NoAuthToken)(),
    __param(0, (0, common_1.Param)('id')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number]),
    __metadata("design:returntype", Promise)
], ExamPaperController.prototype, "getQuestionsByPaperId", null);
__decorate([
    (0, common_1.Post)('copy/:id'),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, common_1.Body)()),
    __param(2, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Object, Object]),
    __metadata("design:returntype", Promise)
], ExamPaperController.prototype, "copyNewPaper", null);
__decorate([
    (0, common_1.Post)(),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_c = typeof create_exam_paper_dto_1.CreateExamPaperDto !== "undefined" && create_exam_paper_dto_1.CreateExamPaperDto) === "function" ? _c : Object, Object]),
    __metadata("design:returntype", Promise)
], ExamPaperController.prototype, "create", null);
__decorate([
    (0, common_1.Get)('item/:id'),
    __param(0, (0, common_1.Param)('id')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], ExamPaperController.prototype, "findOne", null);
__decorate([
    (0, common_1.Get)('checkQuote/:id'),
    (0, no_token_decorator_1.NoAuthToken)(),
    (0, swagger_1.ApiOperation)({ summary: '检查试卷被哪些考试引用' }),
    __param(0, (0, common_1.Param)('id')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], ExamPaperController.prototype, "checkQuote", null);
__decorate([
    (0, common_1.Get)('paging'),
    __param(0, (0, common_1.Query)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_d = typeof paging_exam_paper_dto_1.PagingExamPaperDto !== "undefined" && paging_exam_paper_dto_1.PagingExamPaperDto) === "function" ? _d : Object, typeof (_e = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _e : Object]),
    __metadata("design:returntype", Promise)
], ExamPaperController.prototype, "paging", null);
__decorate([
    (0, common_1.Patch)('item/:id'),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, common_1.Body)()),
    __param(2, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, typeof (_f = typeof update_exam_paper_dto_1.UpdateExamPaperDto !== "undefined" && update_exam_paper_dto_1.UpdateExamPaperDto) === "function" ? _f : Object, Object]),
    __metadata("design:returntype", Promise)
], ExamPaperController.prototype, "update", null);
__decorate([
    (0, common_1.Delete)('item/:id'),
    __param(0, (0, common_1.Param)('id')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], ExamPaperController.prototype, "remove", null);
__decorate([
    (0, common_1.Delete)(),
    __param(0, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Array]),
    __metadata("design:returntype", Promise)
], ExamPaperController.prototype, "removeAll", null);
__decorate([
    (0, common_1.Patch)('putchAllClassifyId'),
    __param(0, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object]),
    __metadata("design:returntype", Promise)
], ExamPaperController.prototype, "putchAllClassifyId", null);
ExamPaperController = __decorate([
    (0, swagger_1.ApiTags)('试卷管理 - 试卷'),
    (0, swagger_1.ApiBearerAuth)(),
    (0, common_1.Controller)('assessmentEvaluation/exampaper'),
    __metadata("design:paramtypes", [typeof (_a = typeof exam_paper_service_1.ExamPaperService !== "undefined" && exam_paper_service_1.ExamPaperService) === "function" ? _a : Object, typeof (_b = typeof questions_for_paper_1.QuestionsForPaperService !== "undefined" && questions_for_paper_1.QuestionsForPaperService) === "function" ? _b : Object])
], ExamPaperController);
exports.ExamPaperController = ExamPaperController;


/***/ }),
/* 158 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b, _c;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ExamPaperService = void 0;
const common_1 = __webpack_require__(2);
const typeorm_1 = __webpack_require__(9);
const typeorm_2 = __webpack_require__(18);
const exam_paper_entity_1 = __webpack_require__(159);
const questions_for_paper_entity_1 = __webpack_require__(77);
const exam_entity_1 = __webpack_require__(160);
let ExamPaperService = class ExamPaperService {
    constructor(ExamPaperRep, QuestionsForPaper, ExamRep) {
        this.ExamPaperRep = ExamPaperRep;
        this.QuestionsForPaper = QuestionsForPaper;
        this.ExamRep = ExamRep;
    }
    async create(CreateExamPaperDto) {
        return await this.ExamPaperRep.save(CreateExamPaperDto);
    }
    async findOne(id) {
        const paperInfo = await this.ExamPaperRep.findOneBy({ id });
        let sql = `select
    q.*,
    qfp.exam_paper_id as examPaperId,
    qfp.type as typeId,
    qt.element as element,
    qt.name as type,
    qfp.score as itemScore,
    qfp.is_fixed as isFixed
  from
    questions_for_paper qfp
  left join question q on
    q.id = qfp.question_id
  left join question_type qt on
    qt.id = qfp.type
  where
    qfp.del_flag = 0`;
        if (paperInfo.id) {
            sql += ` and qfp.exam_paper_id=${paperInfo.id}`;
        }
        const paperQuestionsInfo = await this.QuestionsForPaper.query(sql);
        const fixdQuestions = paperQuestionsInfo.filter((item) => item.isFixed == 1);
        const randQuestions = paperQuestionsInfo.filter((item) => item.isFixed == 0);
        const item = Object.assign(Object.assign({}, paperInfo), { questionInfo: {
                fixdQuestions,
                randQuestions,
            } });
        return item;
    }
    async pagingSim(pagingInfo, token, delFlag = -1) {
        const { currentPage, pageSize, classifyId, title, isPractive, status } = pagingInfo;
        let whereMap = {
            delFlag: delFlag,
            classifyId: null,
            title: null,
            type: null,
            difficultyLevel: null,
            isPracticeExam: 0,
            status: null,
            creator: null,
        };
        try {
            let sql = `select
      ep.id as id,
      ep.title as title,
      ep.paper_desc as paperDesc,
      ep.paper_duration  as duration,
      ep.total_score  as totalScore ,
      ep.pass_percent  as passPercent,
      ep.questions_is_random_sort  as questionsIsRandomSort,
      ep.options_is_random_sort  as optionsIsRandomSort,
      ep.question_count  as questionCount,
      ep.status as status,
      ep.is_practice_exam as isPracticeExam,
      users.name as creator ,
      ep.creator as creatorId,
      ep.classify_id as classifyId,
      qc.name as classify,
      ex.id as exam_id,
      soe.id as studentOnlineExamId,
      ex.del_flag as exDel,
      ifnull(durationTable.duration,0) as myDuration,
      ifnull(mistakTable2.mistakes,0)  as mistakes ,
      ifnull(scoreTemp.userScore,0) as myScore,
      date_format(ep.create_time, '%Y-%m-%d %H:%i:%S') as createTime
    from
      exam_paper ep
    left join user users on
      ep.creator = users.id
    left join exam_paper_classify qc on
      ep.classify_id = qc.id
      left join exam ex on ex.exam_paper_id  = ep.id
      left join student_online_exam soe  on soe.exam_id  = ex.id
      
            left join (select oeh2.online_exam_id as online_exam_id,oeh2.create_time ct ,ifnull(scoreSum.userScore,0)as userScore  
	from online_exam_history oeh2 left join (
		select sum(eqr.score) as userScore,eqr.history_id as historyId  
		from exam_questions_result eqr where eqr.del_flag = 0 group by eqr.history_id
	) as scoreSum on 
	scoreSum.historyId = oeh2.id  inner join 
	(select max(oehx.create_time) mtime ,oehx.online_exam_id onlineId,max(oehx.id) nid  from online_exam_history oehx group by oehx.online_exam_id ) stb
	on stb.nid = oeh2.id  where oeh2.is_grade_paper =1) as scoreTemp on scoreTemp.online_exam_id = soe.id 

	left join (select oeh2.online_exam_id as online_exam_id ,ifnull(mistakeTable.mistakes,0)as mistakes  
	from online_exam_history oeh2 left join (
		select count(1) as mistakes,eqr2.history_id as historyId   from exam_questions_result eqr2 
	where eqr2.score< eqr2.question_score and eqr2.del_flag = 0
	group by eqr2.history_id
	) as mistakeTable on 
	mistakeTable.historyId = oeh2.id
	inner join (select max(oehx.create_time) mtime ,oehx.online_exam_id onlineId,max(oehx.id) nid  from online_exam_history oehx group by oehx.online_exam_id ) stb
	on stb.nid = oeh2.id  where oeh2.is_grade_paper =1) as mistakTable2 on mistakTable2.online_exam_id = soe.id 
	
	left join (select (oeh.report_time - unix_timestamp(oeh.create_time)*1000)+0 as duration,oeh.online_exam_id   from online_exam_history oeh 
	inner join (select max(oehx.create_time) mtime ,oehx.online_exam_id onlineId,max(oehx.id) nid  from online_exam_history oehx group by oehx.online_exam_id ) stb
	on stb.nid = oeh.id) as durationTable on durationTable.online_exam_id = soe.id
    where
      ep.del_flag = ${delFlag} `;
            if (isPractive) {
                sql += ` AND ep.is_practice_exam=${isPractive} AND ep.creator = '${token.userId}'`;
                whereMap.isPracticeExam = isPractive;
                whereMap.creator = token.userId;
            }
            else {
                sql += ` AND ep.is_practice_exam =0`;
            }
            if (status != null) {
                sql += ` AND ep.status=${status}`;
                whereMap.status = status;
            }
            if (classifyId) {
                sql += ` AND ep.classify_id = ${classifyId}`;
                whereMap.classifyId = classifyId;
            }
            if (title) {
                sql += ` AND ep.title LIKE '%${title}%'`;
                whereMap.title = (0, typeorm_2.Like)(`%${title}%`);
            }
            sql += `
    order by
    ep.id desc limit ?,?`;
            const getPagingQuestions = await this.ExamPaperRep.query(sql, [
                +(currentPage - 1) * pageSize,
                +pageSize,
            ]);
            const total = await this.ExamPaperRep.countBy(whereMap);
            return { total, currentPage, pageSize, data: getPagingQuestions };
        }
        catch (err) {
            throw '分页查询失败，错误详情：' + err;
        }
    }
    async paging(pagingInfo, token, delFlag = 0) {
        const { currentPage, pageSize, classifyId, title, isPractive, status } = pagingInfo;
        let whereMap = {
            delFlag: delFlag,
            classifyId: null,
            title: null,
            type: null,
            difficultyLevel: null,
            isPracticeExam: 0,
            status: null,
            creator: null,
        };
        try {
            let sql = `select
      exam.id as id,
      exam.title as title,
      exam.paper_desc as paperDesc,
      exam.share as share,
      exam.paper_duration  as duration,
      exam.total_score  as totalScore ,
      exam.pass_percent  as passPercent,
      exam.questions_is_random_sort  as questionsIsRandomSort,
      exam.options_is_random_sort  as optionsIsRandomSort,
      exam.question_count  as questionCount,
      exam.status as status,
      exam.is_practice_exam as isPracticeExam,
      users.name as creator ,
      exam.creator as creatorId,
      exam.classify_id as classifyId,
      qc.name as classify,
      date_format(exam.create_time, '%Y-%m-%d %H:%i:%S') as createTime
    from
      exam_paper exam
    left join user users on
      exam.creator = users.id
    left join exam_paper_classify qc on
      exam.classify_id = qc.id
    where
      exam.del_flag = ${delFlag} `;
            if (isPractive) {
                sql += ` AND exam.is_practice_exam=${isPractive} AND exam.creator = '${token.userId}'`;
                whereMap.isPracticeExam = isPractive;
                whereMap.creator = token.userId;
            }
            else {
                sql += ` AND exam.is_practice_exam =0`;
            }
            if (status != null) {
                sql += ` AND exam.status=${status}`;
                whereMap.status = status;
            }
            if (classifyId) {
                sql += ` AND exam.classify_id = ${classifyId}`;
                whereMap.classifyId = classifyId;
            }
            if (title) {
                sql += ` AND exam.title LIKE '%${title}%'`;
                whereMap.title = (0, typeorm_2.Like)(`%${title}%`);
            }
            sql += `
    order by
    exam.id desc limit ?,?`;
            const getPagingQuestions = await this.ExamPaperRep.query(sql, [
                +(currentPage - 1) * pageSize,
                +pageSize,
            ]);
            const total = await this.ExamPaperRep.countBy(whereMap);
            return { total, currentPage, pageSize, data: getPagingQuestions };
        }
        catch (err) {
            throw '分页查询失败，错误详情：' + err;
        }
    }
    async update(id, UpdateExamPaperDto) {
        await this.ExamPaperRep.update(id, UpdateExamPaperDto);
        const item = await this.ExamPaperRep.findOneBy({ delFlag: 0, id });
        return item;
    }
    async batchMovePaperToClassify(ids, classifyId) {
        return await this.ExamPaperRep.query(`
    update exam_paper set classify_id=${classifyId} where id in (${ids.join(',')})
    `);
    }
    async checkPaperHasQuote(paperId) {
        return await this.ExamPaperRep.query(`select e.title as title,(case 
      when now()>=e.exam_start_time and now()<=e.exam_end_time 
    then 1 when now()<e.exam_start_time then 0 
    when now()>e.exam_end_time then 2
    end) as status from exam e where e.exam_paper_id  = ? and e.del_flag =0 `, [paperId]);
    }
    async removeAllQuestionByPaperId(paperId) {
        const rows = await this.ExamPaperRep.query(`update questions_for_paper set del_flag=1 where del_flag=0 and exam_paper_id=${paperId}`);
        return rows;
    }
    async remove(id) {
        await this.ExamPaperRep.query(`delete from exam_paper where id = ${id}`);
        const exam = await this.ExamRep.findOneBy({
            examPaperId: id,
            delFlag: -1,
            classifyId: -1,
        });
        if (exam) {
            await this.ExamPaperRep.query(`delete from student_online_exam soe where soe.exam_id = ${exam.id} and soe.del_flag =-1`);
            await this.ExamPaperRep.query(`delete from exam where exam_paper_id = ${id} and classify_id = -1 and del_flag  = -1`);
        }
        const rows = await this.removeAllQuestionByPaperId(id);
        return rows;
    }
};
ExamPaperService = __decorate([
    (0, common_1.Injectable)(),
    __param(0, (0, typeorm_1.InjectRepository)(exam_paper_entity_1.ExamPaper)),
    __param(1, (0, typeorm_1.InjectRepository)(questions_for_paper_entity_1.QuestionsForPaper)),
    __param(2, (0, typeorm_1.InjectRepository)(exam_entity_1.Exam)),
    __metadata("design:paramtypes", [typeof (_a = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _a : Object, typeof (_b = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _b : Object, typeof (_c = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _c : Object])
], ExamPaperService);
exports.ExamPaperService = ExamPaperService;


/***/ }),
/* 159 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ExamPaper = void 0;
const increment_id_entity_1 = __webpack_require__(17);
const typeorm_1 = __webpack_require__(18);
let ExamPaper = class ExamPaper extends increment_id_entity_1.IncrementIdEntity {
};
__decorate([
    (0, typeorm_1.Column)({ comment: '试卷名称' }),
    __metadata("design:type", String)
], ExamPaper.prototype, "title", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'paper_desc', comment: '试卷描述' }),
    __metadata("design:type", String)
], ExamPaper.prototype, "paperDesc", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'paper_duration', comment: '答题时长' }),
    __metadata("design:type", Number)
], ExamPaper.prototype, "paperDuration", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'total_score', comment: '总分' }),
    __metadata("design:type", Number)
], ExamPaper.prototype, "totalScore", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'question_count', comment: '试题数' }),
    __metadata("design:type", Number)
], ExamPaper.prototype, "questionCount", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'pass_percent', comment: '及格分占总分百分比' }),
    __metadata("design:type", Number)
], ExamPaper.prototype, "passPercent", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'classify_id', comment: '试卷分类' }),
    __metadata("design:type", Number)
], ExamPaper.prototype, "classifyId", void 0);
__decorate([
    (0, typeorm_1.Column)({
        name: 'questions_is_random_sort',
        comment: '试题是否乱序',
        default: 0,
    }),
    __metadata("design:type", Number)
], ExamPaper.prototype, "questionsIsRandomSort", void 0);
__decorate([
    (0, typeorm_1.Column)({
        name: 'options_is_random_sort',
        comment: '选项是否乱序',
        default: 0,
    }),
    __metadata("design:type", Number)
], ExamPaper.prototype, "optionsIsRandomSort", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '试卷状态（0关闭，1开启）default', default: 0 }),
    __metadata("design:type", Number)
], ExamPaper.prototype, "status", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '分享试卷（0关闭，1开启）default', default: 0 }),
    __metadata("design:type", Number)
], ExamPaper.prototype, "share", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'is_practice_exam', comment: '是否为模拟考试', default: 0 }),
    __metadata("design:type", Number)
], ExamPaper.prototype, "isPracticeExam", void 0);
ExamPaper = __decorate([
    (0, typeorm_1.Entity)()
], ExamPaper);
exports.ExamPaper = ExamPaper;


/***/ }),
/* 160 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var _a, _b;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Exam = void 0;
const increment_id_entity_1 = __webpack_require__(17);
const typeorm_1 = __webpack_require__(18);
let Exam = class Exam extends increment_id_entity_1.IncrementIdEntity {
};
__decorate([
    (0, typeorm_1.Column)({ comment: '考试名称' }),
    __metadata("design:type", String)
], Exam.prototype, "title", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'classify_id', comment: '考试分类' }),
    __metadata("design:type", Number)
], Exam.prototype, "classifyId", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'exam_desc', comment: '考试描述' }),
    __metadata("design:type", String)
], Exam.prototype, "examDesc", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'exam_start_time', comment: '考试开始时间' }),
    __metadata("design:type", typeof (_a = typeof Date !== "undefined" && Date) === "function" ? _a : Object)
], Exam.prototype, "examStartTime", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'exam_end_time', comment: '考试结束时间' }),
    __metadata("design:type", typeof (_b = typeof Date !== "undefined" && Date) === "function" ? _b : Object)
], Exam.prototype, "examEndTime", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'exam_duration', comment: '答题时长' }),
    __metadata("design:type", Number)
], Exam.prototype, "examDuration", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'exam_times', comment: '考试次数' }),
    __metadata("design:type", Number)
], Exam.prototype, "examTimes", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'pass_percent', comment: '及格分占总分百分比' }),
    __metadata("design:type", Number)
], Exam.prototype, "passPercent", void 0);
__decorate([
    (0, typeorm_1.Column)({
        name: 'questions_is_random_sort',
        comment: '试题是否乱序',
        default: 0,
    }),
    __metadata("design:type", Number)
], Exam.prototype, "questionsIsRandomSort", void 0);
__decorate([
    (0, typeorm_1.Column)({
        name: 'options_is_random_sort',
        comment: '选项是否乱序',
        default: 0,
    }),
    __metadata("design:type", Number)
], Exam.prototype, "optionsIsRandomSort", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'success_tips', comment: '及格提示消息' }),
    __metadata("design:type", String)
], Exam.prototype, "successTips", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'failed_tips', comment: '不及格提示消息' }),
    __metadata("design:type", String)
], Exam.prototype, "failedTips", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'waiting_tips', comment: '等待人工评卷提示消息' }),
    __metadata("design:type", String)
], Exam.prototype, "waitingTips", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'exam_paper_id', comment: '所选试卷ID' }),
    __metadata("design:type", Number)
], Exam.prototype, "examPaperId", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'exam_mode', comment: '试卷模式（0整卷、1逐题）' }),
    __metadata("design:type", Number)
], Exam.prototype, "examMode", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'total_score', comment: '总分' }),
    __metadata("design:type", Number)
], Exam.prototype, "totalScore", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'grade_paper_mode', comment: '阅卷方式（0机器、1人工）' }),
    __metadata("design:type", Number)
], Exam.prototype, "gradePaperMode", void 0);
__decorate([
    (0, typeorm_1.Column)({
        name: 'is_anonymous',
        comment: '是否匿名（0否 1是）',
        default: 0,
    }),
    __metadata("design:type", Number)
], Exam.prototype, "isAnonymous", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'examiner_id', comment: '判卷人ID' }),
    __metadata("design:type", String)
], Exam.prototype, "examinerId", void 0);
__decorate([
    (0, typeorm_1.Column)({
        name: 'join_mode',
        comment: '参加方式（暂时不做的功能 0账号密码、1口令）',
        default: 0,
    }),
    __metadata("design:type", Number)
], Exam.prototype, "joinMode", void 0);
__decorate([
    (0, typeorm_1.Column)({
        name: 'join_password',
        comment: '参加口令6位（暂时不做的功能）',
        default: null,
    }),
    __metadata("design:type", String)
], Exam.prototype, "joinPassword", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '试卷状态（0待开考，1已开考，2已结束等）', default: 0 }),
    __metadata("design:type", Number)
], Exam.prototype, "status", void 0);
Exam = __decorate([
    (0, typeorm_1.Entity)()
], Exam);
exports.Exam = Exam;


/***/ }),
/* 161 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CreateExamPaperDto = void 0;
const swagger_1 = __webpack_require__(23);
const class_validator_1 = __webpack_require__(25);
const create_dto_1 = __webpack_require__(39);
class CreateExamPaperDto extends create_dto_1.CreateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试卷名称' }),
    (0, class_validator_1.IsNotEmpty)({ message: '试卷名称不能为空' }),
    __metadata("design:type", String)
], CreateExamPaperDto.prototype, "title", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试卷描述' }),
    __metadata("design:type", String)
], CreateExamPaperDto.prototype, "paperDesc", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '答题时长' }),
    (0, class_validator_1.IsNotEmpty)({ message: '答题时长不能为空' }),
    __metadata("design:type", Number)
], CreateExamPaperDto.prototype, "paperDuration", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试卷总分' }),
    (0, class_validator_1.IsNotEmpty)({ message: '试卷总分不能为空' }),
    __metadata("design:type", Number)
], CreateExamPaperDto.prototype, "totalScore", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试题数' }),
    (0, class_validator_1.IsNotEmpty)({ message: '试题数不能为空' }),
    __metadata("design:type", Number)
], CreateExamPaperDto.prototype, "questionCount", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试卷分类' }),
    (0, class_validator_1.IsNotEmpty)({ message: '试卷分类不能为空' }),
    __metadata("design:type", Number)
], CreateExamPaperDto.prototype, "classifyId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '及格分比例' }),
    __metadata("design:type", Number)
], CreateExamPaperDto.prototype, "passPercent", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试题是否乱序', default: 0 }),
    __metadata("design:type", Number)
], CreateExamPaperDto.prototype, "questionsIsRandomSort", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '选项是否乱序', default: 0 }),
    __metadata("design:type", Number)
], CreateExamPaperDto.prototype, "optionsIsRandomSort", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试卷状态 0关闭 1开启', default: 0 }),
    __metadata("design:type", Number)
], CreateExamPaperDto.prototype, "status", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '分享试卷 0关闭 1开启', default: 0 }),
    __metadata("design:type", Number)
], CreateExamPaperDto.prototype, "share", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '是否为模拟考试 （0、1）', default: 0 }),
    __metadata("design:type", Number)
], CreateExamPaperDto.prototype, "isPracticeExam", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试卷中试题信息', default: 0 }),
    __metadata("design:type", Object)
], CreateExamPaperDto.prototype, "questionInfo", void 0);
exports.CreateExamPaperDto = CreateExamPaperDto;


/***/ }),
/* 162 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.UpdateExamPaperDto = void 0;
const swagger_1 = __webpack_require__(23);
const create_dto_1 = __webpack_require__(39);
class UpdateExamPaperDto extends create_dto_1.CreateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试卷名称', required: false }),
    __metadata("design:type", String)
], UpdateExamPaperDto.prototype, "title", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试卷描述', required: false }),
    __metadata("design:type", String)
], UpdateExamPaperDto.prototype, "paperDesc", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '答题时长', required: false }),
    __metadata("design:type", Number)
], UpdateExamPaperDto.prototype, "paperDuration", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试卷总分', required: false }),
    __metadata("design:type", Number)
], UpdateExamPaperDto.prototype, "totalScore", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试题数', required: false }),
    __metadata("design:type", Number)
], UpdateExamPaperDto.prototype, "questionCount", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试卷分类', required: false }),
    __metadata("design:type", Number)
], UpdateExamPaperDto.prototype, "classifyId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '及格分比例', required: false }),
    __metadata("design:type", Number)
], UpdateExamPaperDto.prototype, "passPercent", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试题是否乱序', default: 0, required: false }),
    __metadata("design:type", Number)
], UpdateExamPaperDto.prototype, "questionsIsRandomSort", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '选项是否乱序', default: 0, required: false }),
    __metadata("design:type", Number)
], UpdateExamPaperDto.prototype, "optionsIsRandomSort", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({
        description: '试卷状态 0关闭 1开启',
        default: 0,
        required: false,
    }),
    __metadata("design:type", Number)
], UpdateExamPaperDto.prototype, "status", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({
        description: '分享试卷 0关闭 1开启',
        default: 0,
        required: false,
    }),
    __metadata("design:type", Number)
], UpdateExamPaperDto.prototype, "share", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({
        description: '是否为模拟考试 （0、1）',
        default: 0,
        required: false,
    }),
    __metadata("design:type", Number)
], UpdateExamPaperDto.prototype, "isPracticeExam", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试卷中试题信息', default: 0, required: false }),
    __metadata("design:type", Object)
], UpdateExamPaperDto.prototype, "questionInfo", void 0);
exports.UpdateExamPaperDto = UpdateExamPaperDto;


/***/ }),
/* 163 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

"use strict";

Object.defineProperty(exports, "__esModule", ({ value: true }));
const exam_classify_controller_1 = __webpack_require__(164);
const exam_controller_1 = __webpack_require__(169);
const online_exam_history_controller_1 = __webpack_require__(174);
const student_online_exam_controller_1 = __webpack_require__(177);
const sim_test_controller_1 = __webpack_require__(181);
const exam_classify_entity_1 = __webpack_require__(168);
const exam_questions_result_entity_1 = __webpack_require__(81);
const exam_entity_1 = __webpack_require__(160);
const online_exam_history_entity_1 = __webpack_require__(176);
const student_online_exam_entity_1 = __webpack_require__(173);
const exam_classify_service_1 = __webpack_require__(167);
const exam_questions_result_service_1 = __webpack_require__(80);
const exam_service_1 = __webpack_require__(170);
const online_exam_history_service_1 = __webpack_require__(175);
const student_online_exam_service_1 = __webpack_require__(172);
exports["default"] = {
    entitis: [
        exam_classify_entity_1.ExamClassify,
        exam_entity_1.Exam,
        student_online_exam_entity_1.StudentOnlineExam,
        online_exam_history_entity_1.OnlineExamHistory,
        exam_questions_result_entity_1.ExamQuestionsResult,
    ],
    controllers: [
        exam_classify_controller_1.ExamClassifyController,
        exam_controller_1.ExamController,
        student_online_exam_controller_1.StudentOnlineExamController,
        online_exam_history_controller_1.OnlineExamHistoryController,
        sim_test_controller_1.SimTestController,
    ],
    services: [
        exam_classify_service_1.ExamClassifyService,
        exam_service_1.ExamService,
        student_online_exam_service_1.StudentOnlineExamService,
        online_exam_history_service_1.OnlineExamHistoryService,
        exam_questions_result_service_1.ExamQuestionsResultService,
    ],
};


/***/ }),
/* 164 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b, _c;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ExamClassifyController = void 0;
const common_1 = __webpack_require__(2);
const swagger_1 = __webpack_require__(23);
const create_exam_classify_dto_1 = __webpack_require__(165);
const update_exam_classify_dto_1 = __webpack_require__(166);
const exam_classify_service_1 = __webpack_require__(167);
const token_data_decorator_1 = __webpack_require__(37);
let ExamClassifyController = class ExamClassifyController {
    constructor(ExamClassifyService) {
        this.ExamClassifyService = ExamClassifyService;
    }
    async create(CreateExamClassifyDto, token) {
        CreateExamClassifyDto.creator = CreateExamClassifyDto.updater =
            token.userId;
        return this.ExamClassifyService.create(CreateExamClassifyDto);
    }
    async findAll() {
        return this.ExamClassifyService.findAll();
    }
    async update(id, UpdateExamClassifyDto) {
        return this.ExamClassifyService.update(+id, UpdateExamClassifyDto);
    }
    async remove(id) {
        return this.ExamClassifyService.remove(+id);
    }
};
__decorate([
    (0, common_1.Post)(),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_b = typeof create_exam_classify_dto_1.CreateExamClassifyDto !== "undefined" && create_exam_classify_dto_1.CreateExamClassifyDto) === "function" ? _b : Object, Object]),
    __metadata("design:returntype", Promise)
], ExamClassifyController.prototype, "create", null);
__decorate([
    (0, common_1.Get)(),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Promise)
], ExamClassifyController.prototype, "findAll", null);
__decorate([
    (0, common_1.Patch)(':id'),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, typeof (_c = typeof update_exam_classify_dto_1.UpdateExamClassifyDto !== "undefined" && update_exam_classify_dto_1.UpdateExamClassifyDto) === "function" ? _c : Object]),
    __metadata("design:returntype", Promise)
], ExamClassifyController.prototype, "update", null);
__decorate([
    (0, common_1.Delete)(':id'),
    __param(0, (0, common_1.Param)('id')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], ExamClassifyController.prototype, "remove", null);
ExamClassifyController = __decorate([
    (0, swagger_1.ApiTags)('考试管理 - 考试分类'),
    (0, swagger_1.ApiBearerAuth)(),
    (0, common_1.Controller)('assessmentEvaluation/ExamClassify'),
    __metadata("design:paramtypes", [typeof (_a = typeof exam_classify_service_1.ExamClassifyService !== "undefined" && exam_classify_service_1.ExamClassifyService) === "function" ? _a : Object])
], ExamClassifyController);
exports.ExamClassifyController = ExamClassifyController;


/***/ }),
/* 165 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CreateExamClassifyDto = void 0;
const swagger_1 = __webpack_require__(23);
const class_validator_1 = __webpack_require__(25);
const create_dto_1 = __webpack_require__(39);
class CreateExamClassifyDto extends create_dto_1.CreateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '考试分类名' }),
    (0, class_validator_1.IsNotEmpty)({ message: '考试分类名不能为空' }),
    __metadata("design:type", String)
], CreateExamClassifyDto.prototype, "name", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '上级考试分类', default: 0 }),
    (0, class_validator_1.IsNotEmpty)({ message: '上级考试分类不能为空' }),
    __metadata("design:type", Number)
], CreateExamClassifyDto.prototype, "pid", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '考试分类层级', default: 1 }),
    (0, class_validator_1.IsNotEmpty)({ message: '层级不能为空' }),
    __metadata("design:type", Number)
], CreateExamClassifyDto.prototype, "level", void 0);
exports.CreateExamClassifyDto = CreateExamClassifyDto;


/***/ }),
/* 166 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.UpdateExamClassifyDto = void 0;
const swagger_1 = __webpack_require__(23);
const create_dto_1 = __webpack_require__(39);
class UpdateExamClassifyDto extends create_dto_1.CreateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '考试分类名' }),
    __metadata("design:type", String)
], UpdateExamClassifyDto.prototype, "name", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '上级考试分类', default: 0 }),
    __metadata("design:type", Number)
], UpdateExamClassifyDto.prototype, "pid", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '考试分类层级', default: 1 }),
    __metadata("design:type", Number)
], UpdateExamClassifyDto.prototype, "level", void 0);
exports.UpdateExamClassifyDto = UpdateExamClassifyDto;


/***/ }),
/* 167 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ExamClassifyService = void 0;
const common_1 = __webpack_require__(2);
const typeorm_1 = __webpack_require__(9);
const exam_classify_entity_1 = __webpack_require__(168);
const typeorm_2 = __webpack_require__(18);
let ExamClassifyService = class ExamClassifyService {
    constructor(ExamClassifyRepository) {
        this.ExamClassifyRepository = ExamClassifyRepository;
    }
    async create(CreateExamClassifyDto) {
        await this.ExamClassifyRepository.insert(CreateExamClassifyDto);
        return true;
    }
    async findAll() {
        return this.ExamClassifyRepository.find({
            select: ['id', 'name', 'pid', 'level'],
            where: { delFlag: 0 },
        });
    }
    async update(id, UpdateExamClassifyDto) {
        return this.ExamClassifyRepository.update(id, UpdateExamClassifyDto);
    }
    async remove(id) {
        if (isNaN(+id) || !id)
            throw '缺少id';
        await this.ExamClassifyRepository.update(id, { delFlag: 1 });
        const children = await this.ExamClassifyRepository.find({
            where: { pid: id },
        });
        for (let index = 0; index < children.length; index++) {
            const element = children[index];
            await this.remove(element.id);
        }
        return true;
    }
};
ExamClassifyService = __decorate([
    (0, common_1.Injectable)(),
    __param(0, (0, typeorm_1.InjectRepository)(exam_classify_entity_1.ExamClassify)),
    __metadata("design:paramtypes", [typeof (_a = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _a : Object])
], ExamClassifyService);
exports.ExamClassifyService = ExamClassifyService;


/***/ }),
/* 168 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ExamClassify = void 0;
const increment_id_entity_1 = __webpack_require__(17);
const typeorm_1 = __webpack_require__(18);
let ExamClassify = class ExamClassify extends increment_id_entity_1.IncrementIdEntity {
};
__decorate([
    (0, typeorm_1.Column)({ comment: '分类名' }),
    __metadata("design:type", String)
], ExamClassify.prototype, "name", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '父类id' }),
    __metadata("design:type", Number)
], ExamClassify.prototype, "pid", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '层级' }),
    __metadata("design:type", Number)
], ExamClassify.prototype, "level", void 0);
ExamClassify = __decorate([
    (0, typeorm_1.Entity)()
], ExamClassify);
exports.ExamClassify = ExamClassify;


/***/ }),
/* 169 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b, _c;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ExamController = void 0;
const common_1 = __webpack_require__(2);
const swagger_1 = __webpack_require__(23);
const token_data_decorator_1 = __webpack_require__(37);
const exam_service_1 = __webpack_require__(170);
const paging_exam_dto_1 = __webpack_require__(171);
const student_online_exam_service_1 = __webpack_require__(172);
let ExamController = class ExamController {
    constructor(ExamService, studentOnlineExamService) {
        this.ExamService = ExamService;
        this.studentOnlineExamService = studentOnlineExamService;
    }
    async create(body, token) {
        body.exam.creator = body.exam.updater = token.userId;
        console.log(body);
        const newExam = await this.ExamService.create(body.exam);
        const studentsExamArr = body.students.map((item) => {
            return {
                userId: item,
                examId: newExam.id,
                mistakes: 0,
                examTimes: newExam.examTimes,
                creator: token.userId,
                updater: token.userId,
                delFlag: 0,
            };
        });
        return await this.studentOnlineExamService.create(studentsExamArr);
    }
    async findOne(id) {
        const exam = await this.ExamService.findOne(+id);
        const students = await this.studentOnlineExamService.findAllByExamId(+id);
        return { exam, students };
    }
    async paging(pagingInfo, token) {
        return this.ExamService.paging(pagingInfo, token);
    }
    async updateIsAnonymous(id, body) {
        return this.ExamService.updateIsAnonymous(+id, body.isAnonymous);
    }
    async update(id, body, token) {
        await this.studentOnlineExamService.removeByExamId(+id);
        const studentsExamArr = body.students.map((item) => {
            return {
                userId: item,
                examId: +id,
                mistakes: 0,
                delFlag: 0,
                examTimes: body.exam.examTimes,
                creator: token.userId,
                updater: token.userId,
            };
        });
        await this.studentOnlineExamService.create(studentsExamArr);
        return this.ExamService.update(+id, body.exam);
    }
    async removeAll(ids) {
        try {
            for (const item of ids) {
                await this.ExamService.remove(+item);
                await this.studentOnlineExamService.removeByExamId(+item);
            }
        }
        catch (error) {
            return false;
        }
        return true;
    }
};
__decorate([
    (0, common_1.Post)(),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, Object]),
    __metadata("design:returntype", Promise)
], ExamController.prototype, "create", null);
__decorate([
    (0, common_1.Get)('item/:id'),
    __param(0, (0, common_1.Param)('id')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], ExamController.prototype, "findOne", null);
__decorate([
    (0, common_1.Get)('paging'),
    __param(0, (0, common_1.Query)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_c = typeof paging_exam_dto_1.PagingExamDto !== "undefined" && paging_exam_dto_1.PagingExamDto) === "function" ? _c : Object, Object]),
    __metadata("design:returntype", Promise)
], ExamController.prototype, "paging", null);
__decorate([
    (0, common_1.Patch)('updateIsAnonymous/:id'),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, Object]),
    __metadata("design:returntype", Promise)
], ExamController.prototype, "updateIsAnonymous", null);
__decorate([
    (0, common_1.Patch)('item/:id'),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, common_1.Body)()),
    __param(2, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, Object, Object]),
    __metadata("design:returntype", Promise)
], ExamController.prototype, "update", null);
__decorate([
    (0, common_1.Delete)(),
    __param(0, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Array]),
    __metadata("design:returntype", Promise)
], ExamController.prototype, "removeAll", null);
ExamController = __decorate([
    (0, swagger_1.ApiTags)('考试管理 - 考试'),
    (0, swagger_1.ApiBearerAuth)(),
    (0, common_1.Controller)('assessmentEvaluation/exam'),
    __metadata("design:paramtypes", [typeof (_a = typeof exam_service_1.ExamService !== "undefined" && exam_service_1.ExamService) === "function" ? _a : Object, typeof (_b = typeof student_online_exam_service_1.StudentOnlineExamService !== "undefined" && student_online_exam_service_1.StudentOnlineExamService) === "function" ? _b : Object])
], ExamController);
exports.ExamController = ExamController;


/***/ }),
/* 170 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ExamService = void 0;
const common_1 = __webpack_require__(2);
const typeorm_1 = __webpack_require__(9);
const typeorm_2 = __webpack_require__(18);
const exam_entity_1 = __webpack_require__(160);
const exam_paper_entity_1 = __webpack_require__(159);
const user_entity_1 = __webpack_require__(21);
let ExamService = class ExamService {
    constructor(ExamRep, ExamPaperRep) {
        this.ExamRep = ExamRep;
        this.ExamPaperRep = ExamPaperRep;
    }
    async create(CreateExamPaperDto) {
        return await this.ExamRep.save(CreateExamPaperDto);
    }
    async findOne(id) {
        const examInfo = await this.ExamRep.createQueryBuilder('exam')
            .leftJoinAndMapOne('exam.userinfo', user_entity_1.User, 'user', 'user.id=exam.examinerId')
            .andWhere({ id })
            .getOne();
        const paperInExam = await this.ExamPaperRep.findOneBy({
            id: examInfo.examPaperId,
        });
        return { examInfo, paperInExam };
    }
    async paging(pagingInfo, token) {
        const { currentPage, pageSize, classifyId, title } = pagingInfo;
        let whereMap = {
            delFlag: 0,
            classifyId: null,
            title: null,
            type: null,
            difficultyLevel: null,
            creator: null,
        };
        try {
            let sql = `select
      e.id as id,
      e.title as title,
      e.classify_id as classifyId,
      e.exam_desc as examDesc,
      e.exam_duration as examDuration,
      e.exam_times as examTimes,
      e.pass_percent as passPercent,
      e.questions_is_random_sort as questionsIsRandomSort,
      e.options_is_random_sort as optionsIsRandomSort,
      e.success_tips as successTips,
      e.failed_tips as failedTips,
      e.waiting_tips as waitingTips,
      e.exam_paper_id as examPaperId,
      e.exam_mode as examMode,
      e.total_score as totalScore,
      e.grade_paper_mode as gradePaperMode,
      e.examiner_id as examinerId,
      e.join_mode as joinMode,
      e.join_password as joinPassword,
      ec.name as classify,
      ep.title as examPaperTitle,
      date_format(e.exam_start_time,'%Y-%m-%d %H:%i:%S') as examStartTime , 
      date_format(e.exam_end_time ,'%Y-%m-%d %H:%i:%S') as examEndTime , 
      (case 
         when now()>=e.exam_start_time and now()<=e.exam_end_time 
        then 1 when now()<e.exam_start_time then 0 
        when now()>e.exam_end_time then 2
      end) as status,
      u.name as creator 
    from
      exam e
    left join exam_classify ec on
      ec.id = e.classify_id
    left join exam_paper ep on ep.id=e.exam_paper_id left join user u on u.id=e.creator
    where
      e.del_flag = 0 `;
            if (classifyId) {
                sql += ` AND e.classify_id = ${classifyId}`;
                whereMap.classifyId = classifyId;
            }
            if (title) {
                sql += ` AND e.title LIKE '%${title}%'`;
                whereMap.title = (0, typeorm_2.Like)(`%${title}%`);
            }
            if ((token === null || token === void 0 ? void 0 : token.userId) && (token === null || token === void 0 ? void 0 : token.roleId) !== 1) {
                sql += ` AND e.creator ='${token.userId}'`;
                whereMap.creator = token.userId;
            }
            sql += `
    order by
    e.id desc limit ?,?`;
            const getPagingQuestions = await this.ExamRep.query(sql, [
                +(currentPage - 1) * pageSize,
                +pageSize,
            ]);
            const total = await this.ExamRep.countBy(whereMap);
            return { total, currentPage, pageSize, data: getPagingQuestions };
        }
        catch (err) {
            throw '分页查询失败，错误详情：' + err;
        }
    }
    async update(id, UpdateExamPaperDto) {
        return this.ExamRep.update(id, UpdateExamPaperDto);
    }
    async updateIsAnonymous(id, isAnonymous) {
        return this.ExamRep.update(id, { isAnonymous: isAnonymous });
    }
    async remove(id) {
        await this.ExamRep.update(id, { delFlag: 1 });
        return true;
    }
};
ExamService = __decorate([
    (0, common_1.Injectable)(),
    __param(0, (0, typeorm_1.InjectRepository)(exam_entity_1.Exam)),
    __param(1, (0, typeorm_1.InjectRepository)(exam_paper_entity_1.ExamPaper)),
    __metadata("design:paramtypes", [typeof (_a = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _a : Object, typeof (_b = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _b : Object])
], ExamService);
exports.ExamService = ExamService;


/***/ }),
/* 171 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.PagingExamDto = void 0;
const swagger_1 = __webpack_require__(23);
const pagination_dto_1 = __webpack_require__(75);
class PagingExamDto extends pagination_dto_1.PaginationDTO {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试题分类ID', required: false }),
    __metadata("design:type", Number)
], PagingExamDto.prototype, "classifyId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试题名模糊查询', required: false }),
    __metadata("design:type", Number)
], PagingExamDto.prototype, "title", void 0);
exports.PagingExamDto = PagingExamDto;


/***/ }),
/* 172 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.StudentOnlineExamService = void 0;
const common_1 = __webpack_require__(2);
const typeorm_1 = __webpack_require__(9);
const typeorm_2 = __webpack_require__(18);
const student_online_exam_entity_1 = __webpack_require__(173);
let StudentOnlineExamService = class StudentOnlineExamService {
    constructor(StudentOnlineExam) {
        this.StudentOnlineExam = StudentOnlineExam;
    }
    async createOne(CreateStudentOnlineExamDto) {
        return await this.StudentOnlineExam.save(CreateStudentOnlineExamDto);
    }
    async create(CreateStudentOnlineExamDto) {
        await this.StudentOnlineExam.insert(CreateStudentOnlineExamDto);
        return true;
    }
    async findLastExam(id) {
        const lastArr = await this.StudentOnlineExam.query(`select * from online_exam_history oeh where online_exam_id = ${id} order by oeh.create_time desc limit 1`);
        return (lastArr === null || lastArr === void 0 ? void 0 : lastArr.length) > 0 ? lastArr[0] : null;
    }
    async findOneById(id, checkDel = true) {
        const where = {
            id,
        };
        if (checkDel) {
            where.delFlag = 0;
        }
        const item = await this.StudentOnlineExam.findOneBy(where);
        return item;
    }
    async findAll() {
        return this.StudentOnlineExam.find({
            where: { delFlag: 0 },
        });
    }
    async findAllByExamId(examId) {
        return this.StudentOnlineExam.query(`select soe.user_id as id,u.name as name,u.org_id as orgId from student_online_exam soe left join user u on u.id=soe.user_id  where soe.exam_id = ${examId} and soe.del_flag = 0`);
    }
    async checkExamTimes(userId, onlineExamId) {
        return this.StudentOnlineExam.query(`select count(1) as times,creator as userId,online_exam_id  from online_exam_history oeh where creator = '${userId}' and online_exam_id =${onlineExamId} group by creator,online_exam_id`);
    }
    async pagingGradeDetails(examId, pagingInfo) {
        const { currentPage, pageSize, title } = pagingInfo;
        try {
            let sql = `select  oeh.exam_id as examId, oeh.exam_paper_id as paperId,
      oeh.creator as userId,max(oeh.id) as historyId ,
      date_format(max(oeh.create_time), '%Y-%m-%d %H:%i:%S') as createTime ,
      FROM_UNIXTIME(max(oeh.report_time)/1000,'%Y-%m-%d %H:%i:%s') as reportTime,
      (max(oeh.report_time) -  unix_timestamp(max(oeh.create_time))*1000) as myDuration,
      max(oeh.report_time) as reportTimestamp,
      oeh.is_grade_paper as isGradePaper,
      scoreSum.userScore as score,
      e.pass_percent as passPercent,
      e.total_score as totalScore,
      round(e.pass_percent *e.total_score /100) as passScore,
      u.username as username,
      u.name as realname,
      e.exam_end_time <now() as isOver
      from online_exam_history oeh 
      inner join (
        select max(id) as id from online_exam_history oeh2 group by oeh2.exam_id ,oeh2.creator 
      ) oehk on oehk.id = oeh.id
      left join exam e on e.id = oeh.exam_id 
      left join (
        select sum(eqr.score) as userScore,eqr.history_id as historyId ,count(1) as reportCount 
        from exam_questions_result eqr where eqr.del_flag = 0 group by eqr.history_id
      ) as scoreSum on scoreSum.historyId=oeh.id
      left join user u on u.id = oeh.creator 
      where e.del_flag =0  and scoreSum.reportCount>0 and oeh.exam_id =${examId} 
      `;
            let sqlCount = `
        select count(1) as count from (select max(oeh.id) from online_exam_history oeh 
        left join exam e on e.id = oeh.exam_id  
        left join user u on u.id = oeh.creator 
        where e.del_flag =0 and  oeh.exam_id =${examId}
        `;
            if (title) {
                sql += ` AND u.username LIKE '%${title}%'`;
                sqlCount += ` AND u.username LIKE '%${title}%'`;
            }
            sqlCount += ` group by oeh.exam_id ,oeh.creator) a`;
            let total = await this.StudentOnlineExam.query(sqlCount);
            total = total.length > 0 ? +total[0].count : 0;
            if (!currentPage) {
                sql += ` group by oeh.exam_id ,oeh.creator order by oeh.create_time desc limit 0,${total}`;
            }
            else {
                sql += ` group by oeh.exam_id ,oeh.creator order by oeh.create_time desc limit ?,?`;
            }
            const getPagingQuestions = await this.StudentOnlineExam.query(sql, [
                +(currentPage - 1) * pageSize,
                +pageSize,
            ]);
            return { total, currentPage, pageSize, data: getPagingQuestions };
        }
        catch (err) {
            throw '分页查询失败，错误详情：' + err;
        }
    }
    async pagingGrade(pagingInfo, token) {
        const { currentPage, pageSize, title } = pagingInfo;
        const { userId, roleId } = token;
        try {
            let sql = `select 
      count(1) as shouldCount,
      ifnull(finishCount.count,0) as finishCount, 
      ifnull(gradedCount.count,0) as gradedCount,
      ifnull(finishCount.count,0) - ifnull(gradedCount.count,0) as ungradedCount,
      soe.exam_id as examId,
      e.grade_paper_mode as gradeMode,
      soe.create_time  as createTime,
      e.title as title,
      date_format(e.exam_start_time,'%Y-%m-%d %H:%i:%S') as examStartTime,
      date_format(e.exam_end_time ,'%Y-%m-%d %H:%i:%S') as examEndTime,
      e.total_score as totalScore,
      e.is_anonymous as isAnonymous,
      round(e.total_score*e.pass_percent /100)  as passScore
      from student_online_exam soe 
      left join exam e on e.id = soe.exam_id 
      left join (
        select count(oehx.examId) as count,oehx.examId
        from (
          select oeh.creator as userId,oeh.exam_id as examId ,max(oeh.id) oid,min(oeh.is_grade_paper) as gra
            from online_exam_history oeh 
            inner join ( select max(oeh2.id) ids from online_exam_history oeh2 group by oeh2.creator , oeh2.exam_id)  c  on c.ids = oeh.id
            group by oeh.creator , oeh.exam_id
          ) oehx 
          where (select count(1) from exam_questions_result eqr where eqr.history_id = oehx.oid)>0
        group by oehx.examId
      ) as finishCount on finishCount.examId=soe.exam_id 
      left join (
        select count(1) as count,oehx.examId 
        from (
          select oeh.creator as userId,oeh.exam_id as examId ,min(oeh.is_grade_paper) as gra
            from online_exam_history oeh 
            inner join ( select max(oeh2.id) ids from online_exam_history oeh2 group by oeh2.creator , oeh2.exam_id)  c  on c.ids = oeh.id
            group by oeh.creator , oeh.exam_id 
          ) oehx 
          where oehx.gra>0
        group by oehx.examId
      ) as gradedCount on gradedCount.examId=soe.exam_id 
      where e.del_flag=0`;
            let sqlCount = `
select count(1) as count from (select e.id from exam e  where e.del_flag = 0 `;
            if (title) {
                sql += ` AND e.title LIKE '%${title}%'`;
                sqlCount += ` AND e.title LIKE '%${title}%'`;
            }
            if (userId) {
                sql += ` AND e.examiner_id = '${userId}'`;
                sqlCount += ` AND e.examiner_id = '${userId}'`;
            }
            if (pagingInfo['year']) {
                sql += ` and date_format(soe.create_time,'%Y') = date_format('${pagingInfo['year']}','%Y') `;
                sqlCount += ` and date_format(e.create_time,'%Y') = date_format('${pagingInfo['year']}','%Y') `;
            }
            sql += ` group by soe.exam_id order by 
      e.create_time desc limit ?,?`;
            sqlCount += ` order by
      e.create_time desc ) a`;
            const getPagingQuestions = await this.StudentOnlineExam.query(sql, [
                +(currentPage - 1) * pageSize,
                +pageSize,
            ]);
            let total = await this.StudentOnlineExam.query(sqlCount);
            total = total.length > 0 ? +total[0].count : 0;
            return { total, currentPage, pageSize, data: getPagingQuestions };
        }
        catch (err) {
            throw '分页查询失败，错误详情：' + err;
        }
    }
    async paging(pagingInfo, token) {
        const { currentPage, pageSize, title } = pagingInfo;
        const { userId, roleId } = token;
        let whereMap = {
            delFlag: 0,
            title: null,
            userId: null,
        };
        try {
            let sql = `
      select  
      soe.id as id,
      soe.user_id as userId,
      e.title as title,
      ec.name as classify,
      e.exam_desc as examDesc,
      e.exam_paper_id as paperId,
      e.total_score as totalScore,
      e.pass_percent as passPercent,
      round(e.pass_percent*e.total_score/100) as successScore,
      ifnull(scoreTemp.userScore,0) as myScore,
      e.exam_duration as examDuration,
      ifnull(mistakTable2.mistakes,0)  as mistakmistakeses ,
      e.exam_times as examTimes,
      ifnull(oeh2.times,0)  as myTimes,
      ifnull(durationTable.duration,0) as myDuration,
      date_format(e.exam_start_time,'%Y-%m-%d %H:%i:%S') as examStartTime , 
      date_format(e.exam_end_time ,'%Y-%m-%d %H:%i:%S') as examEndTime , 
      (case 
        when now()>=e.exam_start_time and now()<=e.exam_end_time 
      then 1 when now()<e.exam_start_time then 0 
      when now()>e.exam_end_time then 2
      end) as status
      from student_online_exam soe 
      left join exam e on soe.exam_id = e.id 
      left join exam_classify ec on ec.id=e.classify_id
      left join (select count(1) as times,oeh.creator as userId,oeh.online_exam_id  
      from online_exam_history oeh  group by oeh.creator,oeh.online_exam_id ) oeh2 
      on oeh2.userId = soe.user_id and oeh2.online_exam_id = soe.id
     
      left join (select oeh2.online_exam_id as online_exam_id,oeh2.create_time ct ,ifnull(scoreSum.userScore,0)as userScore  
	from online_exam_history oeh2 left join (
		select sum(eqr.score) as userScore,eqr.history_id as historyId  
		from exam_questions_result eqr where eqr.del_flag = 0 group by eqr.history_id
	) as scoreSum on 
	scoreSum.historyId = oeh2.id  inner join 
	(select max(oehx.create_time) mtime ,oehx.online_exam_id onlineId,max(oehx.id) nid  from online_exam_history oehx group by oehx.online_exam_id ) stb
	on stb.nid = oeh2.id  where oeh2.is_grade_paper =1) as scoreTemp on scoreTemp.online_exam_id = soe.id 

	left join (select oeh2.online_exam_id as online_exam_id ,ifnull(mistakeTable.mistakes,0)as mistakes  
	from online_exam_history oeh2 left join (
		select count(1) as mistakes,eqr2.history_id as historyId   from exam_questions_result eqr2 
	where eqr2.score< eqr2.question_score and eqr2.del_flag = 0
	group by eqr2.history_id
	) as mistakeTable on 
	mistakeTable.historyId = oeh2.id
	inner join (select max(oehx.create_time) mtime ,oehx.online_exam_id onlineId,max(oehx.id) nid  from online_exam_history oehx group by oehx.online_exam_id ) stb
	on stb.nid = oeh2.id  where oeh2.is_grade_paper =1) as mistakTable2 on mistakTable2.online_exam_id = soe.id 
	
	left join (select (oeh.report_time - unix_timestamp(oeh.create_time)*1000)+0 as duration,oeh.online_exam_id   from online_exam_history oeh 
	inner join (select max(oehx.create_time) mtime ,oehx.online_exam_id onlineId,max(oehx.id) nid  from online_exam_history oehx group by oehx.online_exam_id ) stb
	on stb.nid = oeh.id) as durationTable on durationTable.online_exam_id = soe.id

where soe.del_flag = 0 and e.classify_id!=-1 `;
            let sqlCount = `
select count(1) as count from (select  
  soe.id as id,
  soe.user_id as userId,
  e.title as title
  from student_online_exam soe 
  left join exam e on soe.exam_id = e.id 
where soe.del_flag =0`;
            if (title) {
                sql += ` AND e.title LIKE '%${title}%'`;
                sqlCount += ` AND e.title LIKE '%${title}%'`;
            }
            if (userId) {
                sql += ` AND soe.user_id = '${userId}'`;
                sqlCount += ` AND soe.user_id = '${userId}'`;
            }
            sql += `
    order by
    soe.id desc limit ?,?`;
            sqlCount += ` order by
      soe.id desc) a`;
            const getPagingQuestions = await this.StudentOnlineExam.query(sql, [
                +(currentPage - 1) * pageSize,
                +pageSize,
            ]);
            let total = await this.StudentOnlineExam.query(sqlCount);
            total = total.length > 0 ? +total[0].count : 0;
            return { total, currentPage, pageSize, data: getPagingQuestions };
        }
        catch (err) {
            throw '分页查询失败，错误详情：' + err;
        }
    }
    async update(id, UpdateStudentOnlineExamDto) {
        return this.StudentOnlineExam.update(id, UpdateStudentOnlineExamDto);
    }
    async remove(id) {
        if (isNaN(+id) || !id)
            throw '缺少id';
        await this.StudentOnlineExam.update(id, { delFlag: 1 });
        return true;
    }
    async removeByExamId(examid) {
        return await this.StudentOnlineExam.query(`
    update student_online_exam set del_flag=1 where exam_id=${examid}`);
    }
};
StudentOnlineExamService = __decorate([
    (0, common_1.Injectable)(),
    __param(0, (0, typeorm_1.InjectRepository)(student_online_exam_entity_1.StudentOnlineExam)),
    __metadata("design:paramtypes", [typeof (_a = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _a : Object])
], StudentOnlineExamService);
exports.StudentOnlineExamService = StudentOnlineExamService;


/***/ }),
/* 173 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.StudentOnlineExam = void 0;
const increment_id_entity_1 = __webpack_require__(17);
const typeorm_1 = __webpack_require__(18);
let StudentOnlineExam = class StudentOnlineExam extends increment_id_entity_1.IncrementIdEntity {
};
__decorate([
    (0, typeorm_1.Column)({ name: 'user_id', comment: '学员Id' }),
    __metadata("design:type", String)
], StudentOnlineExam.prototype, "userId", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'exam_id', comment: '发布的考试ID' }),
    __metadata("design:type", Number)
], StudentOnlineExam.prototype, "examId", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '错题数', default: 0 }),
    __metadata("design:type", Number)
], StudentOnlineExam.prototype, "mistakes", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'exam_times', comment: '考试允许次数' }),
    __metadata("design:type", Number)
], StudentOnlineExam.prototype, "examTimes", void 0);
StudentOnlineExam = __decorate([
    (0, typeorm_1.Entity)()
], StudentOnlineExam);
exports.StudentOnlineExam = StudentOnlineExam;


/***/ }),
/* 174 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b, _c, _d, _e, _f;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.OnlineExamHistoryController = exports.CreateOnlineExamHistoryDto = void 0;
const common_1 = __webpack_require__(2);
const swagger_1 = __webpack_require__(23);
const exam_questions_result_service_1 = __webpack_require__(80);
const exam_service_1 = __webpack_require__(170);
const online_exam_history_service_1 = __webpack_require__(175);
const student_online_exam_service_1 = __webpack_require__(172);
const no_token_decorator_1 = __webpack_require__(26);
const token_data_decorator_1 = __webpack_require__(37);
const create_dto_1 = __webpack_require__(39);
const token_data_entity_1 = __webpack_require__(42);
const mistake_again_controller_1 = __webpack_require__(73);
class CreateOnlineExamHistoryDto extends create_dto_1.CreateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试题名模糊查询', required: true }),
    __metadata("design:type", Number)
], CreateOnlineExamHistoryDto.prototype, "onlineExamId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试题名模糊查询', required: false, default: 0 }),
    __metadata("design:type", Number)
], CreateOnlineExamHistoryDto.prototype, "isPracticeExam", void 0);
exports.CreateOnlineExamHistoryDto = CreateOnlineExamHistoryDto;
let OnlineExamHistoryController = class OnlineExamHistoryController {
    constructor(OnlineExamHistoryService, StudentOnlineExamService, ExamService, ExamQuestionResultService) {
        this.OnlineExamHistoryService = OnlineExamHistoryService;
        this.StudentOnlineExamService = StudentOnlineExamService;
        this.ExamService = ExamService;
        this.ExamQuestionResultService = ExamQuestionResultService;
    }
    async updateResults(historyId, body) {
        console.log(body);
        const promiseList = [];
        body.forEach(async (item) => {
            promiseList.push(this.ExamQuestionResultService.update(item.id, {
                score: item.score,
                comment: item.comment,
            }));
        });
        const res = await Promise.all(promiseList);
        return await this.OnlineExamHistoryService.update(historyId, {
            isGradePaper: 1,
        });
    }
    async findOne(historyId, answers, token) {
        console.log(historyId, answers, token);
        const historyItem = await this.OnlineExamHistoryService.findOneById(historyId);
        if (historyItem != null &&
            historyItem.reportTime - new Date(historyItem.createTime).getTime() > 500) {
            console.log(historyItem.reportTime, new Date(historyItem.createTime).getTime());
            throw '本次考试已交卷过，请重新点击开始考试';
        }
        const { onlineExamInfo, exam, questions } = await this.OnlineExamHistoryService.findAllQuestionsAndExamInfo(+historyId, 1);
        this.OnlineExamHistoryService.update(+historyId, {
            reportTime: new Date().getTime(),
            isGradePaper: exam.gradePaperMode == 1 ? 0 : 1,
        });
        const questionsResult = questions.map((ques) => {
            let ans = answers.find((ans) => ans.questionId === ques.id);
            let userScore = 0;
            if (ans == null) {
                ans = [];
            }
            else {
                ans = ans.answer;
                const result = (0, mistake_again_controller_1.checkAnswer)(ques, ans);
                console.log(result);
                userScore = result.score;
            }
            return {
                historyId: +historyId,
                questionId: +ques.id,
                questionScore: ques.score,
                score: userScore,
                userAnswer: JSON.stringify(ans),
                creator: token.userId,
                updater: token.userId,
            };
        });
        await this.ExamQuestionResultService.removeAllByHistoryId(+historyId);
        const createRes = await this.ExamQuestionResultService.create(questionsResult);
        const usertotalScore = questionsResult.reduce((prev, item) => {
            return prev + item.score;
        }, 0);
        return {
            score: usertotalScore,
            paperScore: exam.totalScore,
            passPercent: exam.passPercent,
            gradePaperMode: exam.gradePaperMode,
            isPass: Math.round((exam.totalScore * exam.passPercent) / 100) <=
                usertotalScore,
        };
    }
    async createSim(CreateOnlineExamHistoryDto, token) {
        var _a;
        const onlineExamItem = await this.StudentOnlineExamService.findOneById(+CreateOnlineExamHistoryDto.onlineExamId, false);
        if (!onlineExamItem) {
            throw '数据错误，没找到模拟考试';
        }
        const formDto = {
            onlineExamId: CreateOnlineExamHistoryDto.onlineExamId,
            examId: null,
            examPaperId: null,
            examDuration: 0,
            reportTime: 0,
            endTimestamp: 0,
            isAnonymous: 0,
            isGradePaper: 0,
            createTime: new Date(),
            creator: token.userId,
            updater: token.userId,
            isPracticeExam: (_a = CreateOnlineExamHistoryDto.isPracticeExam) !== null && _a !== void 0 ? _a : 0,
        };
        formDto.examId = onlineExamItem.examId;
        const examItem = await this.ExamService.findOne(onlineExamItem.examId);
        formDto.examDuration = examItem.examInfo.examDuration;
        formDto.examPaperId = examItem.examInfo.examPaperId;
        const endTime = new Date().getTime() + formDto.examDuration * 60 * 1000;
        formDto.reportTime = formDto.createTime.getTime();
        formDto.endTimestamp = endTime;
        return await this.OnlineExamHistoryService.create(formDto);
    }
    async create(CreateOnlineExamHistoryDto, token) {
        var _a;
        const onlineExamItem = await this.StudentOnlineExamService.findOneById(+CreateOnlineExamHistoryDto.onlineExamId);
        const formDto = {
            onlineExamId: CreateOnlineExamHistoryDto.onlineExamId,
            examId: null,
            examPaperId: null,
            examDuration: 0,
            reportTime: 0,
            endTimestamp: 0,
            isAnonymous: 0,
            isGradePaper: 0,
            createTime: new Date(),
            creator: token.userId,
            updater: token.userId,
            isPracticeExam: (_a = CreateOnlineExamHistoryDto.isPracticeExam) !== null && _a !== void 0 ? _a : 0,
        };
        if (!onlineExamItem)
            throw '该学员考试不存在';
        formDto.examId = onlineExamItem.examId;
        const examItem = await this.ExamService.findOne(onlineExamItem.examId);
        if (!examItem.examInfo)
            throw '该考试不存在';
        if (examItem.examInfo.delFlag != -1 &&
            new Date() > new Date(examItem.examInfo.examEndTime)) {
            throw '考试已结束';
        }
        const studentExamTimes = await this.StudentOnlineExamService.checkExamTimes(token.userId, CreateOnlineExamHistoryDto.onlineExamId);
        if (Array.isArray(studentExamTimes) && studentExamTimes.length > 0) {
            if (studentExamTimes[0].times >= examItem.examInfo.examTimes) {
                throw '您已没有考试机会了';
            }
        }
        formDto.examDuration = examItem.examInfo.examDuration;
        formDto.examPaperId = examItem.examInfo.examPaperId;
        const endTime = new Date().getTime() + formDto.examDuration * 60 * 1000;
        formDto.reportTime = formDto.createTime.getTime();
        formDto.endTimestamp = endTime;
        return await this.OnlineExamHistoryService.create(formDto);
    }
    async getQuestionResult(onlineExamId) {
        return this.OnlineExamHistoryService.findAllQuestionResultByHistoryId(onlineExamId);
    }
    async findQuestionByHistoryId(id) {
        return this.OnlineExamHistoryService.findAllQuestionsAndExamInfo(+id);
    }
    async findAll() {
        return this.OnlineExamHistoryService.findAll();
    }
    async update(id, UpdateOnlineExamHistoryDto) {
        return this.OnlineExamHistoryService.update(+id, UpdateOnlineExamHistoryDto);
    }
    async remove(id) {
        return this.OnlineExamHistoryService.remove(+id);
    }
};
__decorate([
    (0, common_1.Patch)('result/:historyId'),
    (0, swagger_1.ApiOperation)({ summary: '传入修改数组，修改题目result相关字段' }),
    __param(0, (0, common_1.Param)('historyId')),
    __param(1, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, Array]),
    __metadata("design:returntype", Promise)
], OnlineExamHistoryController.prototype, "updateResults", null);
__decorate([
    (0, common_1.Post)('submitExam/:id'),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, common_1.Body)()),
    __param(2, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, typeof (_e = typeof Array !== "undefined" && Array) === "function" ? _e : Object, typeof (_f = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _f : Object]),
    __metadata("design:returntype", Promise)
], OnlineExamHistoryController.prototype, "findOne", null);
__decorate([
    (0, common_1.Post)('simtest'),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [CreateOnlineExamHistoryDto, Object]),
    __metadata("design:returntype", Promise)
], OnlineExamHistoryController.prototype, "createSim", null);
__decorate([
    (0, common_1.Post)(),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [CreateOnlineExamHistoryDto, Object]),
    __metadata("design:returntype", Promise)
], OnlineExamHistoryController.prototype, "create", null);
__decorate([
    (0, common_1.Get)('examQuestionResult/:onlineExamId'),
    (0, no_token_decorator_1.NoAuthToken)(),
    __param(0, (0, common_1.Param)('onlineExamId')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number]),
    __metadata("design:returntype", Promise)
], OnlineExamHistoryController.prototype, "getQuestionResult", null);
__decorate([
    (0, common_1.Get)(`questions/:id`),
    __param(0, (0, common_1.Param)('id')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], OnlineExamHistoryController.prototype, "findQuestionByHistoryId", null);
__decorate([
    (0, common_1.Get)(),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Promise)
], OnlineExamHistoryController.prototype, "findAll", null);
__decorate([
    (0, common_1.Patch)(':id'),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, Object]),
    __metadata("design:returntype", Promise)
], OnlineExamHistoryController.prototype, "update", null);
__decorate([
    (0, common_1.Delete)(':id'),
    __param(0, (0, common_1.Param)('id')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], OnlineExamHistoryController.prototype, "remove", null);
OnlineExamHistoryController = __decorate([
    (0, swagger_1.ApiTags)('考试管理 - 考试历史'),
    (0, swagger_1.ApiBearerAuth)(),
    (0, common_1.Controller)('assessmentEvaluation/OnlineExamHistory'),
    __metadata("design:paramtypes", [typeof (_a = typeof online_exam_history_service_1.OnlineExamHistoryService !== "undefined" && online_exam_history_service_1.OnlineExamHistoryService) === "function" ? _a : Object, typeof (_b = typeof student_online_exam_service_1.StudentOnlineExamService !== "undefined" && student_online_exam_service_1.StudentOnlineExamService) === "function" ? _b : Object, typeof (_c = typeof exam_service_1.ExamService !== "undefined" && exam_service_1.ExamService) === "function" ? _c : Object, typeof (_d = typeof exam_questions_result_service_1.ExamQuestionsResultService !== "undefined" && exam_questions_result_service_1.ExamQuestionsResultService) === "function" ? _d : Object])
], OnlineExamHistoryController);
exports.OnlineExamHistoryController = OnlineExamHistoryController;


/***/ }),
/* 175 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b, _c;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.OnlineExamHistoryService = void 0;
const common_1 = __webpack_require__(2);
const typeorm_1 = __webpack_require__(9);
const exam_entity_1 = __webpack_require__(160);
const online_exam_history_entity_1 = __webpack_require__(176);
const exam_paper_entity_1 = __webpack_require__(159);
const typeorm_2 = __webpack_require__(18);
let OnlineExamHistoryService = class OnlineExamHistoryService {
    constructor(OnlineExamHistory, ExamRep, ExamPaper) {
        this.OnlineExamHistory = OnlineExamHistory;
        this.ExamRep = ExamRep;
        this.ExamPaper = ExamPaper;
    }
    async findAllQuestionResultByHistoryId(id) {
        const onlineExamInfo = await this.OnlineExamHistory.findOneBy({ id });
        if (!onlineExamInfo) {
            throw '学员考试不存在';
        }
        const exam = await this.ExamRep.findOneBy({ id: onlineExamInfo.examId });
        if (!exam) {
            throw '考试不存在';
        }
        const { examPaperId, examId, onlineExamId } = onlineExamInfo;
        let sql = `select
    q.id as id,
    q.type as typeId,
    q.difficulty_level as  difficultyLevelId,
    qdl.name as difficultyLevel,
    q.classify_id as  classifyId,
    qc.name as classify,
    qt.name as type,
    qt.element  as element,
    q.knowledge_id as knowledgeId,
    q.title  as title,
    q.options  as options,
    q.answer as answer ,
    q.analysis as analysis ,
    eqr.question_score as score,
    eqr.score as userScore,
    eqr.user_answer as userAnswer,
    eqr.comment as teacherComment,
    eqr.id as resultId
    from question q
    left join question_type qt on
    qt.id = q.type
    left join question_classify qc on
    qc.id = q.classify_id
    left join question_difficulty_level qdl on
    q.difficulty_level = qdl.id
    inner join questions_for_paper qfp on qfp.del_flag = 0 and  qfp.exam_paper_id = ${examPaperId} and q.id = qfp.question_id
    inner join exam_questions_result eqr on eqr.question_id = q.id and eqr.history_id = ${id}
    order by q.type asc `;
        sql += ``;
        const questions = await this.OnlineExamHistory.query(sql);
        return { onlineExamInfo, exam, questions };
    }
    async create(CreateOnlineExamHistoryDto) {
        return await this.OnlineExamHistory.save(CreateOnlineExamHistoryDto);
    }
    async findAllQuestionsAndExamInfo(id, isPracticeExam = 0) {
        const onlineExamInfo = await this.OnlineExamHistory.findOneBy({ id });
        if (!onlineExamInfo) {
            throw '学员考试不存在';
        }
        const exam = await this.ExamRep.findOneBy({ id: onlineExamInfo.examId });
        if (!exam) {
            throw '考试不存在';
        }
        if (new Date().getTime() >= onlineExamInfo.endTimestamp) {
            throw '已超过规定答题时间';
        }
        const { examPaperId, examId, onlineExamId } = onlineExamInfo;
        const paper = await this.ExamPaper.findOneBy({ id: examPaperId });
        let sql = `select
    q.id as id,
    q.type as typeId,
    q.difficulty_level as  difficultyLevelId,
    qdl.name as difficultyLevel,
    q.classify_id as  classifyId,
    qc.name as classify,
    qt.name as type,
    qt.element  as element,
    q.knowledge_id as knowledgeId,
    q.title  as title,
    `;
        if (isPracticeExam) {
            sql += `
      q.answer as answer ,
      q.analysis as analysis ,
      `;
        }
        sql += ` 
    q.options  as options,
    qfp.score as score
    from question q
    left join question_type qt on
    qt.id = q.type
    left join question_classify qc on
    qc.id = q.classify_id
    left join question_difficulty_level qdl on
    q.difficulty_level = qdl.id
    inner join questions_for_paper qfp on qfp.exam_paper_id = ${examPaperId} and qfp.del_flag = 0 and q.id = qfp.question_id order by q.type asc  `;
        const questions = await this.OnlineExamHistory.query(sql);
        return {
            onlineExamInfo,
            exam,
            questions,
            paper,
            now: new Date().getTime(),
        };
    }
    async findAll() {
        return this.OnlineExamHistory.find({
            where: { delFlag: 0 },
        });
    }
    async findOneById(historyId) {
        return this.OnlineExamHistory.findOneBy({
            id: historyId,
        });
    }
    async update(id, UpdateOnlineExamHistoryDto) {
        return this.OnlineExamHistory.update(id, UpdateOnlineExamHistoryDto);
    }
    async remove(id) {
        if (isNaN(+id) || !id)
            throw '缺少id';
        await this.OnlineExamHistory.update(id, { delFlag: 1 });
    }
};
OnlineExamHistoryService = __decorate([
    (0, common_1.Injectable)(),
    __param(0, (0, typeorm_1.InjectRepository)(online_exam_history_entity_1.OnlineExamHistory)),
    __param(1, (0, typeorm_1.InjectRepository)(exam_entity_1.Exam)),
    __param(2, (0, typeorm_1.InjectRepository)(exam_paper_entity_1.ExamPaper)),
    __metadata("design:paramtypes", [typeof (_a = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _a : Object, typeof (_b = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _b : Object, typeof (_c = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _c : Object])
], OnlineExamHistoryService);
exports.OnlineExamHistoryService = OnlineExamHistoryService;


/***/ }),
/* 176 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.OnlineExamHistory = void 0;
const increment_id_entity_1 = __webpack_require__(17);
const typeorm_1 = __webpack_require__(18);
let OnlineExamHistory = class OnlineExamHistory extends increment_id_entity_1.IncrementIdEntity {
};
__decorate([
    (0, typeorm_1.Column)({ name: 'online_exam_id', comment: '对应在线考试ID' }),
    __metadata("design:type", Number)
], OnlineExamHistory.prototype, "onlineExamId", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'exam_id', comment: '发布的考试ID' }),
    __metadata("design:type", Number)
], OnlineExamHistory.prototype, "examId", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'exam_paper_id', comment: '考试对应试卷ID' }),
    __metadata("design:type", Number)
], OnlineExamHistory.prototype, "examPaperId", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'exam_duration', comment: '考试用时' }),
    __metadata("design:type", Number)
], OnlineExamHistory.prototype, "examDuration", void 0);
__decorate([
    (0, typeorm_1.Column)({
        name: 'report_time',
        comment: '考试交卷时间',
        type: 'bigint',
        default: null,
    }),
    __metadata("design:type", Number)
], OnlineExamHistory.prototype, "reportTime", void 0);
__decorate([
    (0, typeorm_1.Column)({
        name: 'end_timestamp',
        comment: '考试结束的时间戳',
        type: 'bigint',
        default: null,
    }),
    __metadata("design:type", Number)
], OnlineExamHistory.prototype, "endTimestamp", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'is_anonymous', comment: '是否匿名判卷', default: 0 }),
    __metadata("design:type", Number)
], OnlineExamHistory.prototype, "isAnonymous", void 0);
__decorate([
    (0, typeorm_1.Column)({
        name: 'is_practice_exam',
        comment: '是否为模拟考试 （0、1）',
        default: 0,
    }),
    __metadata("design:type", Number)
], OnlineExamHistory.prototype, "isPracticeExam", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'is_grade_paper', comment: '是否已判卷', default: 0 }),
    __metadata("design:type", Number)
], OnlineExamHistory.prototype, "isGradePaper", void 0);
OnlineExamHistory = __decorate([
    (0, typeorm_1.Entity)()
], OnlineExamHistory);
exports.OnlineExamHistory = OnlineExamHistory;


/***/ }),
/* 177 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b, _c, _d, _e, _f, _g, _h;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.StudentOnlineExamController = void 0;
const common_1 = __webpack_require__(2);
const swagger_1 = __webpack_require__(23);
const no_token_decorator_1 = __webpack_require__(26);
const token_data_decorator_1 = __webpack_require__(37);
const student_online_exam_service_1 = __webpack_require__(172);
const token_data_entity_1 = __webpack_require__(42);
const update_student_online_exam_dto_1 = __webpack_require__(178);
const create_student_online_exam_dto_1 = __webpack_require__(179);
const paging_student_online_exam_dto_1 = __webpack_require__(180);
let StudentOnlineExamController = class StudentOnlineExamController {
    constructor(StudentOnlineExamService) {
        this.StudentOnlineExamService = StudentOnlineExamService;
    }
    async create(CreateStudentOnlineExamDto, token) {
        CreateStudentOnlineExamDto.creator = CreateStudentOnlineExamDto.updater =
            token.userId;
        return this.StudentOnlineExamService.create(CreateStudentOnlineExamDto);
    }
    async paging(pagingInfo, token) {
        console.log(token);
        return this.StudentOnlineExamService.paging(pagingInfo, token);
    }
    async pagingGrade(pagingInfo, token) {
        console.log(token);
        return this.StudentOnlineExamService.pagingGrade(pagingInfo, token);
    }
    async pagingGradeDetails(examId, pagingInfo) {
        return this.StudentOnlineExamService.pagingGradeDetails(+examId, pagingInfo);
    }
    async getLastExamHistory(onlineExamId) {
        return this.StudentOnlineExamService.findLastExam(onlineExamId);
    }
    async update(id, UpdateStudentOnlineExamDto) {
        return this.StudentOnlineExamService.update(+id, UpdateStudentOnlineExamDto);
    }
    async remove(id) {
        return this.StudentOnlineExamService.remove(+id);
    }
    async removeAll(ids) {
        try {
            for (const item of ids) {
                await this.StudentOnlineExamService.remove(+item);
            }
        }
        catch (error) {
            return false;
        }
        return true;
    }
};
__decorate([
    (0, common_1.Post)(),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_b = typeof create_student_online_exam_dto_1.CreateStudentOnlineExamDto !== "undefined" && create_student_online_exam_dto_1.CreateStudentOnlineExamDto) === "function" ? _b : Object, Object]),
    __metadata("design:returntype", Promise)
], StudentOnlineExamController.prototype, "create", null);
__decorate([
    (0, common_1.Get)('paging'),
    __param(0, (0, common_1.Query)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_c = typeof paging_student_online_exam_dto_1.PagingStudentOnlineExamDto !== "undefined" && paging_student_online_exam_dto_1.PagingStudentOnlineExamDto) === "function" ? _c : Object, typeof (_d = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _d : Object]),
    __metadata("design:returntype", Promise)
], StudentOnlineExamController.prototype, "paging", null);
__decorate([
    (0, common_1.Get)('pagingGrade'),
    (0, swagger_1.ApiOperation)({ summary: '分页查询人工判卷的考试列表' }),
    __param(0, (0, common_1.Query)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_e = typeof paging_student_online_exam_dto_1.PagingStudentOnlineExamDto !== "undefined" && paging_student_online_exam_dto_1.PagingStudentOnlineExamDto) === "function" ? _e : Object, typeof (_f = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _f : Object]),
    __metadata("design:returntype", Promise)
], StudentOnlineExamController.prototype, "pagingGrade", null);
__decorate([
    (0, common_1.Get)('pagingGradeDetails/:examId'),
    (0, no_token_decorator_1.NoAuthToken)(),
    (0, swagger_1.ApiOperation)({ summary: '分页查询需要人工判卷的学员考试列表' }),
    __param(0, (0, common_1.Param)('examId')),
    __param(1, (0, common_1.Query)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, typeof (_g = typeof paging_student_online_exam_dto_1.PagingStudentOnlineExamDto !== "undefined" && paging_student_online_exam_dto_1.PagingStudentOnlineExamDto) === "function" ? _g : Object]),
    __metadata("design:returntype", Promise)
], StudentOnlineExamController.prototype, "pagingGradeDetails", null);
__decorate([
    (0, common_1.Get)('lastExamHistory/:onlineExamId'),
    (0, no_token_decorator_1.NoAuthToken)(),
    __param(0, (0, common_1.Param)('onlineExamId')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number]),
    __metadata("design:returntype", Promise)
], StudentOnlineExamController.prototype, "getLastExamHistory", null);
__decorate([
    (0, common_1.Patch)('item/:id'),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, typeof (_h = typeof update_student_online_exam_dto_1.UpdateStudentOnlineExamDto !== "undefined" && update_student_online_exam_dto_1.UpdateStudentOnlineExamDto) === "function" ? _h : Object]),
    __metadata("design:returntype", Promise)
], StudentOnlineExamController.prototype, "update", null);
__decorate([
    (0, common_1.Delete)('item/:id'),
    __param(0, (0, common_1.Param)('id')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], StudentOnlineExamController.prototype, "remove", null);
__decorate([
    (0, common_1.Delete)(),
    __param(0, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Array]),
    __metadata("design:returntype", Promise)
], StudentOnlineExamController.prototype, "removeAll", null);
StudentOnlineExamController = __decorate([
    (0, swagger_1.ApiTags)('考试管理 - 学员在线考试'),
    (0, swagger_1.ApiBearerAuth)(),
    (0, common_1.Controller)('assessmentEvaluation/StudentOnlineExam'),
    __metadata("design:paramtypes", [typeof (_a = typeof student_online_exam_service_1.StudentOnlineExamService !== "undefined" && student_online_exam_service_1.StudentOnlineExamService) === "function" ? _a : Object])
], StudentOnlineExamController);
exports.StudentOnlineExamController = StudentOnlineExamController;


/***/ }),
/* 178 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.UpdateStudentOnlineExamDto = void 0;
const swagger_1 = __webpack_require__(23);
const create_dto_1 = __webpack_require__(39);
class UpdateStudentOnlineExamDto extends create_dto_1.CreateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '学员ID' }),
    __metadata("design:type", String)
], UpdateStudentOnlineExamDto.prototype, "userId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '考试Id', default: 0 }),
    __metadata("design:type", Number)
], UpdateStudentOnlineExamDto.prototype, "examId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '错题数', default: 0 }),
    __metadata("design:type", Number)
], UpdateStudentOnlineExamDto.prototype, "mistakes", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '考试允许次数', default: 3 }),
    __metadata("design:type", Number)
], UpdateStudentOnlineExamDto.prototype, "examTimes", void 0);
exports.UpdateStudentOnlineExamDto = UpdateStudentOnlineExamDto;


/***/ }),
/* 179 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CreateStudentOnlineExamDto = void 0;
const swagger_1 = __webpack_require__(23);
const class_validator_1 = __webpack_require__(25);
const create_dto_1 = __webpack_require__(39);
class CreateStudentOnlineExamDto extends create_dto_1.CreateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '学员ID' }),
    (0, class_validator_1.IsNotEmpty)({ message: '学员Id不能为空' }),
    __metadata("design:type", String)
], CreateStudentOnlineExamDto.prototype, "userId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '考试Id', default: 0 }),
    (0, class_validator_1.IsNotEmpty)({ message: '考试ID不能为空' }),
    __metadata("design:type", Number)
], CreateStudentOnlineExamDto.prototype, "examId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '错题数', default: 0 }),
    __metadata("design:type", Number)
], CreateStudentOnlineExamDto.prototype, "mistakes", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '考试允许次数', default: 3 }),
    __metadata("design:type", Number)
], CreateStudentOnlineExamDto.prototype, "examTimes", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '是否删除', default: 0 }),
    __metadata("design:type", Number)
], CreateStudentOnlineExamDto.prototype, "delFlag", void 0);
exports.CreateStudentOnlineExamDto = CreateStudentOnlineExamDto;


/***/ }),
/* 180 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.PagingStudentOnlineExamDto = void 0;
const swagger_1 = __webpack_require__(23);
const pagination_dto_1 = __webpack_require__(75);
class PagingStudentOnlineExamDto extends pagination_dto_1.PaginationDTO {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '试题名模糊查询', required: false }),
    __metadata("design:type", Number)
], PagingStudentOnlineExamDto.prototype, "title", void 0);
exports.PagingStudentOnlineExamDto = PagingStudentOnlineExamDto;


/***/ }),
/* 181 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b, _c, _d, _e, _f, _g;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.SimTestController = void 0;
const common_1 = __webpack_require__(2);
const swagger_1 = __webpack_require__(23);
const token_data_decorator_1 = __webpack_require__(37);
const exam_paper_service_1 = __webpack_require__(158);
const paging_exam_paper_dto_1 = __webpack_require__(74);
const create_exam_paper_dto_1 = __webpack_require__(161);
const questions_for_paper_1 = __webpack_require__(76);
const token_data_entity_1 = __webpack_require__(42);
const exam_service_1 = __webpack_require__(170);
const student_online_exam_service_1 = __webpack_require__(172);
let SimTestController = class SimTestController {
    constructor(ExamPaperService, QuestionsForPaperService, ExamService, StudentOnlineExam) {
        this.ExamPaperService = ExamPaperService;
        this.QuestionsForPaperService = QuestionsForPaperService;
        this.ExamService = ExamService;
        this.StudentOnlineExam = StudentOnlineExam;
    }
    async paging(PagingExamPaperDto, token) {
        return this.ExamPaperService.pagingSim(PagingExamPaperDto, token, -1);
    }
    async create(CreateExamPaperDto, token) {
        CreateExamPaperDto.creator = CreateExamPaperDto.updater = token.userId;
        CreateExamPaperDto['delFlag'] = -1;
        const newPaper = await this.ExamPaperService.create(CreateExamPaperDto);
        await this.saveQuestionInfo(newPaper.id, token, CreateExamPaperDto.questionInfo);
        const now = new Date();
        const exam = await this.ExamService.create({
            title: CreateExamPaperDto.title,
            classifyId: -1,
            examDesc: '',
            examStartTime: now,
            examEndTime: now,
            examDuration: CreateExamPaperDto.paperDuration,
            examTimes: -1,
            passPercent: CreateExamPaperDto.passPercent,
            questionsIsRandomSort: 0,
            optionsIsRandomSort: 0,
            successTips: '恭喜您，考试通过',
            failedTips: '您本次考试未通过',
            waitingTips: '请等待人工评分',
            examPaperId: newPaper.id,
            examMode: 0,
            totalScore: CreateExamPaperDto.totalScore,
            gradePaperMode: 0,
            examinerId: token.userId,
            joinMode: 0,
            delFlag: -1,
            joinPassword: '',
            creator: token.userId,
            updater: token.userId,
        });
        console.log(exam);
        const studentOnlineExam = await this.StudentOnlineExam.createOne({
            userId: token.userId,
            examId: exam.id,
            mistakes: 0,
            examTimes: 0,
            delFlag: -1,
            creator: token.userId,
            updater: token.userId,
        });
        return { newPaper, exam, studentOnlineExam };
    }
    async saveQuestionInfo(paperId, token, questionInfo) {
        const { fixdQuestions, randQuestions } = questionInfo;
        const fixdNew = fixdQuestions.map((fixItem) => {
            return {
                examPaperId: paperId,
                questionId: fixItem.id,
                score: fixItem['itemScore'],
                isFixed: 1,
                type: fixItem['typeId'],
                updater: token.userId,
                creator: token.userId,
            };
        });
        const randNew = randQuestions.map((fixItem) => {
            return {
                examPaperId: paperId,
                questionId: fixItem.id,
                score: fixItem['itemScore'],
                isFixed: 0,
                type: fixItem['typeId'],
                updater: token.userId,
                creator: token.userId,
            };
        });
        const FixRes = await this.QuestionsForPaperService.create(fixdNew);
        const RandRes = await this.QuestionsForPaperService.create(randNew);
        return { FixRes, RandRes };
    }
    async remove(id) {
        await this.ExamPaperService.remove(+id);
        return;
    }
};
__decorate([
    (0, common_1.Get)('paging'),
    __param(0, (0, common_1.Query)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_e = typeof paging_exam_paper_dto_1.PagingExamPaperDto !== "undefined" && paging_exam_paper_dto_1.PagingExamPaperDto) === "function" ? _e : Object, typeof (_f = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _f : Object]),
    __metadata("design:returntype", Promise)
], SimTestController.prototype, "paging", null);
__decorate([
    (0, common_1.Post)(),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_g = typeof create_exam_paper_dto_1.CreateExamPaperDto !== "undefined" && create_exam_paper_dto_1.CreateExamPaperDto) === "function" ? _g : Object, Object]),
    __metadata("design:returntype", Promise)
], SimTestController.prototype, "create", null);
__decorate([
    (0, common_1.Delete)('item/:id'),
    __param(0, (0, common_1.Param)('id')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], SimTestController.prototype, "remove", null);
SimTestController = __decorate([
    (0, swagger_1.ApiTags)('模拟考试'),
    (0, swagger_1.ApiBearerAuth)(),
    (0, common_1.Controller)('assessmentEvaluation/simtest'),
    __metadata("design:paramtypes", [typeof (_a = typeof exam_paper_service_1.ExamPaperService !== "undefined" && exam_paper_service_1.ExamPaperService) === "function" ? _a : Object, typeof (_b = typeof questions_for_paper_1.QuestionsForPaperService !== "undefined" && questions_for_paper_1.QuestionsForPaperService) === "function" ? _b : Object, typeof (_c = typeof exam_service_1.ExamService !== "undefined" && exam_service_1.ExamService) === "function" ? _c : Object, typeof (_d = typeof student_online_exam_service_1.StudentOnlineExamService !== "undefined" && student_online_exam_service_1.StudentOnlineExamService) === "function" ? _d : Object])
], SimTestController);
exports.SimTestController = SimTestController;


/***/ }),
/* 182 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ResourceModule = void 0;
const common_1 = __webpack_require__(2);
const resource_service_1 = __webpack_require__(183);
const resource_controller_1 = __webpack_require__(187);
const typeorm_1 = __webpack_require__(9);
const resource_entity_1 = __webpack_require__(16);
const resource_classify_controller_1 = __webpack_require__(191);
const resource_classify_service_1 = __webpack_require__(193);
const resource_classify_entity_1 = __webpack_require__(194);
const resource_discussion_entity_1 = __webpack_require__(190);
const resource_discussion_service_1 = __webpack_require__(189);
let ResourceModule = class ResourceModule {
};
ResourceModule = __decorate([
    (0, common_1.Module)({
        imports: [
            typeorm_1.TypeOrmModule.forFeature([resource_entity_1.Resource, resource_classify_entity_1.ResourceClassify, resource_discussion_entity_1.ResourceDiscussion]),
        ],
        controllers: [resource_classify_controller_1.ResourceClassifyController, resource_controller_1.ResourceController],
        providers: [
            resource_classify_service_1.ResourceClassifyService,
            resource_service_1.ResourceService,
            resource_discussion_service_1.ResourceDiscussionService,
        ],
    })
], ResourceModule);
exports.ResourceModule = ResourceModule;


/***/ }),
/* 183 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
var _a;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ResourceService = exports.ACCEPT_MAP = void 0;
const common_1 = __webpack_require__(2);
const typeorm_1 = __webpack_require__(9);
const fs_1 = __webpack_require__(184);
const path_1 = __webpack_require__(11);
const env_1 = __webpack_require__(10);
const ts_md5_1 = __webpack_require__(185);
const typeorm_2 = __webpack_require__(18);
const resource_entity_1 = __webpack_require__(16);
const user_entity_1 = __webpack_require__(21);
const officeToPDF = __webpack_require__(186);
exports.ACCEPT_MAP = {
    image: 'image/*',
    audio: 'audio/*',
    video: 'video/*',
    ppt: 'application/vnd.ms-powerpoint',
    pptx: 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
    xls: 'application/vnd.ms-excel',
    xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
    pdf: 'application/pdf',
    doc: 'application/msword',
    docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
};
let ResourceService = class ResourceService {
    constructor(resRepository) {
        this.resRepository = resRepository;
        this.RES_PATH = env_1.default.staticAssets.resource.path;
        this.CONVER_TASKS = [];
        (0, fs_1.mkdirSync)(this.RES_PATH, { recursive: true });
    }
    async create(resource) {
        return this.resRepository.save(resource);
    }
    async createFolder(resource) {
        const res = await this.resRepository.findOneBy({
            delFlag: 0,
            type: resource.type,
            name: resource.name,
            path: resource.path,
        });
        if (res)
            throw '该文件夹已存在';
        return this.resRepository.save(resource);
    }
    async findAll(pageInfo, query) {
        const [list, total] = await this.resRepository
            .createQueryBuilder('res')
            .leftJoinAndMapOne('res.userinfo', user_entity_1.User, 'user', 'res.creator = user.id')
            .select([
            'res.id',
            'res.name',
            'res.ext',
            'res.type',
            'res.mimetype',
            'res.size',
            'res.path',
            'res.diskname',
            'res.preview',
            'res.classifyId',
            'res.classifyIds',
            'res.createTime',
            'res.creator',
            'res.share',
            'user.name',
        ])
            .leftJoinAndMapOne('res.user', user_entity_1.User, 'u', 'u.id = res.creator')
            .where(() => [
            ' res.path=:path and res.del_flag=0 ',
            query.isManager || query.share == 1
                ? ''
                : ' and res.creator=:creator ',
            query.share == 1 ? ' and res.share=1' : '',
            ` and res.type in ('${['folder', ...Object.keys(exports.ACCEPT_MAP)].join("','")}') `,
            query.likeName ? ' and res.name like :likeName ' : '',
            query.classifyId ? ' and res.classifyId=:classifyId ' : '',
        ].join(''), Object.assign(Object.assign({}, query), { likeName: `%${query.likeName}%` }))
            .orderBy(Object.assign({}, query.sortBySize && { 'res.size': query.sortBySize }, query.sortByCreateTime && {
            'res.createTime': query.sortByCreateTime,
        }, { 'res.id': 'DESC' }))
            .skip(pageInfo.start)
            .take(pageInfo.size)
            .getManyAndCount();
        return { list, total };
    }
    find(id) {
        return this.resRepository.findOneBy({ id });
    }
    async findAllFolder(creator) {
        const data = await this.resRepository.find({
            where: { delFlag: 0, type: 'folder', creator },
            select: ['name', 'path'],
        });
        if (!data.length)
            throw '暂未创建任何文件夹，创建后再试';
        return data;
    }
    update(id, data) {
        return this.resRepository.update(id, data);
    }
    updateClassify(_a) {
        var { ids } = _a, data = __rest(_a, ["ids"]);
        return this.resRepository.update(ids, data);
    }
    updatePath(_a) {
        var { ids } = _a, data = __rest(_a, ["ids"]);
        return this.resRepository.update(ids, data);
    }
    async remove(ids) {
        await this.resRepository.update(ids, { delFlag: 1 });
        return true;
    }
    getAcceptType(accept) {
        if (!accept)
            return;
        for (const type in exports.ACCEPT_MAP) {
            if (accept.startsWith(exports.ACCEPT_MAP[type].replace(/\*$/, '')))
                return type;
        }
    }
    async saveFile(file) {
        const [, name, ext] = Buffer.from(file.originalname, 'latin1')
            .toString('utf8')
            .match(/(.+)\.(.+)/);
        const acceptType = this.getAcceptType(file.mimetype);
        if (!acceptType)
            throw '暂不支持该文件类型';
        const resource = {
            name,
            ext,
            diskname: ts_md5_1.Md5.hashStr(file.buffer.toString()) + '.' + ext.toLowerCase(),
            type: acceptType,
            mimetype: file.mimetype,
            size: file.size,
        };
        if (['image', 'audio', 'video', 'pdf'].includes(acceptType))
            resource.preview = resource.diskname;
        const path = (0, path_1.join)(this.RES_PATH, resource.diskname);
        if (!(0, fs_1.existsSync)(path)) {
            const ws = (0, fs_1.createWriteStream)(path);
            ws.write(file.buffer);
        }
        return resource;
    }
    findOneById(id) {
        return this.resRepository.findOneBy({ id });
    }
    async fileConver(id, converUser) {
        const taskIndex = this.CONVER_TASKS.indexOf(id);
        if (taskIndex !== -1)
            throw '文件正在加载中，请稍后';
        this.CONVER_TASKS.push(id);
        return this.resRepository.manager.transaction(async (entityManager) => {
            const res = await this.findOneById(id);
            const originPath = (0, path_1.join)(this.RES_PATH, res.diskname);
            const preview = res.diskname + '.pdf';
            const previewPath = (0, path_1.join)(this.RES_PATH, preview);
            if (res.preview !== preview) {
                if (!(0, fs_1.existsSync)(previewPath))
                    try {
                        await this.converToPDF(originPath, previewPath);
                        await entityManager.update(resource_entity_1.Resource, id, {
                            preview,
                            updater: converUser,
                        });
                    }
                    catch (error) {
                        console.error(error);
                        throw '文件转换失败';
                    }
                    finally {
                        this.CONVER_TASKS.splice(taskIndex, 1);
                    }
            }
            return preview;
        });
    }
    async converToPDF(originPath, savePath) {
        const buf = await officeToPDF((0, fs_1.readFileSync)(originPath));
        (0, fs_1.writeFileSync)(savePath, buf);
    }
};
ResourceService = __decorate([
    (0, common_1.Injectable)(),
    __param(0, (0, typeorm_1.InjectRepository)(resource_entity_1.Resource)),
    __metadata("design:paramtypes", [typeof (_a = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _a : Object])
], ResourceService);
exports.ResourceService = ResourceService;


/***/ }),
/* 184 */
/***/ ((module) => {

"use strict";
module.exports = require("fs");

/***/ }),
/* 185 */
/***/ ((module) => {

"use strict";
module.exports = require("ts-md5");

/***/ }),
/* 186 */
/***/ ((module) => {

"use strict";
module.exports = require("office-to-pdf");

/***/ }),
/* 187 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ResourceController = void 0;
const common_1 = __webpack_require__(2);
const platform_express_1 = __webpack_require__(188);
const query_page_info_decorator_1 = __webpack_require__(51);
const token_data_decorator_1 = __webpack_require__(37);
const page_info_entity_1 = __webpack_require__(52);
const token_data_entity_1 = __webpack_require__(42);
const resource_service_1 = __webpack_require__(183);
const resource_discussion_service_1 = __webpack_require__(189);
const no_token_decorator_1 = __webpack_require__(26);
const swagger_1 = __webpack_require__(23);
const pagination_dto_1 = __webpack_require__(75);
let ResourceController = class ResourceController {
    constructor(resourceService, resourceDiscussionService) {
        this.resourceService = resourceService;
        this.resourceDiscussionService = resourceDiscussionService;
    }
    deleteDiscussion(id, tokenInfo) {
        return this.resourceDiscussionService.delete(+id, tokenInfo);
    }
    pagingDiscussion(paging, tokenInfo) {
        return this.resourceDiscussionService.paging(paging);
    }
    updateStudyDiscussion(discussionInfo, tokenInfo) {
        return this.resourceDiscussionService.updateStudy_discussion(discussionInfo, tokenInfo);
    }
    async uploadFile(file, body, token) {
        const resource = await this.resourceService.saveFile(file);
        if (body.type)
            resource.type = body.type;
        resource.path = body.path;
        resource.classifyId = body.classifyId;
        resource.share = body.share;
        resource.creator = resource.updater = token.userId;
        return (await this.resourceService.create([resource])).pop();
    }
    async createResource(data, token) {
        for (const item of data) {
            item.creator = item.updater = token.userId;
        }
        return this.resourceService.create(data);
    }
    async createFolder(data, token) {
        return this.resourceService.createFolder({
            name: data.name,
            type: 'folder',
            path: data.path,
            updater: token.userId,
            creator: token.userId,
        });
    }
    async findAll(pageInfo, token, query) {
        query.creator = token.userId;
        query.isManager = token.baseRole === 1;
        return this.resourceService.findAll(pageInfo, query);
    }
    async find(id) {
        return this.resourceService.find(+id);
    }
    async findAllFolder(token) {
        return this.resourceService.findAllFolder(token.userId);
    }
    async updateName(id, name, token) {
        return this.resourceService.update(+id, {
            name,
            updater: token.userId,
        });
    }
    async updateClassify(data, token) {
        data.updater = token.userId;
        return this.resourceService.updateClassify(data);
    }
    async updatePath(data, token) {
        data.updater = token.userId;
        return this.resourceService.updatePath(data);
    }
    async remove(ids) {
        return this.resourceService.remove(ids.split(',').map(Number));
    }
    async fileConver(id, token) {
        return this.resourceService.fileConver(+id, token.userId);
    }
};
__decorate([
    (0, common_1.Delete)('discussion/:id'),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, typeof (_c = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _c : Object]),
    __metadata("design:returntype", void 0)
], ResourceController.prototype, "deleteDiscussion", null);
__decorate([
    (0, common_1.Get)('pagingDis'),
    (0, no_token_decorator_1.NoAuthToken)(),
    __param(0, (0, common_1.Query)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_d = typeof pagination_dto_1.PaginationDTO !== "undefined" && pagination_dto_1.PaginationDTO) === "function" ? _d : Object, Object]),
    __metadata("design:returntype", void 0)
], ResourceController.prototype, "pagingDiscussion", null);
__decorate([
    (0, common_1.Post)('discussion'),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_e = typeof resource_discussion_service_1.ResourceDiscussionDto !== "undefined" && resource_discussion_service_1.ResourceDiscussionDto) === "function" ? _e : Object, Object]),
    __metadata("design:returntype", void 0)
], ResourceController.prototype, "updateStudyDiscussion", null);
__decorate([
    (0, common_1.Post)('upload'),
    (0, common_1.UseInterceptors)((0, platform_express_1.FileInterceptor)('file')),
    __param(0, (0, common_1.UploadedFile)()),
    __param(1, (0, common_1.Body)()),
    __param(2, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_g = typeof Express !== "undefined" && (_f = Express.Multer) !== void 0 && _f.File) === "function" ? _g : Object, Object, typeof (_h = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _h : Object]),
    __metadata("design:returntype", Promise)
], ResourceController.prototype, "uploadFile", null);
__decorate([
    (0, common_1.Post)('createResource'),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, typeof (_j = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _j : Object]),
    __metadata("design:returntype", Promise)
], ResourceController.prototype, "createResource", null);
__decorate([
    (0, common_1.Post)('createFolder'),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, typeof (_k = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _k : Object]),
    __metadata("design:returntype", Promise)
], ResourceController.prototype, "createFolder", null);
__decorate([
    (0, common_1.Get)(),
    __param(0, (0, query_page_info_decorator_1.PageInfo)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __param(2, (0, common_1.Query)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_l = typeof page_info_entity_1.PageInfoEntity !== "undefined" && page_info_entity_1.PageInfoEntity) === "function" ? _l : Object, typeof (_m = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _m : Object, Object]),
    __metadata("design:returntype", Promise)
], ResourceController.prototype, "findAll", null);
__decorate([
    (0, common_1.Get)('findOne/:id'),
    __param(0, (0, common_1.Param)('id')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], ResourceController.prototype, "find", null);
__decorate([
    (0, common_1.Get)('findAllFolder'),
    __param(0, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_o = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _o : Object]),
    __metadata("design:returntype", Promise)
], ResourceController.prototype, "findAllFolder", null);
__decorate([
    (0, common_1.Patch)('rename/:id'),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, common_1.Body)('name')),
    __param(2, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, String, typeof (_p = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _p : Object]),
    __metadata("design:returntype", Promise)
], ResourceController.prototype, "updateName", null);
__decorate([
    (0, common_1.Patch)('updateClassify'),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, typeof (_q = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _q : Object]),
    __metadata("design:returntype", Promise)
], ResourceController.prototype, "updateClassify", null);
__decorate([
    (0, common_1.Patch)('updatePath'),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, typeof (_r = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _r : Object]),
    __metadata("design:returntype", Promise)
], ResourceController.prototype, "updatePath", null);
__decorate([
    (0, common_1.Delete)(':ids'),
    __param(0, (0, common_1.Param)('ids')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], ResourceController.prototype, "remove", null);
__decorate([
    (0, common_1.Patch)('fileConver/:id'),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, typeof (_s = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _s : Object]),
    __metadata("design:returntype", Promise)
], ResourceController.prototype, "fileConver", null);
ResourceController = __decorate([
    (0, swagger_1.ApiTags)('资源管理'),
    (0, swagger_1.ApiBearerAuth)(),
    (0, common_1.Controller)('resource'),
    __metadata("design:paramtypes", [typeof (_a = typeof resource_service_1.ResourceService !== "undefined" && resource_service_1.ResourceService) === "function" ? _a : Object, typeof (_b = typeof resource_discussion_service_1.ResourceDiscussionService !== "undefined" && resource_discussion_service_1.ResourceDiscussionService) === "function" ? _b : Object])
], ResourceController);
exports.ResourceController = ResourceController;


/***/ }),
/* 188 */
/***/ ((module) => {

"use strict";
module.exports = require("@nestjs/platform-express");

/***/ }),
/* 189 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ResourceDiscussionDto = exports.ResourceDiscussionService = void 0;
const typeorm_1 = __webpack_require__(9);
const resource_discussion_entity_1 = __webpack_require__(190);
const typeorm_2 = __webpack_require__(18);
const swagger_1 = __webpack_require__(23);
const class_validator_1 = __webpack_require__(25);
const create_dto_1 = __webpack_require__(39);
let ResourceDiscussionService = class ResourceDiscussionService {
    constructor(ResourceDiscussionRep) {
        this.ResourceDiscussionRep = ResourceDiscussionRep;
    }
    async updateStudy_discussion(ResourceDiscussion, tokenInfo) {
        const saveData = Object.assign(Object.assign({}, ResourceDiscussion), { creator: tokenInfo.userId, updater: tokenInfo.userId });
        const res = await this.ResourceDiscussionRep.save(saveData);
        return res;
    }
    async paging(paging) {
        if (!paging.records) {
            paging.records = 'resource';
        }
        const countSql = `select
    rd.create_time createTime,
    rd.creator ,
    rd.update_time updateTime,
    rd.updater ,
    rd.del_flag delFlag,
    rd.remarks ,
    rd.version ,
    rd.id,
    rd.type,
    rd.reply_id replyId,
    rd.reply_user_id replyUserId ,
    rd.root_dis rootDis,
    rd.content,
    u.name as creatorName,
    u2.name as replyUserName,
    r.diskname as avatar
  
  from
    resource_discussion rd
    left join user u on u.id = rd.creator 
    left join user u2 on u2.id = rd.reply_user_id 
    left join resource r on u.photo  = r.id
  where rd.del_flag = 0 and rd.type = '${paging.records}'
  `;
        const dataSql = countSql +
            `order by rd.id desc
    limit ${+(paging.currentPage - 1) * paging.pageSize},${+paging.pageSize}`;
        const datas = await this.ResourceDiscussionRep.query(dataSql);
        const counts = await this.ResourceDiscussionRep.query(countSql);
        return {
            currentPage: paging.currentPage,
            pageSize: paging.pageSize,
            total: counts.length,
            data: datas,
        };
    }
    async delete(id, token) {
        const discussionItem = await this.ResourceDiscussionRep.findOneBy({ id });
        if ((discussionItem === null || discussionItem === void 0 ? void 0 : discussionItem.creator) != token.userId) {
            throw '不是当前用户的评论，删除失败';
        }
        this.ResourceDiscussionRep.delete({ rootDis: id });
        return this.ResourceDiscussionRep.delete({ id });
    }
};
ResourceDiscussionService = __decorate([
    __param(0, (0, typeorm_1.InjectRepository)(resource_discussion_entity_1.ResourceDiscussion)),
    __metadata("design:paramtypes", [typeof (_a = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _a : Object])
], ResourceDiscussionService);
exports.ResourceDiscussionService = ResourceDiscussionService;
class ResourceDiscussionDto extends create_dto_1.CreateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '公共讨论类型' }),
    (0, class_validator_1.IsNotEmpty)({ message: '公共讨论类型不能为空' }),
    __metadata("design:type", String)
], ResourceDiscussionDto.prototype, "type", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '所回复的评论id' }),
    __metadata("design:type", Number)
], ResourceDiscussionDto.prototype, "replyId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '所回复评论的用户id' }),
    __metadata("design:type", String)
], ResourceDiscussionDto.prototype, "replyUserId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '所回复评论内容' }),
    (0, class_validator_1.IsNotEmpty)({ message: '所回复评论内容不能为空' }),
    __metadata("design:type", String)
], ResourceDiscussionDto.prototype, "content", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '所回复评论的根ID' }),
    __metadata("design:type", Number)
], ResourceDiscussionDto.prototype, "rootDis", void 0);
exports.ResourceDiscussionDto = ResourceDiscussionDto;


/***/ }),
/* 190 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ResourceDiscussion = void 0;
const increment_id_entity_1 = __webpack_require__(17);
const typeorm_1 = __webpack_require__(18);
let ResourceDiscussion = class ResourceDiscussion extends increment_id_entity_1.IncrementIdEntity {
};
__decorate([
    (0, typeorm_1.Column)({
        name: 'type',
        comment: '公共评论类型',
        nullable: false,
    }),
    __metadata("design:type", String)
], ResourceDiscussion.prototype, "type", void 0);
__decorate([
    (0, typeorm_1.Column)({
        name: 'reply_id',
        comment: '所回复的评论id',
        nullable: true,
        default: null,
    }),
    __metadata("design:type", Number)
], ResourceDiscussion.prototype, "replyId", void 0);
__decorate([
    (0, typeorm_1.Column)({
        type: global.DB_IS_SQLITE ? 'text' : 'longtext',
        name: 'reply_user_id',
        comment: '所回复评论的用户ID',
        nullable: true,
        default: null,
    }),
    __metadata("design:type", String)
], ResourceDiscussion.prototype, "replyUserId", void 0);
__decorate([
    (0, typeorm_1.Column)({
        name: 'root_dis',
        comment: '所回复评论的根节点id',
        nullable: true,
        default: null,
    }),
    __metadata("design:type", Number)
], ResourceDiscussion.prototype, "rootDis", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: global.DB_IS_SQLITE ? 'text' : 'longtext', comment: '的评论内容' }),
    __metadata("design:type", String)
], ResourceDiscussion.prototype, "content", void 0);
ResourceDiscussion = __decorate([
    (0, typeorm_1.Entity)()
], ResourceDiscussion);
exports.ResourceDiscussion = ResourceDiscussion;


/***/ }),
/* 191 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b, _c, _d, _e;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ResourceClassifyController = void 0;
const common_1 = __webpack_require__(2);
const swagger_1 = __webpack_require__(23);
const token_data_decorator_1 = __webpack_require__(37);
const token_data_entity_1 = __webpack_require__(42);
const resource_classify_dto_1 = __webpack_require__(192);
const resource_classify_service_1 = __webpack_require__(193);
let ResourceClassifyController = class ResourceClassifyController {
    constructor(resourceClassifyService) {
        this.resourceClassifyService = resourceClassifyService;
    }
    async create(resourceClassifyDto, token) {
        resourceClassifyDto.creator = resourceClassifyDto.updater = token.userId;
        return this.resourceClassifyService.create(resourceClassifyDto);
    }
    async findAll() {
        return this.resourceClassifyService.findAll();
    }
    async update(id, resourceClassifyDto, token) {
        resourceClassifyDto.updater = token.userId;
        return this.resourceClassifyService.update(+id, resourceClassifyDto);
    }
    async remove(id) {
        return this.resourceClassifyService.remove(+id);
    }
};
__decorate([
    (0, common_1.Post)(),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_b = typeof resource_classify_dto_1.ResourceClassifyDto !== "undefined" && resource_classify_dto_1.ResourceClassifyDto) === "function" ? _b : Object, typeof (_c = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _c : Object]),
    __metadata("design:returntype", Promise)
], ResourceClassifyController.prototype, "create", null);
__decorate([
    (0, common_1.Get)(),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Promise)
], ResourceClassifyController.prototype, "findAll", null);
__decorate([
    (0, common_1.Patch)(':id'),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, common_1.Body)()),
    __param(2, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, typeof (_d = typeof resource_classify_dto_1.ResourceClassifyDto !== "undefined" && resource_classify_dto_1.ResourceClassifyDto) === "function" ? _d : Object, typeof (_e = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _e : Object]),
    __metadata("design:returntype", Promise)
], ResourceClassifyController.prototype, "update", null);
__decorate([
    (0, common_1.Delete)(':id'),
    __param(0, (0, common_1.Param)('id')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], ResourceClassifyController.prototype, "remove", null);
ResourceClassifyController = __decorate([
    (0, swagger_1.ApiTags)('系统管理 - 组织机构'),
    (0, swagger_1.ApiBearerAuth)(),
    (0, common_1.Controller)('resource/classify'),
    __metadata("design:paramtypes", [typeof (_a = typeof resource_classify_service_1.ResourceClassifyService !== "undefined" && resource_classify_service_1.ResourceClassifyService) === "function" ? _a : Object])
], ResourceClassifyController);
exports.ResourceClassifyController = ResourceClassifyController;


/***/ }),
/* 192 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ResourceClassifyDto = void 0;
const swagger_1 = __webpack_require__(23);
const class_validator_1 = __webpack_require__(25);
const create_dto_1 = __webpack_require__(39);
class ResourceClassifyDto extends create_dto_1.CreateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '资源类型名称' }),
    (0, class_validator_1.IsNotEmpty)({ message: '资源类型名称不能为空' }),
    __metadata("design:type", String)
], ResourceClassifyDto.prototype, "name", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '上级资源类型' }),
    (0, class_validator_1.IsNotEmpty)({ message: '请选择上级资源类型' }),
    __metadata("design:type", Number)
], ResourceClassifyDto.prototype, "pid", void 0);
exports.ResourceClassifyDto = ResourceClassifyDto;


/***/ }),
/* 193 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ResourceClassifyService = void 0;
const common_1 = __webpack_require__(2);
const typeorm_1 = __webpack_require__(9);
const typeorm_2 = __webpack_require__(18);
const resource_classify_entity_1 = __webpack_require__(194);
let ResourceClassifyService = class ResourceClassifyService {
    constructor(orgRepository) {
        this.orgRepository = orgRepository;
    }
    async create(resourceClassifyDto) {
        await this.orgRepository.insert(resourceClassifyDto);
        return true;
    }
    async findAll() {
        return this.orgRepository.find({
            select: ['id', 'name', 'pid'],
            where: { delFlag: 0 },
        });
    }
    async update(id, resourceClassifyDto) {
        return this.orgRepository.update(id, resourceClassifyDto);
    }
    async remove(id) {
        return this.orgRepository.update(id, { delFlag: 1 });
    }
};
ResourceClassifyService = __decorate([
    (0, common_1.Injectable)(),
    __param(0, (0, typeorm_1.InjectRepository)(resource_classify_entity_1.ResourceClassify)),
    __metadata("design:paramtypes", [typeof (_a = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _a : Object])
], ResourceClassifyService);
exports.ResourceClassifyService = ResourceClassifyService;


/***/ }),
/* 194 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ResourceClassify = void 0;
const increment_id_entity_1 = __webpack_require__(17);
const typeorm_1 = __webpack_require__(18);
let ResourceClassify = class ResourceClassify extends increment_id_entity_1.IncrementIdEntity {
};
__decorate([
    (0, typeorm_1.Column)({ comment: '类型名称' }),
    __metadata("design:type", String)
], ResourceClassify.prototype, "name", void 0);
__decorate([
    (0, typeorm_1.Column)({ default: 0, comment: '上级类型' }),
    __metadata("design:type", Number)
], ResourceClassify.prototype, "pid", void 0);
ResourceClassify = __decorate([
    (0, typeorm_1.Entity)()
], ResourceClassify);
exports.ResourceClassify = ResourceClassify;


/***/ }),
/* 195 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.EvaluationModule = void 0;
const common_1 = __webpack_require__(2);
const evaluation_service_1 = __webpack_require__(196);
const evaluation_controller_1 = __webpack_require__(199);
const evaluation_indicator_controller_1 = __webpack_require__(201);
const evaluation_indicator_service_1 = __webpack_require__(203);
const typeorm_1 = __webpack_require__(9);
const evaluation_entity_1 = __webpack_require__(197);
const evaluation_indicator_entity_1 = __webpack_require__(204);
const student_evaluation_entity_1 = __webpack_require__(198);
let EvaluationModule = class EvaluationModule {
};
EvaluationModule = __decorate([
    (0, common_1.Module)({
        imports: [
            typeorm_1.TypeOrmModule.forFeature([
                evaluation_entity_1.Evaluation,
                evaluation_indicator_entity_1.EvaluationIndicator,
                student_evaluation_entity_1.StudentEvaluation,
            ]),
        ],
        controllers: [evaluation_controller_1.EvaluationController, evaluation_indicator_controller_1.EvaluationIndicatorController],
        providers: [evaluation_service_1.EvaluationService, evaluation_indicator_service_1.EvaluationIndicatorService],
    })
], EvaluationModule);
exports.EvaluationModule = EvaluationModule;


/***/ }),
/* 196 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.EvaluationService = void 0;
const common_1 = __webpack_require__(2);
const typeorm_1 = __webpack_require__(9);
const typeorm_2 = __webpack_require__(18);
const evaluation_entity_1 = __webpack_require__(197);
const student_evaluation_entity_1 = __webpack_require__(198);
let EvaluationService = class EvaluationService {
    constructor(evaluationRepository, studentEvealuation) {
        this.evaluationRepository = evaluationRepository;
        this.studentEvealuation = studentEvealuation;
    }
    async findAllTakeCharge(token) {
        const sql = `SELECT
    se.evaluation evaluation,
    se.update_time,
    u.id studentId,
    u.name,
    u.username account,
    org.name orgName,
    org.id orgId,
    se.id
  FROM
    teacher_student ts
    LEFT JOIN user u  ON ts.student = u.id
    LEFT JOIN student_evaluation se ON se.student_id = u.id 
    LEFT JOIN org on u.org_id = org.id
  WHERE
    ts.teacher = '${token.userId}' and
    (se.id in (select max(se.id) id from student_evaluation se group by se.student_id) or se.id is null)
    `;
        return await this.evaluationRepository.query(sql);
    }
    async create(data) {
        const res = await this.studentEvealuation.save(data);
        return res;
    }
    async findMyEavluation(token) {
        return await this.studentEvealuation.findOneBy({
            studentId: token.userId,
            delFlag: 0,
        });
    }
};
EvaluationService = __decorate([
    (0, common_1.Injectable)(),
    __param(0, (0, typeorm_1.InjectRepository)(evaluation_entity_1.Evaluation)),
    __param(1, (0, typeorm_1.InjectRepository)(student_evaluation_entity_1.StudentEvaluation)),
    __metadata("design:paramtypes", [typeof (_a = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _a : Object, typeof (_b = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _b : Object])
], EvaluationService);
exports.EvaluationService = EvaluationService;


/***/ }),
/* 197 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Evaluation = void 0;
const increment_id_entity_1 = __webpack_require__(17);
const typeorm_1 = __webpack_require__(18);
let Evaluation = class Evaluation extends increment_id_entity_1.IncrementIdEntity {
};
__decorate([
    (0, typeorm_1.Column)({ comment: '评价名' }),
    __metadata("design:type", String)
], Evaluation.prototype, "name", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'app_module', comment: '应用模块' }),
    __metadata("design:type", String)
], Evaluation.prototype, "appModule", void 0);
Evaluation = __decorate([
    (0, typeorm_1.Entity)()
], Evaluation);
exports.Evaluation = Evaluation;


/***/ }),
/* 198 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.StudentEvaluation = void 0;
const increment_id_entity_1 = __webpack_require__(17);
const typeorm_1 = __webpack_require__(18);
let StudentEvaluation = class StudentEvaluation extends increment_id_entity_1.IncrementIdEntity {
};
__decorate([
    (0, typeorm_1.Column)({ name: 'student_id', comment: '学生 ID' }),
    __metadata("design:type", String)
], StudentEvaluation.prototype, "studentId", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '评价分数', type: global.DB_IS_SQLITE ? 'text' : 'longtext' }),
    __metadata("design:type", String)
], StudentEvaluation.prototype, "evaluation", void 0);
StudentEvaluation = __decorate([
    (0, typeorm_1.Entity)()
], StudentEvaluation);
exports.StudentEvaluation = StudentEvaluation;


/***/ }),
/* 199 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b, _c, _d, _e;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.EvaluationController = void 0;
const common_1 = __webpack_require__(2);
const evaluation_service_1 = __webpack_require__(196);
const token_data_decorator_1 = __webpack_require__(37);
const token_data_entity_1 = __webpack_require__(42);
const student_evaluation_dto_1 = __webpack_require__(200);
let EvaluationController = class EvaluationController {
    constructor(evaluationService) {
        this.evaluationService = evaluationService;
    }
    create(data, token) {
        data.creator = data.updater = token.userId;
        return this.evaluationService.create(data);
    }
    findAllTakeChargeStudent(token) {
        return this.evaluationService.findAllTakeCharge(token);
    }
    findMyEavluation(token) {
        return this.evaluationService.findMyEavluation(token);
    }
};
__decorate([
    (0, common_1.Post)(),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_b = typeof student_evaluation_dto_1.StudentEvaluationDto !== "undefined" && student_evaluation_dto_1.StudentEvaluationDto) === "function" ? _b : Object, typeof (_c = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _c : Object]),
    __metadata("design:returntype", void 0)
], EvaluationController.prototype, "create", null);
__decorate([
    (0, common_1.Get)(),
    __param(0, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_d = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _d : Object]),
    __metadata("design:returntype", void 0)
], EvaluationController.prototype, "findAllTakeChargeStudent", null);
__decorate([
    (0, common_1.Get)('my'),
    __param(0, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_e = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _e : Object]),
    __metadata("design:returntype", void 0)
], EvaluationController.prototype, "findMyEavluation", null);
EvaluationController = __decorate([
    (0, common_1.Controller)('evaluation'),
    __metadata("design:paramtypes", [typeof (_a = typeof evaluation_service_1.EvaluationService !== "undefined" && evaluation_service_1.EvaluationService) === "function" ? _a : Object])
], EvaluationController);
exports.EvaluationController = EvaluationController;


/***/ }),
/* 200 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.StudentEvaluationDto = void 0;
const swagger_1 = __webpack_require__(23);
const class_validator_1 = __webpack_require__(25);
const create_dto_1 = __webpack_require__(39);
class StudentEvaluationDto extends create_dto_1.CreateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '学员 ID' }),
    (0, class_validator_1.IsNotEmpty)({ message: '请选择学员' }),
    __metadata("design:type", String)
], StudentEvaluationDto.prototype, "studentId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '评价指标 ID', example: '1:5,2:5,3:5' }),
    (0, class_validator_1.IsNotEmpty)({ message: '请选择评价指标项' }),
    __metadata("design:type", String)
], StudentEvaluationDto.prototype, "evaluation", void 0);
exports.StudentEvaluationDto = StudentEvaluationDto;


/***/ }),
/* 201 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b, _c;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.EvaluationIndicatorController = void 0;
const common_1 = __webpack_require__(2);
const token_data_decorator_1 = __webpack_require__(37);
const token_data_entity_1 = __webpack_require__(42);
const evaluation_indicator_dto_1 = __webpack_require__(202);
const evaluation_indicator_service_1 = __webpack_require__(203);
let EvaluationIndicatorController = class EvaluationIndicatorController {
    constructor(evaluationIndicatorService) {
        this.evaluationIndicatorService = evaluationIndicatorService;
    }
    editor(data, token) {
        data.updater = token.userId;
        data.creator = 'SYSTEM';
        return this.evaluationIndicatorService.editor(data);
    }
    getInfo() {
        return this.evaluationIndicatorService.getInfo();
    }
};
__decorate([
    (0, common_1.Post)(),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_b = typeof evaluation_indicator_dto_1.EvaluationIndicatorDto !== "undefined" && evaluation_indicator_dto_1.EvaluationIndicatorDto) === "function" ? _b : Object, typeof (_c = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _c : Object]),
    __metadata("design:returntype", void 0)
], EvaluationIndicatorController.prototype, "editor", null);
__decorate([
    (0, common_1.Get)(),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", void 0)
], EvaluationIndicatorController.prototype, "getInfo", null);
EvaluationIndicatorController = __decorate([
    (0, common_1.Controller)('evaluation/indicator'),
    __metadata("design:paramtypes", [typeof (_a = typeof evaluation_indicator_service_1.EvaluationIndicatorService !== "undefined" && evaluation_indicator_service_1.EvaluationIndicatorService) === "function" ? _a : Object])
], EvaluationIndicatorController);
exports.EvaluationIndicatorController = EvaluationIndicatorController;


/***/ }),
/* 202 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.EvaluationIndicatorDto = void 0;
const swagger_1 = __webpack_require__(23);
const class_validator_1 = __webpack_require__(25);
const create_dto_1 = __webpack_require__(39);
class EvaluationIndicatorDto extends create_dto_1.CreateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '评价指标维度' }),
    (0, class_validator_1.IsNotEmpty)({ message: '评价指标不能为空' }),
    __metadata("design:type", Object)
], EvaluationIndicatorDto.prototype, "evaluationRule", void 0);
exports.EvaluationIndicatorDto = EvaluationIndicatorDto;


/***/ }),
/* 203 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.EvaluationIndicatorService = void 0;
const common_1 = __webpack_require__(2);
const typeorm_1 = __webpack_require__(9);
const typeorm_2 = __webpack_require__(18);
const evaluation_indicator_entity_1 = __webpack_require__(204);
let EvaluationIndicatorService = class EvaluationIndicatorService {
    constructor(eiRepository) {
        this.eiRepository = eiRepository;
    }
    async editor(data) {
        return this.eiRepository.save(Object.assign(Object.assign({}, data), { id: 1 }));
    }
    async getInfo() {
        return this.eiRepository.findOneBy({ id: 1 });
    }
};
EvaluationIndicatorService = __decorate([
    (0, common_1.Injectable)(),
    __param(0, (0, typeorm_1.InjectRepository)(evaluation_indicator_entity_1.EvaluationIndicator)),
    __metadata("design:paramtypes", [typeof (_a = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _a : Object])
], EvaluationIndicatorService);
exports.EvaluationIndicatorService = EvaluationIndicatorService;


/***/ }),
/* 204 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.EvaluationIndicator = void 0;
const increment_id_entity_1 = __webpack_require__(17);
const typeorm_1 = __webpack_require__(18);
let EvaluationIndicator = class EvaluationIndicator extends increment_id_entity_1.IncrementIdEntity {
};
__decorate([
    (0, typeorm_1.Column)({ comment: '评价指标名', type: 'json' }),
    __metadata("design:type", Object)
], EvaluationIndicator.prototype, "evaluationRule", void 0);
EvaluationIndicator = __decorate([
    (0, typeorm_1.Entity)()
], EvaluationIndicator);
exports.EvaluationIndicator = EvaluationIndicator;


/***/ }),
/* 205 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.InitializeModule = void 0;
const common_1 = __webpack_require__(2);
const initialize_controller_1 = __webpack_require__(206);
let InitializeModule = class InitializeModule {
};
InitializeModule = __decorate([
    (0, common_1.Module)({
        controllers: [initialize_controller_1.InitializeController],
    })
], InitializeModule);
exports.InitializeModule = InitializeModule;


/***/ }),
/* 206 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var _a;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.InitializeController = void 0;
const common_1 = __webpack_require__(2);
const no_token_decorator_1 = __webpack_require__(26);
const user_entity_1 = __webpack_require__(21);
const typeorm_1 = __webpack_require__(18);
const data_source_1 = __webpack_require__(207);
let InitializeController = class InitializeController {
    constructor(dataSource) {
        this.dataSource = dataSource;
        this.hasInitSystem = false;
    }
    async initialize() {
        return this.dataSource.transaction(async (manager) => {
            if (this.hasInitSystem)
                throw '系统已初始化';
            this.hasInitSystem = true;
            const user = await manager.findOneBy(user_entity_1.User, { username: 'admin' });
            if (user)
                throw '系统已初始化';
            for (const [entity, dataList] of data_source_1.default) {
                manager.insert(entity, dataList);
            }
            return '系统数据初始化成功';
        });
    }
};
__decorate([
    (0, common_1.Get)(),
    (0, no_token_decorator_1.NoAuthToken)(),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Promise)
], InitializeController.prototype, "initialize", null);
InitializeController = __decorate([
    (0, common_1.Controller)('initialize'),
    __metadata("design:paramtypes", [typeof (_a = typeof typeorm_1.DataSource !== "undefined" && typeorm_1.DataSource) === "function" ? _a : Object])
], InitializeController);
exports.InitializeController = InitializeController;


/***/ }),
/* 207 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

"use strict";

Object.defineProperty(exports, "__esModule", ({ value: true }));
const question_difficulty_level_entity_1 = __webpack_require__(125);
const question_type_entity_1 = __webpack_require__(79);
const resource_classify_entity_1 = __webpack_require__(194);
const feature_entity_1 = __webpack_require__(29);
const role_entity_1 = __webpack_require__(20);
const user_entity_1 = __webpack_require__(21);
const dataSources = [
    [
        user_entity_1.User, [
            { username: 'admin', name: '系统管理员', password: '123456', type: 1, roleId: 1 }
        ]
    ],
    [
        role_entity_1.Role, [
            { id: 1, base: 1, name: '管理员' },
            { id: 2, base: 2, name: '教员' },
            { id: 3, base: 3, name: '学员' },
        ]
    ],
    [
        feature_entity_1.Feature, [
            { name: 'system', type: 1, roleId: 1 },
            { name: 'user', type: 1, roleId: 1 },
            { name: 'org', type: 1, roleId: 1 },
            { name: 'role', type: 1, roleId: 1 },
            { name: 'resource', type: 1, roleId: 1 },
            { name: 'resource-manage', type: 1, roleId: 1 },
            { name: 'resource-share', type: 1, roleId: 1 },
            { name: 'online-course', type: 1, roleId: 1 },
            { name: 'course-manage', type: 1, roleId: 1 },
            { name: 'my-course', type: 1, roleId: 1 },
            { name: 'class-notes', type: 1, roleId: 1 },
            { name: 'online-FAQ', type: 1, roleId: 1 },
            { name: 'live-lectures', type: 1, roleId: 1 },
            { name: 'live-in-class', type: 1, roleId: 1 },
            { name: 'assessment-evaluation', type: 1, roleId: 1 },
            { name: 'question-bank-manage', type: 1, roleId: 1 },
            { name: 'examination-paper-manage', type: 1, roleId: 1 },
            { name: 'exam-arrangement', type: 1, roleId: 1 },
            { name: 'human-evaluation', type: 1, roleId: 1 },
            { name: 'simulation-test', type: 1, roleId: 1 },
            { name: 'online-test', type: 1, roleId: 1 },
            { name: 'wrong-topic-consolidate', type: 1, roleId: 1 },
            { name: 'evaluation', type: 1, roleId: 1 },
            { name: 'student-evaluation', type: 1, roleId: 1 },
            { name: 'evaluation-setting', type: 1, roleId: 1 },
            { name: 'online-course', type: 1, roleId: 2 },
            { name: 'online-FAQ', type: 1, roleId: 2 },
            { name: 'resource', type: 1, roleId: 2 },
            { name: 'resource-manage', type: 1, roleId: 2 },
            { name: 'resource-share', type: 1, roleId: 2 },
            { name: 'course-manage', type: 1, roleId: 2 },
            { name: 'live-lectures', type: 1, roleId: 2 },
            { name: 'assessment-evaluation', type: 1, roleId: 2 },
            { name: 'question-bank-manage', type: 1, roleId: 2 },
            { name: 'examination-paper-manage', type: 1, roleId: 2 },
            { name: 'exam-arrangement', type: 1, roleId: 2 },
            { name: 'human-evaluation', type: 1, roleId: 2 },
            { name: 'online-course', type: 1, roleId: 3 },
            { name: 'my-course', type: 1, roleId: 3 },
            { name: 'resource', type: 1, roleId: 3 },
            { name: 'resource-share', type: 1, roleId: 3 },
            { name: 'class-notes', type: 1, roleId: 3 },
            { name: 'online-FAQ', type: 1, roleId: 3 },
            { name: 'live-in-class', type: 1, roleId: 3 },
            { name: 'assessment-evaluation', type: 1, roleId: 3 },
            { name: 'simulation-test', type: 1, roleId: 3 },
            { name: 'online-test', type: 1, roleId: 3 },
            { name: 'wrong-topic-consolidate', type: 1, roleId: 3 },
        ]
    ],
    [
        resource_classify_entity_1.ResourceClassify, [
            { id: 1, name: '课程资源' },
            { id: 2, name: '图片', pid: 1 },
            { id: 3, name: '视频', pid: 1 },
            { id: 4, name: '音乐', pid: 1 },
            { id: 5, name: '文档', pid: 1 },
            { id: 6, name: '我的', pid: 1 },
            { id: 7, name: '其他' },
        ]
    ],
    [
        question_type_entity_1.QuestionType, [
            { id: 1, name: '单选题', element: "radio" },
            { id: 2, name: '多选题', element: "checkbox" },
            { id: 3, name: '判断题', element: "radio*2" },
            { id: 4, name: '填空题', element: "input" },
            { id: 5, name: '简答题', element: "textarea" },
        ]
    ],
    [
        question_difficulty_level_entity_1.QuestionDifficultyLevel, [
            { id: 1, name: '易' },
            { id: 2, name: '较易' },
            { id: 3, name: '中等' },
            { id: 4, name: '较难' },
            { id: 5, name: '难' },
        ]
    ]
];
for (const ds of dataSources) {
    for (const item of ds[1]) {
        item.creator = item.updater = 'SYSTEM';
    }
}
exports["default"] = dataSources;


/***/ }),
/* 208 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.StatisticModule = void 0;
const common_1 = __webpack_require__(2);
const typeorm_1 = __webpack_require__(9);
const report_data_entity_1 = __webpack_require__(209);
const statistic_controller_1 = __webpack_require__(210);
let StatisticModule = class StatisticModule {
};
StatisticModule = __decorate([
    (0, common_1.Module)({
        imports: [typeorm_1.TypeOrmModule.forFeature([report_data_entity_1.ReportData])],
        controllers: [statistic_controller_1.StatisticController],
    })
], StatisticModule);
exports.StatisticModule = StatisticModule;


/***/ }),
/* 209 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var _a, _b;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ReportData = void 0;
const typeorm_1 = __webpack_require__(18);
let ReportData = class ReportData {
};
__decorate([
    (0, typeorm_1.PrimaryGeneratedColumn)('increment'),
    __metadata("design:type", Number)
], ReportData.prototype, "id", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'create_time', comment: '上报数据创建时间' }),
    __metadata("design:type", typeof (_a = typeof Date !== "undefined" && Date) === "function" ? _a : Object)
], ReportData.prototype, "createTime", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'end_time', comment: '上报结束时间' }),
    __metadata("design:type", typeof (_b = typeof Date !== "undefined" && Date) === "function" ? _b : Object)
], ReportData.prototype, "endTime", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '预览人' }),
    __metadata("design:type", String)
], ReportData.prototype, "creator", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '数据类型' }),
    __metadata("design:type", String)
], ReportData.prototype, "type", void 0);
__decorate([
    (0, typeorm_1.Column)({ comment: '上报页面' }),
    __metadata("design:type", String)
], ReportData.prototype, "page", void 0);
__decorate([
    (0, typeorm_1.VersionColumn)({ select: false, comment: '更新版本' }),
    __metadata("design:type", Number)
], ReportData.prototype, "version", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true, comment: '备注说明' }),
    __metadata("design:type", String)
], ReportData.prototype, "remarks", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true, comment: '备用字段' }),
    __metadata("design:type", String)
], ReportData.prototype, "field01", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true, comment: '备用字段' }),
    __metadata("design:type", String)
], ReportData.prototype, "field02", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true, comment: '备用字段' }),
    __metadata("design:type", String)
], ReportData.prototype, "field03", void 0);
ReportData = __decorate([
    (0, typeorm_1.Entity)()
], ReportData);
exports.ReportData = ReportData;


/***/ }),
/* 210 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b, _c, _d;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.StatisticController = void 0;
const common_1 = __webpack_require__(2);
const token_data_decorator_1 = __webpack_require__(37);
const token_data_entity_1 = __webpack_require__(42);
const typeorm_1 = __webpack_require__(18);
const report_data_entity_1 = __webpack_require__(209);
let StatisticController = class StatisticController {
    constructor(dataSource) {
        this.dataSource = dataSource;
    }
    async findData(query, token) {
        var _a;
        try {
            const { handler } = await (_a = `./service/${{ 1: 'admin', 2: 'teacher', 3: 'student' }[token.baseRole]}/${query.module}/${query.fun}.js`, Promise.resolve().then(() => __webpack_require__(211)(_a)));
            return handler(this.dataSource, { query, user: token });
        }
        catch (error) {
            console.error(error);
            throw '出错了，请稍后再试';
        }
    }
    async reportData(data, token) {
        const currentTime = new Date();
        if (data.id) {
            this.dataSource
                .getRepository(report_data_entity_1.ReportData)
                .update(data.id, Object.assign(Object.assign({}, data), { endTime: currentTime }));
        }
        else {
            const { raw } = await this.dataSource.getRepository(report_data_entity_1.ReportData).insert(Object.assign(Object.assign({}, data), { creator: token.userId, createTime: currentTime, endTime: currentTime }));
            data.id = raw.insertId;
        }
        return data.id;
    }
};
__decorate([
    (0, common_1.Get)(),
    __param(0, (0, common_1.Query)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, typeof (_b = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _b : Object]),
    __metadata("design:returntype", Promise)
], StatisticController.prototype, "findData", null);
__decorate([
    (0, common_1.Post)('reportData'),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_c = typeof report_data_entity_1.ReportData !== "undefined" && report_data_entity_1.ReportData) === "function" ? _c : Object, typeof (_d = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _d : Object]),
    __metadata("design:returntype", Promise)
], StatisticController.prototype, "reportData", null);
StatisticController = __decorate([
    (0, common_1.Controller)('statistic'),
    __metadata("design:paramtypes", [typeof (_a = typeof typeorm_1.DataSource !== "undefined" && typeorm_1.DataSource) === "function" ? _a : Object])
], StatisticController);
exports.StatisticController = StatisticController;


/***/ }),
/* 211 */
/***/ ((module) => {

function webpackEmptyContext(req) {
	var e = new Error("Cannot find module '" + req + "'");
	e.code = 'MODULE_NOT_FOUND';
	throw e;
}
webpackEmptyContext.keys = () => ([]);
webpackEmptyContext.resolve = webpackEmptyContext;
webpackEmptyContext.id = 211;
module.exports = webpackEmptyContext;

/***/ }),
/* 212 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ArticleManageModule = void 0;
const common_1 = __webpack_require__(2);
const article_manage_service_1 = __webpack_require__(213);
const article_manage_controller_1 = __webpack_require__(216);
const typeorm_1 = __webpack_require__(9);
const article_manage_entity_1 = __webpack_require__(214);
const manuals_manage_entity_1 = __webpack_require__(215);
let ArticleManageModule = class ArticleManageModule {
};
ArticleManageModule = __decorate([
    (0, common_1.Module)({
        imports: [typeorm_1.TypeOrmModule.forFeature([article_manage_entity_1.ArticleManage, manuals_manage_entity_1.ManualsManage])],
        controllers: [article_manage_controller_1.ArticleManageController],
        providers: [article_manage_service_1.ArticleManageService],
    })
], ArticleManageModule);
exports.ArticleManageModule = ArticleManageModule;


/***/ }),
/* 213 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ArticleManageService = void 0;
const common_1 = __webpack_require__(2);
const typeorm_1 = __webpack_require__(9);
const typeorm_2 = __webpack_require__(18);
const article_manage_entity_1 = __webpack_require__(214);
const manuals_manage_entity_1 = __webpack_require__(215);
var lookOrEditor;
(function (lookOrEditor) {
    lookOrEditor["A"] = "canView";
    lookOrEditor["B"] = "canEditor";
})(lookOrEditor || (lookOrEditor = {}));
let ArticleManageService = class ArticleManageService {
    constructor(articleSql, manualsSql) {
        this.articleSql = articleSql;
        this.manualsSql = manualsSql;
    }
    async create(articeData, req) {
        for (const k in articeData) {
            const type = typeof articeData[k];
            if (type == 'object') {
                articeData[k] = JSON.stringify(articeData[k]);
            }
        }
        const artice = articeData;
        this.manualsSql.update({ id: articeData.manuals }, { updateTime: new Date() });
        return await this.articleSql.save(artice);
    }
    async findAll(req) {
        const result = await this.articleSql.findBy({ delFlag: 0 });
        return result;
    }
    async findManualsAll(id, token) {
        const result = await this.articleSql.findBy({ delFlag: 0, manuals: id });
        return result;
    }
    async findOne(id, req) {
        const result = await this.articleSql.findOneBy({ id, delFlag: 0 });
        if (!result) {
            throw '未查询到此文章';
        }
        return result;
    }
    async update(updateDto, req) {
        const updateData = updateDto;
        for (const k in updateData) {
            const type = typeof updateData[k];
            if (type == 'object') {
                updateData[k] = JSON.stringify(updateData[k]);
            }
        }
        const res = await this.articleSql.save(updateData);
        this.manualsSql.update({ id: updateDto.manuals }, { updateTime: new Date() });
        this.manualsSql.update({ id: res.manuals }, { updateTime: new Date() });
        console.log(res);
        return res;
    }
    async sort(sortIdArray) {
        const formatData = sortIdArray.map((id, index) => {
            return {
                id,
                index: index + 1,
            };
        });
        const result = await this.articleSql.save(formatData);
        return result;
    }
    async updatePortion(data, req) {
        console.log(data);
        let result = await this.articleSql.update(data.id, data.data);
        result = await this.articleSql.findBy({
            manuals: data.manuals,
            delFlag: 0,
        });
        this.manualsSql.update({ id: data.manuals }, { updateTime: new Date() });
        return result;
    }
    remove(id, req) {
        const result = this.articleSql.update(id, { delFlag: 1 });
        return result;
    }
};
ArticleManageService = __decorate([
    (0, common_1.Injectable)(),
    __param(0, (0, typeorm_1.InjectRepository)(article_manage_entity_1.ArticleManage)),
    __param(1, (0, typeorm_1.InjectRepository)(manuals_manage_entity_1.ManualsManage)),
    __metadata("design:paramtypes", [typeof (_a = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _a : Object, typeof (_b = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _b : Object])
], ArticleManageService);
exports.ArticleManageService = ArticleManageService;


/***/ }),
/* 214 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ArticleManage = void 0;
const increment_id_entity_1 = __webpack_require__(17);
const typeorm_1 = __webpack_require__(18);
let ArticleManage = class ArticleManage extends increment_id_entity_1.IncrementIdEntity {
};
__decorate([
    (0, typeorm_1.Column)(),
    __metadata("design:type", String)
], ArticleManage.prototype, "title", void 0);
__decorate([
    (0, typeorm_1.Column)({ default: '' }),
    __metadata("design:type", String)
], ArticleManage.prototype, "explain", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: global.DB_IS_SQLITE ? 'text' : 'longtext' }),
    __metadata("design:type", String)
], ArticleManage.prototype, "content", void 0);
__decorate([
    (0, typeorm_1.Column)({ default: 0 }),
    __metadata("design:type", Number)
], ArticleManage.prototype, "manuals", void 0);
__decorate([
    (0, typeorm_1.Column)({ default: 0 }),
    __metadata("design:type", Number)
], ArticleManage.prototype, "parentId", void 0);
__decorate([
    (0, typeorm_1.Column)({ default: 0 }),
    __metadata("design:type", String)
], ArticleManage.prototype, "type", void 0);
__decorate([
    (0, typeorm_1.Column)(),
    __metadata("design:type", Boolean)
], ArticleManage.prototype, "resourceAuthority", void 0);
__decorate([
    (0, typeorm_1.Column)({ default: 0 }),
    __metadata("design:type", Number)
], ArticleManage.prototype, "index", void 0);
__decorate([
    (0, typeorm_1.Column)(),
    __metadata("design:type", Number)
], ArticleManage.prototype, "image", void 0);
__decorate([
    (0, typeorm_1.Column)(),
    __metadata("design:type", Number)
], ArticleManage.prototype, "video", void 0);
__decorate([
    (0, typeorm_1.Column)(),
    __metadata("design:type", Number)
], ArticleManage.prototype, "audio", void 0);
__decorate([
    (0, typeorm_1.Column)(),
    __metadata("design:type", Number)
], ArticleManage.prototype, "model", void 0);
ArticleManage = __decorate([
    (0, typeorm_1.Entity)()
], ArticleManage);
exports.ArticleManage = ArticleManage;


/***/ }),
/* 215 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ManualsManage = void 0;
const increment_id_entity_1 = __webpack_require__(17);
const typeorm_1 = __webpack_require__(18);
let ManualsManage = class ManualsManage extends increment_id_entity_1.IncrementIdEntity {
};
__decorate([
    (0, typeorm_1.Column)(),
    __metadata("design:type", String)
], ManualsManage.prototype, "name", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: global.DB_IS_SQLITE ? 'text' : 'longtext' }),
    __metadata("design:type", String)
], ManualsManage.prototype, "explain", void 0);
__decorate([
    (0, typeorm_1.Column)(),
    __metadata("design:type", String)
], ManualsManage.prototype, "compile", void 0);
__decorate([
    (0, typeorm_1.Column)(),
    __metadata("design:type", String)
], ManualsManage.prototype, "publish", void 0);
__decorate([
    (0, typeorm_1.Column)(),
    __metadata("design:type", String)
], ManualsManage.prototype, "cover", void 0);
__decorate([
    (0, typeorm_1.Column)(),
    __metadata("design:type", Boolean)
], ManualsManage.prototype, "stick", void 0);
__decorate([
    (0, typeorm_1.Column)(),
    __metadata("design:type", String)
], ManualsManage.prototype, "canEditor", void 0);
__decorate([
    (0, typeorm_1.Column)(),
    __metadata("design:type", String)
], ManualsManage.prototype, "canView", void 0);
__decorate([
    (0, typeorm_1.Column)(),
    __metadata("design:type", String)
], ManualsManage.prototype, "password", void 0);
__decorate([
    (0, typeorm_1.Column)({ default: 0 }),
    __metadata("design:type", Number)
], ManualsManage.prototype, "classify", void 0);
ManualsManage = __decorate([
    (0, typeorm_1.Entity)()
], ManualsManage);
exports.ManualsManage = ManualsManage;


/***/ }),
/* 216 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b, _c, _d, _e;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ArticleManageController = void 0;
const common_1 = __webpack_require__(2);
const swagger_1 = __webpack_require__(23);
const no_token_decorator_1 = __webpack_require__(26);
const token_data_decorator_1 = __webpack_require__(37);
const token_data_entity_1 = __webpack_require__(42);
const article_manage_service_1 = __webpack_require__(213);
const create_article_manage_dto_1 = __webpack_require__(217);
const update_article_manage_dto_1 = __webpack_require__(218);
const update_portion_article_dto_1 = __webpack_require__(219);
let ArticleManageController = class ArticleManageController {
    constructor(articleManageService) {
        this.articleManageService = articleManageService;
    }
    create(createArticleManageDto, req) {
        return this.articleManageService.create(createArticleManageDto, req);
    }
    findAll(req) {
        return this.articleManageService.findAll(req);
    }
    findManualsAll(id, token) {
        return this.articleManageService.findManualsAll(id, token);
    }
    findOne(id, req) {
        return this.articleManageService.findOne(+id, req);
    }
    update(updateArticleManageDto, req) {
        return this.articleManageService.update(updateArticleManageDto, req);
    }
    updatePortion(data, req) {
        return this.articleManageService.updatePortion(data, req);
    }
    sort(sortIdArray) {
        return this.articleManageService.sort(sortIdArray);
    }
    remove(id, req) {
        return this.articleManageService.remove(+id, req);
    }
};
__decorate([
    (0, common_1.Post)(),
    (0, swagger_1.ApiOperation)({ summary: '新建文章' }),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, common_1.Request)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_b = typeof create_article_manage_dto_1.CreateArticleManageDto !== "undefined" && create_article_manage_dto_1.CreateArticleManageDto) === "function" ? _b : Object, Object]),
    __metadata("design:returntype", void 0)
], ArticleManageController.prototype, "create", null);
__decorate([
    (0, common_1.Get)(),
    (0, swagger_1.ApiOperation)({ summary: '获取所有文章' }),
    __param(0, (0, common_1.Request)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object]),
    __metadata("design:returntype", void 0)
], ArticleManageController.prototype, "findAll", null);
__decorate([
    (0, common_1.Get)('manuals/:id'),
    (0, swagger_1.ApiOperation)({ summary: '获取手册下的文章' }),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, typeof (_c = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _c : Object]),
    __metadata("design:returntype", void 0)
], ArticleManageController.prototype, "findManualsAll", null);
__decorate([
    (0, common_1.Get)(':id'),
    (0, swagger_1.ApiOperation)({ summary: '根据ID获取文章' }),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, common_1.Request)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, Object]),
    __metadata("design:returntype", void 0)
], ArticleManageController.prototype, "findOne", null);
__decorate([
    (0, common_1.Patch)(),
    (0, swagger_1.ApiOperation)({ summary: '编辑文章' }),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, common_1.Request)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_d = typeof update_article_manage_dto_1.UpdateArticleManageDto !== "undefined" && update_article_manage_dto_1.UpdateArticleManageDto) === "function" ? _d : Object, Object]),
    __metadata("design:returntype", void 0)
], ArticleManageController.prototype, "update", null);
__decorate([
    (0, common_1.Post)('portion'),
    (0, swagger_1.ApiOperation)({ summary: '批量编辑文章' }),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, common_1.Request)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_e = typeof update_portion_article_dto_1.updatePortionArticle !== "undefined" && update_portion_article_dto_1.updatePortionArticle) === "function" ? _e : Object, Object]),
    __metadata("design:returntype", void 0)
], ArticleManageController.prototype, "updatePortion", null);
__decorate([
    (0, common_1.Post)('sort'),
    (0, swagger_1.ApiOperation)({ summary: '文章排序' }),
    __param(0, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Array]),
    __metadata("design:returntype", void 0)
], ArticleManageController.prototype, "sort", null);
__decorate([
    (0, common_1.Delete)(':id'),
    (0, swagger_1.ApiOperation)({ summary: '删除文章' }),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, common_1.Request)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, Object]),
    __metadata("design:returntype", void 0)
], ArticleManageController.prototype, "remove", null);
ArticleManageController = __decorate([
    (0, swagger_1.ApiTags)('文章管理'),
    (0, common_1.Controller)('article-manage'),
    (0, no_token_decorator_1.NoAuthToken)(),
    __metadata("design:paramtypes", [typeof (_a = typeof article_manage_service_1.ArticleManageService !== "undefined" && article_manage_service_1.ArticleManageService) === "function" ? _a : Object])
], ArticleManageController);
exports.ArticleManageController = ArticleManageController;


/***/ }),
/* 217 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CreateArticleManageDto = void 0;
const swagger_1 = __webpack_require__(23);
const class_validator_1 = __webpack_require__(25);
class CreateArticleManageDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '文章标题', example: '测试文章' }),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], CreateArticleManageDto.prototype, "title", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '文章说明', example: '这里是测试文章' }),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], CreateArticleManageDto.prototype, "explain", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '文章内容', example: 'xxxx' }),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], CreateArticleManageDto.prototype, "content", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '所属手册', example: '1' }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", Number)
], CreateArticleManageDto.prototype, "manuals", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({
        description: '类型：可以是文档或者是分组，值为：article|group',
        example: 'article',
    }),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], CreateArticleManageDto.prototype, "type", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '父级ID', example: '0' }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", Number)
], CreateArticleManageDto.prototype, "parentId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '资源是否可下载', example: true }),
    (0, class_validator_1.IsBoolean)({ message: '请传递resourceAuthority参数为boolean值' }),
    __metadata("design:type", Boolean)
], CreateArticleManageDto.prototype, "resourceAuthority", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '在当前父级的序号', example: 1 }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", Number)
], CreateArticleManageDto.prototype, "index", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '文章中所含视频数量', example: 1 }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", Number)
], CreateArticleManageDto.prototype, "video", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '文章中所含视频数量', example: 1 }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", Number)
], CreateArticleManageDto.prototype, "image", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '文章中所含模型数量', example: 1 }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", Number)
], CreateArticleManageDto.prototype, "model", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '文章中所含音频数量', example: 1 }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", Number)
], CreateArticleManageDto.prototype, "audio", void 0);
exports.CreateArticleManageDto = CreateArticleManageDto;


/***/ }),
/* 218 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

"use strict";

Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.UpdateArticleManageDto = void 0;
const swagger_1 = __webpack_require__(23);
const create_article_manage_dto_1 = __webpack_require__(217);
class UpdateArticleManageDto extends (0, swagger_1.PartialType)(create_article_manage_dto_1.CreateArticleManageDto) {
}
exports.UpdateArticleManageDto = UpdateArticleManageDto;


/***/ }),
/* 219 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.updatePortionArticle = void 0;
const swagger_1 = __webpack_require__(23);
const class_validator_1 = __webpack_require__(25);
class updatePortionArticle {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '更新文章所属标题', example: '测试文章' }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", Number)
], updatePortionArticle.prototype, "manuals", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '更新文章的相关数据', example: { delFlag: 1 } }),
    (0, class_validator_1.IsObject)(),
    __metadata("design:type", Object)
], updatePortionArticle.prototype, "data", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '更新文章的ID，可以是数组，也可以是单个数字', example: [1, 2, 3] }),
    __metadata("design:type", Object)
], updatePortionArticle.prototype, "id", void 0);
exports.updatePortionArticle = updatePortionArticle;


/***/ }),
/* 220 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ManualsManageModule = void 0;
const common_1 = __webpack_require__(2);
const manuals_manage_service_1 = __webpack_require__(221);
const manuals_manage_controller_1 = __webpack_require__(223);
const typeorm_1 = __webpack_require__(9);
const manuals_manage_entity_1 = __webpack_require__(215);
const role_entity_1 = __webpack_require__(20);
const user_entity_1 = __webpack_require__(21);
const manuals_manage_classify_entity_1 = __webpack_require__(222);
let ManualsManageModule = class ManualsManageModule {
};
ManualsManageModule = __decorate([
    (0, common_1.Module)({
        imports: [
            typeorm_1.TypeOrmModule.forFeature([
                manuals_manage_entity_1.ManualsManage,
                user_entity_1.User,
                role_entity_1.Role,
                manuals_manage_classify_entity_1.MnaualsManageClassify,
            ]),
        ],
        controllers: [manuals_manage_controller_1.ManualsManageController],
        providers: [manuals_manage_service_1.ManualsManageService],
    })
], ManualsManageModule);
exports.ManualsManageModule = ManualsManageModule;


/***/ }),
/* 221 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b, _c;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ManualsManageService = void 0;
const common_1 = __webpack_require__(2);
const typeorm_1 = __webpack_require__(9);
const typeorm_2 = __webpack_require__(18);
const manuals_manage_entity_1 = __webpack_require__(215);
const user_entity_1 = __webpack_require__(21);
const manuals_manage_classify_entity_1 = __webpack_require__(222);
var lookOrEditor;
(function (lookOrEditor) {
    lookOrEditor["A"] = "canView";
    lookOrEditor["B"] = "canEditor";
})(lookOrEditor || (lookOrEditor = {}));
let ManualsManageService = class ManualsManageService {
    constructor(manualsSql, userServe, manualsClassify) {
        this.manualsSql = manualsSql;
        this.userServe = userServe;
        this.manualsClassify = manualsClassify;
    }
    async create(manualsInfo, req) {
        const saveData = manualsInfo;
        saveData.canEditor = JSON.stringify(manualsInfo.canEditor);
        saveData.canView = JSON.stringify(manualsInfo.canView);
        const result = await this.manualsSql.save(saveData);
        if (!result) {
            throw '新建手册失败';
        }
        return result;
    }
    async findAll(token, classifyId) {
        let result;
        if (classifyId) {
            result = await this.manualsSql.findBy({
                delFlag: 0,
                classify: classifyId,
            });
        }
        else {
            result = await this.manualsSql.findBy({ delFlag: 0 });
        }
        result.forEach((item) => {
            item.canEditor = JSON.parse(item.canEditor ? item.canEditor : '[]');
            item.canView = JSON.parse(item.canView ? item.canView : '[]');
        });
        return result;
    }
    async findOne(id) {
        const result = await this.manualsSql.findOneBy({ id, delFlag: 0 });
        if (!result) {
            throw '此手册不存在，或已经被删除！';
        }
        result.canView = JSON.parse(result.canView ? result.canView : '[]');
        result.canEditor = JSON.parse(result.canEditor ? result.canEditor : '[]');
        return result;
    }
    async update(id, updateManualsManageDto, req) {
        const manualsInfo = await this.manualsSql.findOneBy({ id, delFlag: 0 });
        if (!manualsInfo) {
            throw '手册不存在，无法编辑！';
        }
        const saveData = updateManualsManageDto;
        saveData.canEditor = JSON.stringify(updateManualsManageDto.canEditor);
        saveData.canView = JSON.stringify(updateManualsManageDto.canView);
        const result = await this.manualsSql.save(Object.assign(Object.assign({}, saveData), { id }));
        return result;
    }
    async portionUpdate(idArray, data, req) {
        const result = await this.manualsSql.update(idArray, data);
        if (result.affected < 0) {
            throw '数据修改失败';
        }
        return await this.findAll(req, null);
    }
    async remove(id) {
        const result = await this.manualsSql.update(id, { delFlag: 1 });
        if (result.affected < 1) {
            throw '未知原因';
        }
        return result;
    }
    async findAllClassify() {
        const res = await this.manualsClassify.findBy({ delFlag: 0 });
        return res;
    }
    async createClassify(data) {
        const res = await this.manualsClassify.save(data);
        return res;
    }
    async deleteClassify(id) {
        const result = await this.manualsClassify.update(id, { delFlag: 1 });
        return result;
    }
};
ManualsManageService = __decorate([
    (0, common_1.Injectable)(),
    __param(0, (0, typeorm_1.InjectRepository)(manuals_manage_entity_1.ManualsManage)),
    __param(1, (0, typeorm_1.InjectRepository)(user_entity_1.User)),
    __param(2, (0, typeorm_1.InjectRepository)(manuals_manage_classify_entity_1.MnaualsManageClassify)),
    __metadata("design:paramtypes", [typeof (_a = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _a : Object, typeof (_b = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _b : Object, typeof (_c = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _c : Object])
], ManualsManageService);
exports.ManualsManageService = ManualsManageService;


/***/ }),
/* 222 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.MnaualsManageClassify = void 0;
const increment_id_entity_1 = __webpack_require__(17);
const typeorm_1 = __webpack_require__(18);
let MnaualsManageClassify = class MnaualsManageClassify extends increment_id_entity_1.IncrementIdEntity {
};
__decorate([
    (0, typeorm_1.Column)({ name: 'name' }),
    __metadata("design:type", String)
], MnaualsManageClassify.prototype, "name", void 0);
__decorate([
    (0, typeorm_1.Column)({ name: 'pid', default: 0 }),
    __metadata("design:type", Number)
], MnaualsManageClassify.prototype, "pid", void 0);
MnaualsManageClassify = __decorate([
    (0, typeorm_1.Entity)('manuals_manage_classify')
], MnaualsManageClassify);
exports.MnaualsManageClassify = MnaualsManageClassify;


/***/ }),
/* 223 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ManualsManageController = void 0;
const common_1 = __webpack_require__(2);
const manuals_manage_service_1 = __webpack_require__(221);
const create_manuals_manage_dto_1 = __webpack_require__(224);
const update_manuals_manage_dto_1 = __webpack_require__(225);
const swagger_1 = __webpack_require__(23);
const passport_1 = __webpack_require__(33);
const create_manuals_manage_classify_dto_1 = __webpack_require__(226);
const token_data_entity_1 = __webpack_require__(42);
const token_data_decorator_1 = __webpack_require__(37);
let ManualsManageController = class ManualsManageController {
    constructor(manualsManageService) {
        this.manualsManageService = manualsManageService;
    }
    create(createManualsManageDto, token) {
        return this.manualsManageService.create(createManualsManageDto, token);
    }
    findAllClassify() {
        return this.manualsManageService.findAllClassify();
    }
    deleteClassify(id) {
        return this.manualsManageService.deleteClassify(id);
    }
    findAllByClassify(classifyId, token) {
        return this.manualsManageService.findAll(token, classifyId);
    }
    findAll(token) {
        return this.manualsManageService.findAll(token, null);
    }
    findOne(id, token) {
        return this.manualsManageService.findOne(+id);
    }
    update(id, updateManualsManageDto, token) {
        return this.manualsManageService.update(+id, updateManualsManageDto, token);
    }
    portionUpdate(data, token) {
        return this.manualsManageService.portionUpdate(data.idArray, data.data, token);
    }
    remove(id) {
        return this.manualsManageService.remove(+id);
    }
    createClassify(data) {
        return this.manualsManageService.createClassify(data);
    }
    editorClassify(data) {
        return this.manualsManageService.createClassify(data);
    }
};
__decorate([
    (0, swagger_1.ApiBearerAuth)(),
    (0, common_1.Post)(),
    (0, swagger_1.ApiOperation)({ summary: '新建手册' }),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_b = typeof create_manuals_manage_dto_1.CreateManualsManageDto !== "undefined" && create_manuals_manage_dto_1.CreateManualsManageDto) === "function" ? _b : Object, typeof (_c = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _c : Object]),
    __metadata("design:returntype", void 0)
], ManualsManageController.prototype, "create", null);
__decorate([
    (0, common_1.Get)('classify'),
    (0, swagger_1.ApiOperation)({ summary: '查询手册分类' }),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", void 0)
], ManualsManageController.prototype, "findAllClassify", null);
__decorate([
    (0, swagger_1.ApiOperation)({ summary: '删除手册分类' }),
    (0, common_1.Delete)('classify/:id'),
    __param(0, (0, common_1.Param)('id')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number]),
    __metadata("design:returntype", void 0)
], ManualsManageController.prototype, "deleteClassify", null);
__decorate([
    (0, common_1.Get)('bycla/:id'),
    (0, swagger_1.ApiOperation)({ summary: '根据分类获取手册列表手册' }),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, typeof (_d = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _d : Object]),
    __metadata("design:returntype", void 0)
], ManualsManageController.prototype, "findAllByClassify", null);
__decorate([
    (0, common_1.Get)(),
    (0, common_1.UseGuards)((0, passport_1.AuthGuard)('jwt')),
    (0, swagger_1.ApiBearerAuth)('jwt'),
    (0, swagger_1.ApiOperation)({ summary: '获取手册列表手册' }),
    __param(0, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_e = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _e : Object]),
    __metadata("design:returntype", void 0)
], ManualsManageController.prototype, "findAll", null);
__decorate([
    (0, common_1.Get)(':id'),
    (0, swagger_1.ApiOperation)({ summary: '获取单一手册' }),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, typeof (_f = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _f : Object]),
    __metadata("design:returntype", void 0)
], ManualsManageController.prototype, "findOne", null);
__decorate([
    (0, common_1.Patch)(':id'),
    (0, swagger_1.ApiOperation)({ summary: '编辑手册' }),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, common_1.Body)()),
    __param(2, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, typeof (_g = typeof update_manuals_manage_dto_1.UpdateManualsManageDto !== "undefined" && update_manuals_manage_dto_1.UpdateManualsManageDto) === "function" ? _g : Object, typeof (_h = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _h : Object]),
    __metadata("design:returntype", void 0)
], ManualsManageController.prototype, "update", null);
__decorate([
    (0, common_1.Post)('portion'),
    (0, swagger_1.ApiOperation)({ summary: '批量更新手册数据' }),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, token_data_decorator_1.TokenData)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, typeof (_j = typeof token_data_entity_1.TokenDataEntity !== "undefined" && token_data_entity_1.TokenDataEntity) === "function" ? _j : Object]),
    __metadata("design:returntype", void 0)
], ManualsManageController.prototype, "portionUpdate", null);
__decorate([
    (0, common_1.Delete)(':id'),
    (0, common_1.UseGuards)((0, passport_1.AuthGuard)('jwt')),
    (0, swagger_1.ApiBearerAuth)('jwt'),
    (0, swagger_1.ApiOperation)({ summary: '删除手册' }),
    __param(0, (0, common_1.Param)('id')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", void 0)
], ManualsManageController.prototype, "remove", null);
__decorate([
    (0, common_1.Post)('classify'),
    (0, swagger_1.ApiOperation)({ summary: '新建手册分类' }),
    __param(0, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [typeof (_k = typeof create_manuals_manage_classify_dto_1.CreateManualsManageClassifyDto !== "undefined" && create_manuals_manage_classify_dto_1.CreateManualsManageClassifyDto) === "function" ? _k : Object]),
    __metadata("design:returntype", void 0)
], ManualsManageController.prototype, "createClassify", null);
__decorate([
    (0, common_1.Post)('classify/editor'),
    (0, swagger_1.ApiOperation)({ summary: '编辑手册分类' }),
    __param(0, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object]),
    __metadata("design:returntype", void 0)
], ManualsManageController.prototype, "editorClassify", null);
ManualsManageController = __decorate([
    (0, swagger_1.ApiTags)('手册管理'),
    (0, common_1.Controller)('manuals-manage/'),
    __metadata("design:paramtypes", [typeof (_a = typeof manuals_manage_service_1.ManualsManageService !== "undefined" && manuals_manage_service_1.ManualsManageService) === "function" ? _a : Object])
], ManualsManageController);
exports.ManualsManageController = ManualsManageController;


/***/ }),
/* 224 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var _a, _b;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CreateManualsManageDto = void 0;
const swagger_1 = __webpack_require__(23);
const create_dto_1 = __webpack_require__(39);
const class_validator_1 = __webpack_require__(25);
class CreateManualsManageDto extends create_dto_1.CreateDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '手册名称', example: '测试手册' }),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], CreateManualsManageDto.prototype, "name", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '手册说明', example: '这里是测试手册' }),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], CreateManualsManageDto.prototype, "explain", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '是否置顶', example: false }),
    (0, class_validator_1.IsBoolean)({ message: '是否置顶请传入boolean值' }),
    __metadata("design:type", Boolean)
], CreateManualsManageDto.prototype, "stick", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '可以查看的角色列表', example: [] }),
    (0, class_validator_1.IsArray)({ message: '请上传数组列表' }),
    __metadata("design:type", typeof (_a = typeof Array !== "undefined" && Array) === "function" ? _a : Object)
], CreateManualsManageDto.prototype, "canView", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '可以编辑的角色列表', example: [] }),
    (0, class_validator_1.IsArray)({ message: '请上传数组列表' }),
    __metadata("design:type", typeof (_b = typeof Array !== "undefined" && Array) === "function" ? _b : Object)
], CreateManualsManageDto.prototype, "canEditor", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '密码', example: false }),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], CreateManualsManageDto.prototype, "password", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '编著', example: false }),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], CreateManualsManageDto.prototype, "compile", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '出版', example: false }),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], CreateManualsManageDto.prototype, "publish", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '封面', example: false }),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], CreateManualsManageDto.prototype, "cover", void 0);
exports.CreateManualsManageDto = CreateManualsManageDto;


/***/ }),
/* 225 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

"use strict";

Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.UpdateManualsManageDto = void 0;
const swagger_1 = __webpack_require__(23);
const create_manuals_manage_dto_1 = __webpack_require__(224);
class UpdateManualsManageDto extends (0, swagger_1.PartialType)(create_manuals_manage_dto_1.CreateManualsManageDto) {
}
exports.UpdateManualsManageDto = UpdateManualsManageDto;


/***/ }),
/* 226 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CreateManualsManageClassifyDto = void 0;
const swagger_1 = __webpack_require__(23);
const class_validator_1 = __webpack_require__(25);
class CreateManualsManageClassifyDto {
}
__decorate([
    (0, swagger_1.ApiProperty)({ description: '分类名称', example: '分类名称' }),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], CreateManualsManageClassifyDto.prototype, "name", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: '父级ID', example: '父级ID' }),
    (0, class_validator_1.IsNumber)(),
    __metadata("design:type", Number)
], CreateManualsManageClassifyDto.prototype, "pid", void 0);
exports.CreateManualsManageClassifyDto = CreateManualsManageClassifyDto;


/***/ }),
/* 227 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

"use strict";

Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.initPlugins = void 0;
const static_assets_1 = __webpack_require__(228);
const swagger_1 = __webpack_require__(229);
const proxy_1 = __webpack_require__(230);
function initPlugins(app) {
    (0, swagger_1.default)(app);
    app.enableCors({
        origin: '*',
        methods: '*',
        allowedHeaders: '*',
    });
    (0, static_assets_1.default)(app);
    (0, proxy_1.default)();
    return app;
}
exports.initPlugins = initPlugins;


/***/ }),
/* 228 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
const env_1 = __webpack_require__(10);
function default_1(app) {
    for (const key in env_1.default.staticAssets) {
        const _a = env_1.default.staticAssets[key], { path } = _a, option = __rest(_a, ["path"]);
        app.useStaticAssets(path, option);
    }
}
exports["default"] = default_1;


/***/ }),
/* 229 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

"use strict";

Object.defineProperty(exports, "__esModule", ({ value: true }));
const swagger_1 = __webpack_require__(23);
const env_1 = __webpack_require__(10);
function default_1(app) {
    const config = new swagger_1.DocumentBuilder()
        .setTitle(env_1.default.swagger.title)
        .setVersion(env_1.default.swagger.version)
        .addBearerAuth({ type: 'http', scheme: 'bearer', bearerFormat: 'JWT' })
        .build();
    const document = swagger_1.SwaggerModule.createDocument(app, config);
    swagger_1.SwaggerModule.setup(env_1.default.swagger.path, app, document);
}
exports["default"] = default_1;


/***/ }),
/* 230 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

"use strict";

Object.defineProperty(exports, "__esModule", ({ value: true }));
const express = __webpack_require__(231);
const http_proxy_middleware_1 = __webpack_require__(232);
const https = __webpack_require__(233);
const env_1 = __webpack_require__(10);
function default_1() {
    env_1.default.proxys.forEach((item) => {
        const app = express();
        app.use('', (0, http_proxy_middleware_1.createProxyMiddleware)({
            target: item.target,
            changeOrigin: true,
        }));
        https.createServer(item.httpsOptions, app).listen(item.port, () => {
            console.log(`反向代理已启动：
      Port:${item.port}
      Target:${item.target}
      `);
        });
    });
}
exports["default"] = default_1;


/***/ }),
/* 231 */
/***/ ((module) => {

"use strict";
module.exports = require("express");

/***/ }),
/* 232 */
/***/ ((module) => {

"use strict";
module.exports = require("http-proxy-middleware");

/***/ }),
/* 233 */
/***/ ((module) => {

"use strict";
module.exports = require("https");

/***/ })
/******/ 	]);
/************************************************************************/
/******/ 	// The module cache
/******/ 	var __webpack_module_cache__ = {};
/******/ 	
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/ 		// Check if module is in cache
/******/ 		var cachedModule = __webpack_module_cache__[moduleId];
/******/ 		if (cachedModule !== undefined) {
/******/ 			return cachedModule.exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = __webpack_module_cache__[moduleId] = {
/******/ 			// no module.id needed
/******/ 			// no module.loaded needed
/******/ 			exports: {}
/******/ 		};
/******/ 	
/******/ 		// Execute the module function
/******/ 		__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ 	
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/ 	
/************************************************************************/
/******/ 	/* webpack/runtime/hasOwnProperty shorthand */
/******/ 	(() => {
/******/ 		__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ 	})();
/******/ 	
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
(() => {
"use strict";
var exports = __webpack_exports__;

Object.defineProperty(exports, "__esModule", ({ value: true }));
__webpack_require__(1);
const common_1 = __webpack_require__(2);
const core_1 = __webpack_require__(3);
const global_exception_filter_1 = __webpack_require__(4);
const response_interceptor_1 = __webpack_require__(5);
const app_module_1 = __webpack_require__(7);
const env_1 = __webpack_require__(10);
const plugins_1 = __webpack_require__(227);
const express_1 = __webpack_require__(231);
async function bootstrap() {
    const app = (0, plugins_1.initPlugins)(await core_1.NestFactory.create(app_module_1.AppModule, {}));
    app.use((0, express_1.json)({ limit: '500mb' }));
    app.useGlobalPipes(new common_1.ValidationPipe());
    app.useGlobalInterceptors(new response_interceptor_1.ResponseInterceptor());
    app.useGlobalFilters(new global_exception_filter_1.GlobalExceptionsFilter(app.get(core_1.HttpAdapterHost)));
    await app.listen(env_1.default.serve.port);
}
bootstrap().then(() => {
    console.log(`
    \n\x1B[42m NEST \x1B[0m Compiled successfully
    \n\x1B[32m➜ \x1B[0m Local:    \x1B[4m\x1B[34mhttp://localhost:${env_1.default.serve.port}\x1B[0m
    \n\x1B[32m➜ \x1B[0m Docs:     \x1B[4m\x1B[34mhttp://localhost:${env_1.default.serve.port}/${env_1.default.swagger.path}\x1B[0m
    \n\x1B[32m➜ \x1B[0m Init DB:  \x1B[4m\x1B[34mhttp://localhost:${env_1.default.serve.port}/initialize\x1B[0m
    `);
});

})();

/******/ })()
;