initial: standalone repo from monorepo split
This commit is contained in:
59
src/portal/portal.controller.ts
Normal file
59
src/portal/portal.controller.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
import { Controller, Get, Post, Body, UseGuards, Req, HttpCode, HttpStatus } from '@nestjs/common';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
import { SkipThrottle } from '@nestjs/throttler';
|
||||
import { PortalService } from './portal.service';
|
||||
import { PortalLoginDto } from './dto/portal-login.dto';
|
||||
import { CreatePortalTicketDto } from './dto/create-portal-ticket.dto';
|
||||
|
||||
@Controller('portal')
|
||||
export class PortalController {
|
||||
constructor(private readonly portalService: PortalService) {}
|
||||
|
||||
@Post('auth/login')
|
||||
@HttpCode(HttpStatus.OK)
|
||||
async login(@Body() dto: PortalLoginDto) {
|
||||
return this.portalService.login(dto);
|
||||
}
|
||||
|
||||
@Get('profile')
|
||||
@UseGuards(AuthGuard('portal-jwt'))
|
||||
async getProfile(@Req() req: any) {
|
||||
return this.portalService.getProfile(req.user.sub);
|
||||
}
|
||||
|
||||
@Get('dashboard')
|
||||
@UseGuards(AuthGuard('portal-jwt'))
|
||||
async getDashboard(@Req() req: any) {
|
||||
return this.portalService.getDashboard(req.user.sub, req.user.tenantId);
|
||||
}
|
||||
|
||||
@Get('subscription')
|
||||
@UseGuards(AuthGuard('portal-jwt'))
|
||||
async getSubscription(@Req() req: any) {
|
||||
return this.portalService.getSubscription(req.user.sub, req.user.tenantId);
|
||||
}
|
||||
|
||||
@Get('invoices')
|
||||
@UseGuards(AuthGuard('portal-jwt'))
|
||||
async getInvoices(@Req() req: any) {
|
||||
return this.portalService.getInvoices(req.user.sub, req.user.tenantId);
|
||||
}
|
||||
|
||||
@Get('payments')
|
||||
@UseGuards(AuthGuard('portal-jwt'))
|
||||
async getPayments(@Req() req: any) {
|
||||
return this.portalService.getPayments(req.user.sub, req.user.tenantId);
|
||||
}
|
||||
|
||||
@Get('tickets')
|
||||
@UseGuards(AuthGuard('portal-jwt'))
|
||||
async getTickets(@Req() req: any) {
|
||||
return this.portalService.getTickets(req.user.sub, req.user.tenantId);
|
||||
}
|
||||
|
||||
@Post('tickets')
|
||||
@UseGuards(AuthGuard('portal-jwt'))
|
||||
async createTicket(@Req() req: any, @Body() dto: CreatePortalTicketDto) {
|
||||
return this.portalService.createTicket(req.user.sub, req.user.tenantId, dto);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user