Spaces:
Runtime error
Runtime error
| import { Controller, Post, Body, Req, UseGuards } from '@nestjs/common'; | |
| import { ApiTags, ApiBearerAuth, ApiOperation } from '@nestjs/swagger'; | |
| import { SuperAdminAuthService } from './auth.service'; | |
| import { SuperAdminRegisterDto } from './dto/register.dto'; | |
| import { SuperAdminLoginDto } from './dto/login.dto'; | |
| import { SuperAdminRefreshTokenDto } from './dto/refresh-token.dto'; | |
| import { Public } from 'src/shared/decorators/public.decorator'; | |
| import { GetSuperAdmin } from 'src/shared/decorators/get-super-admin.decorator'; | |
| import { LogToDiscord } from 'src/shared/decorators/log-to-discord.decorator'; | |
| import type { SuperAdminSessionType } from 'src/shared/types/super-admin-session.type'; | |
| import { SuperAdminAuthGuard } from './guards/super-admin-auth.guard'; | |
| ('Super Admin: Authentication') | |
| ('super-admin/auth') | |
| (SuperAdminAuthGuard) | |
| () | |
| export class SuperAdminAuthController { | |
| constructor(private readonly superAdminAuthService: SuperAdminAuthService) {} | |
| () | |
| ('register') | |
| ({ summary: 'Register a new super admin' }) | |
| async register( | |
| () registerDto: SuperAdminRegisterDto, | |
| () request: any, | |
| ) { | |
| return this.superAdminAuthService.register(registerDto, request); | |
| } | |
| () | |
| ('login') | |
| ({ summary: 'Login super admin' }) | |
| async login(() loginDto: SuperAdminLoginDto, () request: any) { | |
| return this.superAdminAuthService.login(loginDto, request); | |
| } | |
| () | |
| ('logout') | |
| ({ summary: 'Logout super admin' }) | |
| async logout(() sessionData: SuperAdminSessionType) { | |
| return this.superAdminAuthService.logout(sessionData); | |
| } | |
| () | |
| ('refresh-token') | |
| ({ summary: 'Refresh access token' }) | |
| async refreshToken(() refreshTokenDto: SuperAdminRefreshTokenDto) { | |
| return this.superAdminAuthService.refreshToken(refreshTokenDto); | |
| } | |
| () | |
| ('profile') | |
| ({ summary: 'Get super admin profile' }) | |
| async getProfile(() sessionData: SuperAdminSessionType) { | |
| return { superAdmin: sessionData.superAdmin }; | |
| } | |
| } | |