"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 = require("@nestjs/common");
const config_1 = require("@nestjs/config");
const mongoose_1 = require("@nestjs/mongoose");
const serve_static_1 = require("@nestjs/serve-static");
const throttler_1 = require("@nestjs/throttler");
const path_1 = require("path");
const auth_module_1 = require("./auth/auth.module");
const students_module_1 = require("./students/students.module");
const classes_module_1 = require("./classes/classes.module");
const sections_module_1 = require("./sections/sections.module");
const academic_year_module_1 = require("./academic-year/academic-year.module");
const attendance_module_1 = require("./attendance/attendance.module");
const payments_module_1 = require("./payments/payments.module");
const notifications_module_1 = require("./notifications/notifications.module");
const dashboard_module_1 = require("./dashboard/dashboard.module");
const admin_module_1 = require("./admin/admin.module");
const teachers_module_1 = require("./teachers/teachers.module");
const settings_module_1 = require("./settings/settings.module");
const designations_module_1 = require("./designations/designations.module");
const dropdown_options_module_1 = require("./dropdown-options/dropdown-options.module");
const users_module_1 = require("./users/users.module");
const app_controller_1 = require("./app.controller");
const app_service_1 = require("./app.service");
const audit_module_1 = require("./audit/audit.module");
const fees_module_1 = require("./fees/fees.module");
const transport_module_1 = require("./transport/transport.module");
const invoices_module_1 = require("./invoices/invoices.module");
const ops_module_1 = require("./ops/ops.module");
const academic_year_middleware_1 = require("./common/middleware/academic-year.middleware");
const audit_sync_middleware_1 = require("./common/middleware/audit-sync.middleware");
const core_1 = require("@nestjs/core");
const http_exception_filter_1 = require("./common/filters/http-exception.filter");
let AppModule = class AppModule {
    configure(consumer) {
        consumer.apply(academic_year_middleware_1.AcademicYearMiddleware, audit_sync_middleware_1.AuditSyncMiddleware).forRoutes('*');
    }
};
exports.AppModule = AppModule;
exports.AppModule = AppModule = __decorate([
    (0, common_1.Module)({
        imports: [
            config_1.ConfigModule.forRoot({ isGlobal: true }),
            throttler_1.ThrottlerModule.forRoot([{ ttl: 60000, limit: 60 }]),
            serve_static_1.ServeStaticModule.forRoot({
                rootPath: (0, path_1.join)(process.cwd(), 'uploads'),
                serveRoot: '/uploads',
            }),
            mongoose_1.MongooseModule.forRootAsync({
                inject: [config_1.ConfigService],
                useFactory: (config) => ({
                    uri: config.get('MONGO_URI'),
                }),
            }),
            auth_module_1.AuthModule,
            students_module_1.StudentsModule,
            classes_module_1.ClassesModule,
            sections_module_1.SectionsModule,
            academic_year_module_1.AcademicYearModule,
            attendance_module_1.AttendanceModule,
            payments_module_1.PaymentsModule,
            notifications_module_1.NotificationsModule,
            dashboard_module_1.DashboardModule,
            admin_module_1.AdminModule,
            teachers_module_1.TeachersModule,
            settings_module_1.SettingsModule,
            designations_module_1.DesignationsModule,
            dropdown_options_module_1.DropdownOptionsModule,
            users_module_1.UsersModule,
            audit_module_1.AuditModule,
            fees_module_1.FeesModule,
            transport_module_1.TransportModule,
            invoices_module_1.InvoicesModule,
            ops_module_1.OpsModule,
        ],
        controllers: [app_controller_1.AppController],
        providers: [
            app_service_1.AppService,
            { provide: core_1.APP_FILTER, useClass: http_exception_filter_1.HttpExceptionFilter },
            { provide: core_1.APP_GUARD, useClass: throttler_1.ThrottlerGuard },
        ],
    })
], AppModule);
//# sourceMappingURL=app.module.js.map