251123:2300 Update T1
This commit is contained in:
@@ -1,24 +1,42 @@
|
||||
// File: src/modules/user/user.module.ts
|
||||
// บันทึกการแก้ไข: รวม UserPreferenceService และ RoleService (T1.3)
|
||||
|
||||
import { Module } from '@nestjs/common';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { UserService } from './user.service.js';
|
||||
import { UserController } from './user.controller.js'; // 1. Import Controller
|
||||
import { User } from './entities/user.entity.js';
|
||||
import { UserAssignmentService } from './user-assignment.service.js';
|
||||
import { UserAssignment } from './entities/user-assignment.entity.js';
|
||||
|
||||
import { UserService } from './user.service';
|
||||
import { UserController } from './user.controller';
|
||||
import { UserAssignmentService } from './user-assignment.service';
|
||||
import { UserPreferenceService } from './user-preference.service'; // ✅ เพิ่ม
|
||||
|
||||
// Entities
|
||||
import { User } from './entities/user.entity';
|
||||
import { UserAssignment } from './entities/user-assignment.entity';
|
||||
import { UserPreference } from './entities/user-preference.entity';
|
||||
import { Role } from './entities/role.entity';
|
||||
import { Permission } from './entities/permission.entity';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
// 3. ลงทะเบียน Entity ทั้ง User และ UserAssignment
|
||||
TypeOrmModule.forFeature([User, UserAssignment]),
|
||||
], // 2. เพิ่มบรรทัดนี้ เพื่อบอก NestJS ว่ามี Controller นี้อยู่
|
||||
// ลงทะเบียน Entity ให้ครบ
|
||||
TypeOrmModule.forFeature([
|
||||
User,
|
||||
UserAssignment,
|
||||
UserPreference,
|
||||
Role,
|
||||
Permission,
|
||||
]),
|
||||
],
|
||||
controllers: [UserController],
|
||||
providers: [
|
||||
UserService,
|
||||
UserAssignmentService, // <--- 4. ลงทะเบียน Service เป็น Provider
|
||||
UserAssignmentService,
|
||||
UserPreferenceService, // ✅ เพิ่ม Provider
|
||||
],
|
||||
exports: [
|
||||
UserService,
|
||||
UserAssignmentService, // <--- 5. Export เผื่อที่อื่นใช้
|
||||
], // Export ให้ AuthModule เรียกใช้ได้
|
||||
UserAssignmentService,
|
||||
UserPreferenceService, // ✅ Export ให้ Module อื่นใช้ (เช่น Notification)
|
||||
],
|
||||
})
|
||||
export class UserModule {}
|
||||
|
||||
Reference in New Issue
Block a user