first commit

This commit is contained in:
DerJesen
2025-11-29 12:26:58 +01:00
parent 2fae31f20f
commit fe5bbc1410
142 changed files with 19585 additions and 1 deletions

22
src/auth/auth.service.ts Normal file
View File

@@ -0,0 +1,22 @@
import { Injectable, UnauthorizedException } from '@nestjs/common';
import { JwtService } from '@nestjs/jwt';
import { ConfigService } from '@nestjs/config';
@Injectable()
export class AuthService {
constructor(
private jwtService: JwtService,
private configService: ConfigService,
) {}
async login(password: string) {
const envPassword = this.configService.get<string>('PASSWORD');
if (password !== envPassword) {
throw new UnauthorizedException('Incorrect password');
}
const payload = { username: 'admin', sub: 'admin' };
return {
accessToken: this.jwtService.sign(payload),
};
}
}