feat: ( passenger ) wire IAM global guard, org seeder, and backoffice auth

This commit is contained in:
Abubeker Yasin
2026-06-23 14:25:10 +03:00
parent 707e32c43c
commit 1eaffa7ba0
17 changed files with 658 additions and 99 deletions

View File

@@ -1,10 +1,9 @@
import { Controller, Get, Post, Patch, Delete, Body, Param, HttpCode, UseGuards } from '@nestjs/common';
import { Controller, Get, Post, Patch, Delete, Body, Param, HttpCode } from '@nestjs/common';
import { ApiTags, ApiBearerAuth } from '@nestjs/swagger';
import { CurrenciesService } from './currencies.service';
import { CreateCurrencyDto, UpdateCurrencyDto } from './currencies.dto';
import { IamGuard } from '../../common/iam-adapter';
import { Roles } from '../../common/roles.decorator';
import { RolesGuard } from '../../common/roles.guard';
import { PassengerAdmin, PassengerStaff } from '../../common/passenger-guards';
import { PASSENGER_PERMS } from '../../seed/passenger-permissions.registry';
@ApiTags('Currencies')
@Controller('currencies')
@@ -17,8 +16,7 @@ export class CurrenciesController {
}
@Post()
@UseGuards(IamGuard, RolesGuard)
@Roles('ADMIN')
@PassengerStaff(PASSENGER_PERMS.currencies.manage)
@ApiBearerAuth('IAM-auth')
@HttpCode(201)
createCurrency(@Body() dto: CreateCurrencyDto) {
@@ -26,24 +24,21 @@ export class CurrenciesController {
}
@Patch(':id')
@UseGuards(IamGuard, RolesGuard)
@Roles('ADMIN')
@PassengerStaff(PASSENGER_PERMS.currencies.manage)
@ApiBearerAuth('IAM-auth')
updateCurrency(@Param('id') id: string, @Body() dto: UpdateCurrencyDto) {
return this.currenciesService.updateCurrency(id, dto);
}
@Delete(':id')
@UseGuards(IamGuard, RolesGuard)
@Roles('ADMIN')
@PassengerAdmin()
@ApiBearerAuth('IAM-auth')
deleteCurrency(@Param('id') id: string) {
return this.currenciesService.deleteCurrency(id);
}
@Post('sync-rates')
@UseGuards(IamGuard, RolesGuard)
@Roles('ADMIN')
@PassengerStaff(PASSENGER_PERMS.currencies.manage)
@ApiBearerAuth('IAM-auth')
@HttpCode(200)
syncRates() {