Search by user id

This commit is contained in:
2023-11-20 19:08:45 +03:00
parent dbd0fb51b7
commit ceedff498c

View File

@@ -1,7 +1,7 @@
import { Injectable, Logger } from '@nestjs/common'; import { Injectable, Logger } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { Admin } from 'libs/database/admin.entity'; import { Admin } from 'libs/database/admin.entity';
import { Repository } from 'typeorm';
@Injectable() @Injectable()
export class AdminService { export class AdminService {
@@ -21,7 +21,8 @@ export class AdminService {
try { try {
this.logger.debug(`[admin.checkIsAdmin]`); this.logger.debug(`[admin.checkIsAdmin]`);
const admins = await this.adminRepository.findOne({ const admins = await this.adminRepository.findOne({
where: { user_id: id }, relations: { user: true },
where: { user: { id: id } },
}); });
if (!admins) { if (!admins) {
return false; return false;