diff --git a/README.md b/README.md index 9bda515..d46b62b 100644 --- a/README.md +++ b/README.md @@ -120,14 +120,13 @@ GET /user/?where=firstName:John @ApiQuery({ name: 'where', required: false, type: 'string' }) @ApiQuery({ name: 'orderBy', required: false, type: 'string' }) @UseGuards(AccessGuard) - @Serialize(UserEntity) + @Serialize(UserBaseEntity) @UseAbility(Actions.read, UserEntity) findAll( - @Query('where', WherePipe) where?: Prisma.UserWhereInput, - @Query('orderBy', OrderByPipe) - orderBy?: Prisma.UserOrderByWithRelationInput, + @Query('where', WherePipe) where?: Prisma.UserWhereInput, + @Query('orderBy', OrderByPipe) orderBy?: Prisma.UserOrderByWithRelationInput, ): Promise> { - return this.userService.findAll(where, orderBy); + return this.userService.findAll(where, orderBy); } ``` @@ -630,5 +629,3 @@ import { loggingMiddleware } from './logging-middleware'; }) export class AppModule {} ``` - -Try out the built in [Logging Middleware](/docs/logging-middleware). diff --git a/src/modules/user/user.controller.ts b/src/modules/user/user.controller.ts index a63177a..e521aae 100644 --- a/src/modules/user/user.controller.ts +++ b/src/modules/user/user.controller.ts @@ -8,11 +8,12 @@ import Serialize from '@decorators/serialize.decorator'; import { OrderByPipe, WherePipe } from '@nodeteam/nestjs-pipes'; import { Prisma, User } from '@prisma/client'; import { PaginatorTypes } from '@nodeteam/nestjs-prisma-pagination'; +import UserBaseEntity from '@modules/user/entities/user-base.entity'; -@ApiTags('User') +@ApiTags('Users') @ApiBearerAuth() @ApiBaseResponses() -@Controller('user') +@Controller('users') export class UserController { constructor(private readonly userService: UserService) {} @@ -20,7 +21,7 @@ export class UserController { @ApiQuery({ name: 'where', required: false, type: 'string' }) @ApiQuery({ name: 'orderBy', required: false, type: 'string' }) @UseGuards(AccessGuard) - @Serialize(UserEntity) + @Serialize(UserBaseEntity) @UseAbility(Actions.read, UserEntity) findAll( @Query('where', WherePipe) where?: Prisma.UserWhereInput,