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/auth/auth.controller.ts from mishrabp/stockadvisor: direct link, hf CLI and curl.
- Browser
- Download file 1.32 kB
-
https://huggingface.co/spaces/mishrabp/stockadvisor/resolve/main/api/src/auth/auth.controller.ts
- Command line
-
hf download hf://spaces/mishrabp/stockadvisor/api/src/auth/auth.controller.ts
-
curl -L -o auth.controller.ts https://huggingface.co/spaces/mishrabp/stockadvisor/resolve/main/api/src/auth/auth.controller.ts
1.32 kB
| import { Body, Controller, Get, Patch, Post, Request, SetMetadata, UseGuards } from '@nestjs/common'; | |
| import { IS_PUBLIC_KEY, JwtAuthGuard } from './jwt-auth.guard'; | |
| import { AuthService } from './auth.service'; | |
| ('auth') | |
| export class AuthController { | |
| constructor(private auth: AuthService) {} | |
| (IS_PUBLIC_KEY, true) | |
| ('register') | |
| register(() body: { email: string; name: string; password: string }) { | |
| return this.auth.register(body.email, body.name, body.password); | |
| } | |
| (IS_PUBLIC_KEY, true) | |
| ('login') | |
| login(() body: { email: string; password: string }) { | |
| return this.auth.login(body.email, body.password); | |
| } | |
| (JwtAuthGuard) | |
| ('me') | |
| me(() req: { user: { id: number } }) { | |
| return this.auth.me(req.user.id); | |
| } | |
| (JwtAuthGuard) | |
| ('profile') | |
| updateProfile( | |
| () req: { user: { id: number } }, | |
| () body: { name: string }, | |
| ) { | |
| return this.auth.updateProfile(req.user.id, body.name); | |
| } | |
| (JwtAuthGuard) | |
| ('password') | |
| changePassword( | |
| () req: { user: { id: number } }, | |
| () body: { currentPassword: string; newPassword: string }, | |
| ) { | |
| return this.auth.changePassword(req.user.id, body.currentPassword, body.newPassword); | |
| } | |
| } | |