Files
RayLab-Core/src/modules/identity/identity.module.ts
T
Rayyan Syahbani Hermanto 8a278281ce
Deploy / deploy (push) Successful in 47s
Fix Build Error
2026-09-07 23:44:40 +07:00

65 lines
2.3 KiB
TypeScript

import { Module } from '@nestjs/common';
import { UsersController } from './presentation/controllers/users.controller';
import { PrismaService } from '../../shared/prisma.service';
import { PrismaUserRepository } from './infrastructure/repositories/prisma-user.repository';
import { IUser } from './domain/repositories/user.interface';
import { EventDispatcher } from '../../core/events/event-dispatcher';
import { JwtAuthGuard } from '../../core/auth/guards/jwt-auth.guard';
import { JwtModule } from '@nestjs/jwt';
import { CreateUserHandler } from './application/handlers/user/create-user.handler';
import { GetUserHandler as FindUserHandler } from './application/handlers/user/get-user.handler';
import { DeleteUserHandler } from './application/handlers/user/delete-user.handler';
import { GetUsersHandler as FindUsersHandler } from './application/handlers/user/get-users.handler';
import { UpdateUserHandler } from './application/handlers/user/update-user.handler';
import { PermissionGuard } from '../authorization/presentation/guards/permission.guard';
import { Reflector } from '@nestjs/core';
import { LoginHandler } from './application/handlers/login.handler';
import { AuthController } from './presentation/controllers/auth.controller';
import { TokenHandler } from './application/handlers/token.handler';
import { PrismaServiceAccountRepository } from './infrastructure/repositories/prisma-service-account.repository';
import { ServiceAccountRepository } from './domain/repositories/service-account.repository.interface';
@Module({
imports: [
JwtModule.register({
secret: process.env.JWT_SECRET,
signOptions: {
expiresIn: '1d',
},
}),
],
controllers: [UsersController, AuthController],
providers: [
//#region User
CreateUserHandler,
FindUserHandler,
FindUsersHandler,
UpdateUserHandler,
DeleteUserHandler,
LoginHandler,
TokenHandler,
//#endregion
JwtAuthGuard,
PermissionGuard,
Reflector,
PrismaService,
PrismaUserRepository,
PrismaServiceAccountRepository,
{
provide: IUser,
useClass: PrismaUserRepository,
},
{
provide: ServiceAccountRepository,
useClass: PrismaServiceAccountRepository,
},
{
provide: 'EVENT_DISPATCHER',
useValue: new EventDispatcher(),
},
],
})
export class IdentityModule {}