File size: 543 Bytes
80f4e3d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import { PrismaRepository } from '@api/repository/repository.service';
import { BadRequestException } from '@exceptions';
export class AuthService {
constructor(private readonly prismaRepository: PrismaRepository) {}
public async checkDuplicateToken(token: string) {
if (!token) {
return true;
}
const instances = await this.prismaRepository.instance.findMany({
where: { token },
});
if (instances.length > 0) {
throw new BadRequestException('Token already exists');
}
return true;
}
}
|