Spaces:
Runtime error
Runtime error
Download src/api/services/auth.service.ts from oex2003/evolution-api: direct link, hf CLI and curl.
- Browser
- Download file 543 Bytes
-
https://huggingface.co/spaces/oex2003/evolution-api/resolve/refs%2Fpr%2F1/src/api/services/auth.service.ts
- Command line
-
hf download hf://spaces/oex2003/evolution-api@refs/pr/1/src/api/services/auth.service.ts
-
curl -L -o auth.service.ts https://huggingface.co/spaces/oex2003/evolution-api/resolve/refs%2Fpr%2F1/src/api/services/auth.service.ts
543 Bytes
| 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; | |
| } | |
| } | |