Files
tehran_taj/apps/api/src/modules/customer-auth/customer-auth.module.ts
T

26 lines
1.1 KiB
TypeScript
Raw Normal View History

import { Module } from '@nestjs/common';
import { JwtModule } from '@nestjs/jwt';
import { PassportModule } from '@nestjs/passport';
import { PrismaModule } from '../../prisma/prisma.module';
import { CustomersModule } from '../customers/customers.module';
import { CustomerAuthController } from './customer-auth.controller';
import { CustomerAuthService } from './customer-auth.service';
import { CustomerJwtStrategy } from './customer-jwt.strategy';
/**
* Customer session, deliberately separate from AuthModule (admins).
*
* JwtModule is registered without a secret here: the customer secret is passed
* per-call in CustomerAuthService.verifyOtp, and CustomerJwtStrategy reads it
* directly, so an admin secret can never sign a customer token by accident.
*
* No APP_GUARD is registered — customer routes opt in with @CustomerAuth().
*/
@Module({
imports: [PrismaModule, PassportModule, JwtModule.register({}), CustomersModule],
controllers: [CustomerAuthController],
providers: [CustomerAuthService, CustomerJwtStrategy],
exports: [CustomerAuthService],
})
export class CustomerAuthModule {}