// src/throttler/custom-throttler.guard.ts
import { ThrottlerGuard } from '@nestjs/throttler';
import { ExecutionContext, Injectable } from '@nestjs/common';

@Injectable()
export class CustomThrottlerGuard extends ThrottlerGuard {
    protected getTracker(req: any): string {
        // username for login, fallback to IP
        console.log(req.headers['user-agent'], "req.headers['user-agent']");


        return req.body?.Username
            ? `${req.body.Username}:${req.ip}:${req.headers['user-agent']}`
            : req.ip;
    }
}
