nicolas-arnaud
2 years ago
9 changed files with 66 additions and 65 deletions
@ -1,7 +0,0 @@ |
|||
import { Module } from '@nestjs/common' |
|||
import { ApiController } from './api.controller' |
|||
|
|||
@Module({ |
|||
controllers: [ApiController] |
|||
}) |
|||
export class ApiModule {} |
@ -1,14 +1,14 @@ |
|||
import { Controller, Get, Redirect, Req, UseGuards } from '@nestjs/common' |
|||
import { User } from 'src/auth/42.decorator' |
|||
import { AuthenticatedGuard } from 'src/auth/42-auth.guard' |
|||
import { Profile } from 'passport-42' |
|||
import { Request } from 'express' |
|||
import { Profile } from 'passport-42' |
|||
import { FtUser } from './auth/42.decorator' |
|||
import { AuthenticatedGuard } from './auth/42-auth.guard' |
|||
|
|||
@Controller() |
|||
export class ApiController { |
|||
export class AppController { |
|||
@Get('profile') |
|||
@UseGuards(AuthenticatedGuard) |
|||
profile (@User() user: Profile) { |
|||
profile (@FtUser() user: Profile) { |
|||
return { user } |
|||
} |
|||
|
@ -1,8 +0,0 @@ |
|||
import { type Request } from 'express' |
|||
import type User from 'src/users/user.entity' |
|||
|
|||
interface RequestWithUser extends Request { |
|||
user: User |
|||
} |
|||
|
|||
export default RequestWithUser |
Loading…
Reference in new issue