Spaces:
Running
Running
Bibhu Mishra
Add GitHub Actions CI/CD, HF Space deployment, market hours guard, and static serving
abc493d | import { Controller, Get, Param, Patch, Body, UseGuards, ForbiddenException, Request } from '@nestjs/common'; | |
| import { JwtAuthGuard } from '../auth/jwt-auth.guard'; | |
| import { UsersService } from './users.service'; | |
| ('users') | |
| (JwtAuthGuard) | |
| export class UsersController { | |
| constructor(private svc: UsersService) {} | |
| () | |
| findAll(() req: { user: { role: string } }) { | |
| if (req.user.role !== 'admin') throw new ForbiddenException(); | |
| return this.svc.findAll(); | |
| } | |
| (':id/approve') | |
| approve(('id') id: string, () req: { user: { role: string } }) { | |
| if (req.user.role !== 'admin') throw new ForbiddenException(); | |
| return this.svc.approve(+id); | |
| } | |
| (':id/role') | |
| setRole( | |
| ('id') id: string, | |
| () body: { role: string }, | |
| () req: { user: { role: string } }, | |
| ) { | |
| if (req.user.role !== 'admin') throw new ForbiddenException(); | |
| return this.svc.setRole(+id, body.role); | |
| } | |
| } | |