Merge pull request #276 from Tria-plc/alpha

refactor: ( iam ) add ispublic to public endpoints
This commit is contained in:
Abubeker Yasin
2026-06-24 16:07:45 +03:00
committed by GitHub
2 changed files with 8 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
import { Body, Controller, Get, Param, Post, Patch, Delete, UseGuards, Request, Query } from '@nestjs/common';
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 { CreatePackageDto, BookPackageDto, CreatePriceTierDto, UpdatePriceTierDto } from './packages.dto';
import { JwtGuard } from '../../common/jwt.guard';
@@ -11,6 +12,7 @@ export class PackagesController {
constructor(private readonly service: PackagesService) {}
@Get()
@IsPublic()
@ApiOperation({ summary: 'List active packages' })
listActive() {
return this.service.listActive();
@@ -33,12 +35,14 @@ export class PackagesController {
}
@Get('booking/:ref')
@IsPublic()
@ApiOperation({ summary: 'Get package booking by reference' })
getBookingByRef(@Param('ref') ref: string) {
return this.service.getBookingByRef(ref);
}
@Get(':id')
@IsPublic()
@ApiOperation({ summary: 'Get package details' })
getById(@Param('id') id: string) {
return this.service.getById(id);
@@ -93,6 +97,7 @@ export class PackagesController {
}
@Post('book')
@IsPublic()
@UseGuards(OptionalJwtGuard)
@ApiBearerAuth('JWT-auth')
@ApiOperation({ summary: 'Book a package (public or authenticated)' })

View File

@@ -17,6 +17,7 @@ import {
} from '@nestjs/swagger';
import { Throttle } from '@nestjs/throttler';
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 { OptionalJwtGuard } from './optional-jwt.guard';
import {
@@ -43,6 +44,7 @@ export class VerifaydaController {
constructor(private readonly service: VerifaydaService) {}
@Post('start')
@IsPublic()
@HttpCode(HttpStatus.OK)
@UseGuards(OptionalJwtGuard)
@ApiBearerAuth('JWT-auth')
@@ -77,6 +79,7 @@ export class VerifaydaController {
}
@Get('complete')
@IsPublic()
@ApiOperation({
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\``,