Spaces:
Running
Running
Bibhu Mishra
Add GitHub Actions CI/CD, HF Space deployment, market hours guard, and static serving
abc493d | 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); | |
| } | |
| } | |