import { Controller , Get , Req , Res , UseGuards } from '@nestjs/common' ; import { Request , Response } from 'express' ; import { AuthenticatedGuard , DiscordAuthGuard } from 'src/auth/utils/Guards' ; @ Controller ( 'auth' ) export class AuthController { /**
     * GET /api/auth/login
     * This is the route the user will visit to authenticate
     */ @ Get ( 'login' ) @ UseGuards ( DiscordAuthGuard ) login ( ) { return ; } /**
     * GET /api/auth/redirect
     * This is the redirect URL the OAuth2 Provider will call.
     */ @ Get ( 'redirect' ) @ UseGuards ( DiscordAuthGuard ) redirect ( @ Res ( ) res ) { res . redirect ( 'http://localhost:3000/dashboard' ) ; } /**
     * GET /api/auth/status
     * Retrieve the auth status
     */ @ Get ( 'status' ) @ UseGuards ( AuthenticatedGuard ) status ( @ Req ( ) req ) { return req . user ; } /**
     * GET /api/auth/logout
     * Logging the user out
     */ @ Get ( 'logout' ) @ UseGuards ( AuthenticatedGuard ) logout ( @ Req ( ) req ) { req . logOut ( ) ; } }