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

@@ -28,9 +28,8 @@ import {
PaymentMethodTypeEnum,
PaymentPlatformDto,
} from "./payments.dto";
import { JwtGuard } from "../../common/jwt.guard";
import { RolesGuard } from "../../common/roles.guard";
import { Roles } from "../../common/roles.decorator";
import { PassengerStaff } from "../../common/passenger-guards";
import { PASSENGER_PERMS } from "../../seed/passenger-permissions.registry";
@ApiTags("Payment")
@Controller("payments")
@@ -38,9 +37,8 @@ export class PaymentsController {
constructor(private service: PaymentsService) {}
@Get("all")
@UseGuards(JwtGuard, RolesGuard)
@Roles('ADMIN', 'SUPERVISOR', 'STAFF')
@ApiBearerAuth("JWT-auth")
@PassengerStaff([PASSENGER_PERMS.payments.viewAll, PASSENGER_PERMS.admin])
@ApiBearerAuth("IAM-auth")
@ApiOperation({ summary: "Get all payments with filters (staff/admin only)" })
@ApiQuery({ name: "search", required: false })
@ApiQuery({ name: "status", required: false })
@@ -101,18 +99,16 @@ export class PaymentsController {
}
@Post("refund")
@UseGuards(JwtGuard, RolesGuard)
@Roles('ADMIN', 'STAFF', 'AGENT')
@ApiBearerAuth("JWT-auth")
@PassengerStaff([PASSENGER_PERMS.payments.refund, PASSENGER_PERMS.admin])
@ApiBearerAuth("IAM-auth")
@ApiOperation({ summary: "Refund a confirmed booking (staff/agent only)" })
refund(@Body() dto: RefundDto) {
return this.service.refund(dto);
}
@Post("methods")
@UseGuards(JwtGuard, RolesGuard)
@Roles('ADMIN', 'STAFF')
@ApiBearerAuth("JWT-auth")
@PassengerStaff([PASSENGER_PERMS.payments.manageMethods, PASSENGER_PERMS.admin])
@ApiBearerAuth("IAM-auth")
@ApiOperation({
summary: "Add a payment system to the platform catalog (admin only)",
})