Энд-поинт schedule/get-group-names теперь не требует авторизации (для формы регистрации).

Энд-поинт schedule/get-group теперь не требует указания группы. Она берётся из данных пользователя.

Энд-поинт auth/sign-in теперь может возвращать группу пользователя начиная с версии 1.
This commit is contained in:
2024-10-13 17:59:48 +04:00
parent a4d7bb9cdc
commit c594039ca2
10 changed files with 98 additions and 24 deletions

View File

@@ -9,7 +9,7 @@ import { JwtService } from "@nestjs/jwt";
import { Request } from "express";
import { UsersService } from "../users/users.service";
import { Reflector } from "@nestjs/core";
import { AuthRoles } from "../auth-role/auth-role.decorator";
import { AuthRoles, AuthUnauthorized } from "../auth-role/auth-role.decorator";
import { isJWT } from "class-validator";
@Injectable()
@@ -30,6 +30,9 @@ export class AuthGuard implements CanActivate {
}
async canActivate(context: ExecutionContext): Promise<boolean> {
if (this.reflector.get(AuthUnauthorized, context.getHandler()))
return true;
const request = context.switchToHttp().getRequest();
const token = AuthGuard.extractTokenFromRequest(request);