Spaces:
Running
Running
Bibhu Mishra
Claude Sonnet 4.6
Add GitHub Actions CI/CD, HF Space deployment, market hours guard, and static serving
abc493d Download api/src/users/users.controller.ts from mishrabp/stockadvisor: direct link, hf CLI and curl.
- Browser
- Download file 984 Bytes
-
https://huggingface.co/spaces/mishrabp/stockadvisor/resolve/main/api/src/users/users.controller.ts
- Command line
-
hf download hf://spaces/mishrabp/stockadvisor/api/src/users/users.controller.ts
-
curl -L -o users.controller.ts https://huggingface.co/spaces/mishrabp/stockadvisor/resolve/main/api/src/users/users.controller.ts
984 Bytes
| 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); | |
| } | |
| } | |