chore: criticism pagination

This commit is contained in:
Matin
2025-01-27 15:54:18 +03:30
parent a7e3172cb4
commit 239099bb15
8 changed files with 75 additions and 14 deletions
+9 -3
View File
@@ -1,4 +1,4 @@
import { BadRequestException, Injectable, Logger } from "@nestjs/common";
import { BadRequestException, Injectable } from "@nestjs/common";
import slugify from "slugify";
import { In, Not } from "typeorm";
@@ -31,7 +31,6 @@ export class UsersService {
name: true,
},
};
private logger = new Logger(UsersService.name);
constructor(
private userRepository: UserRepository,
private roleRepository: RoleRepository,
@@ -40,8 +39,15 @@ export class UsersService {
/************************************************************ */
async findOneById(id: string) {
const user = await this.userRepository.findOneBy({ id });
if (!user) throw new BadRequestException(UserMessage.USER_NOT_FOUND);
return { user };
}
/************************************************************ */
async getMe(userId: string) {
this.logger.debug("sss");
const user = await this.userRepository.findOne({ where: { id: userId }, select: this.userSelect });
if (!user) throw new BadRequestException(UserMessage.USER_NOT_FOUND);
return { user };