Team Ai
Apppublic

oex2003/evolution-api

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
auth.service.ts23 linesDownload Raw Back to services
1import { PrismaRepository } from '@api/repository/repository.service';2import { BadRequestException } from '@exceptions';3 4export class AuthService {5  constructor(private readonly prismaRepository: PrismaRepository) {}6 7  public async checkDuplicateToken(token: string) {8    if (!token) {9      return true;10    }11 12    const instances = await this.prismaRepository.instance.findMany({13      where: { token },14    });15 16    if (instances.length > 0) {17      throw new BadRequestException('Token already exists');18    }19 20    return true;21  }22}23