File size: 1,221 Bytes
8a24f2c
 
 
 
5d4b547
909a81a
fe607c0
 
909a81a
8a24f2c
fe607c0
 
 
 
 
 
8a24f2c
5d4b547
fe607c0
 
8a24f2c
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { UsersService } from './users.service';
import { User } from './user.entity';
import { Campaign } from '../campaigns/entities/campaign.entity';
import { UsersOperatorController } from './users-operator.controller';
import { UsersAdminController } from './users-admin.controller';
import { UsersAdminService } from './users-admin.service';
import { RateLimitGuard } from '../../common/guards/rate-limit.guard';

// Two controllers, both narrow on purpose. The operator one exposes four named
// fields; the admin one selects a named column list and is behind RolesGuard.
// Neither returns the User entity whole — the old /users routes did, password
// and token hashes included, and that is the mistake this module exists to
// avoid repeating. Everything else reaches user records through /auth and
// /profile, which scope every read to the authenticated principal.
@Module({
  imports: [TypeOrmModule.forFeature([User, Campaign])],
  controllers: [UsersOperatorController, UsersAdminController],
  providers: [UsersService, UsersAdminService, RateLimitGuard],
  exports: [UsersService],
})
export class UsersModule {}