mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 21:08:12 +00:00
refactor: ( iam ) add ispublic to public endpoints
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import { Body, Controller, Get, Param, Post, Patch, Delete, UseGuards, Request, Query } from '@nestjs/common';
|
import { Body, Controller, Get, Param, Post, Patch, Delete, UseGuards, Request, Query } from '@nestjs/common';
|
||||||
import { ApiTags, ApiOperation, ApiBearerAuth } from '@nestjs/swagger';
|
import { ApiTags, ApiOperation, ApiBearerAuth } from '@nestjs/swagger';
|
||||||
|
import { IsPublic } from '@tria-plc/api-common/modules/auth/decorators/public.decorator';
|
||||||
import { PackagesService } from './packages.service';
|
import { PackagesService } from './packages.service';
|
||||||
import { CreatePackageDto, BookPackageDto, CreatePriceTierDto, UpdatePriceTierDto } from './packages.dto';
|
import { CreatePackageDto, BookPackageDto, CreatePriceTierDto, UpdatePriceTierDto } from './packages.dto';
|
||||||
import { JwtGuard } from '../../common/jwt.guard';
|
import { JwtGuard } from '../../common/jwt.guard';
|
||||||
@@ -11,6 +12,7 @@ export class PackagesController {
|
|||||||
constructor(private readonly service: PackagesService) {}
|
constructor(private readonly service: PackagesService) {}
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
|
@IsPublic()
|
||||||
@ApiOperation({ summary: 'List active packages' })
|
@ApiOperation({ summary: 'List active packages' })
|
||||||
listActive() {
|
listActive() {
|
||||||
return this.service.listActive();
|
return this.service.listActive();
|
||||||
@@ -33,12 +35,14 @@ export class PackagesController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Get('booking/:ref')
|
@Get('booking/:ref')
|
||||||
|
@IsPublic()
|
||||||
@ApiOperation({ summary: 'Get package booking by reference' })
|
@ApiOperation({ summary: 'Get package booking by reference' })
|
||||||
getBookingByRef(@Param('ref') ref: string) {
|
getBookingByRef(@Param('ref') ref: string) {
|
||||||
return this.service.getBookingByRef(ref);
|
return this.service.getBookingByRef(ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get(':id')
|
@Get(':id')
|
||||||
|
@IsPublic()
|
||||||
@ApiOperation({ summary: 'Get package details' })
|
@ApiOperation({ summary: 'Get package details' })
|
||||||
getById(@Param('id') id: string) {
|
getById(@Param('id') id: string) {
|
||||||
return this.service.getById(id);
|
return this.service.getById(id);
|
||||||
@@ -93,6 +97,7 @@ export class PackagesController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Post('book')
|
@Post('book')
|
||||||
|
@IsPublic()
|
||||||
@UseGuards(OptionalJwtGuard)
|
@UseGuards(OptionalJwtGuard)
|
||||||
@ApiBearerAuth('JWT-auth')
|
@ApiBearerAuth('JWT-auth')
|
||||||
@ApiOperation({ summary: 'Book a package (public or authenticated)' })
|
@ApiOperation({ summary: 'Book a package (public or authenticated)' })
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import {
|
|||||||
} from '@nestjs/swagger';
|
} from '@nestjs/swagger';
|
||||||
import { Throttle } from '@nestjs/throttler';
|
import { Throttle } from '@nestjs/throttler';
|
||||||
import type { TCurrentUser } from '@tria-plc/api-common/modules/auth/types/current-user.type';
|
import type { TCurrentUser } from '@tria-plc/api-common/modules/auth/types/current-user.type';
|
||||||
|
import { IsPublic } from '@tria-plc/api-common/modules/auth/decorators/public.decorator';
|
||||||
import { JwtGuard } from '../../common/jwt.guard';
|
import { JwtGuard } from '../../common/jwt.guard';
|
||||||
import { OptionalJwtGuard } from './optional-jwt.guard';
|
import { OptionalJwtGuard } from './optional-jwt.guard';
|
||||||
import {
|
import {
|
||||||
@@ -43,6 +44,7 @@ export class VerifaydaController {
|
|||||||
constructor(private readonly service: VerifaydaService) {}
|
constructor(private readonly service: VerifaydaService) {}
|
||||||
|
|
||||||
@Post('start')
|
@Post('start')
|
||||||
|
@IsPublic()
|
||||||
@HttpCode(HttpStatus.OK)
|
@HttpCode(HttpStatus.OK)
|
||||||
@UseGuards(OptionalJwtGuard)
|
@UseGuards(OptionalJwtGuard)
|
||||||
@ApiBearerAuth('JWT-auth')
|
@ApiBearerAuth('JWT-auth')
|
||||||
@@ -77,6 +79,7 @@ export class VerifaydaController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Get('complete')
|
@Get('complete')
|
||||||
|
@IsPublic()
|
||||||
@ApiOperation({
|
@ApiOperation({
|
||||||
summary: 'Complete a verification (Fayda redirect / client callback lands here)',
|
summary: 'Complete a verification (Fayda redirect / client callback lands here)',
|
||||||
description: `This is the registered Fayda \`redirect_uri\`. Fayda redirects the browser here with \`?code&state\``,
|
description: `This is the registered Fayda \`redirect_uri\`. Fayda redirects the browser here with \`?code&state\``,
|
||||||
|
|||||||
Reference in New Issue
Block a user