Spaces:
Runtime error
Runtime error
Download src/app/auth/auth.controller.ts from WaiYanLynn/meow-map: direct link, hf CLI and curl.
- Browser
- Download file 1.52 kB
-
https://huggingface.co/spaces/WaiYanLynn/meow-map/resolve/main/src/app/auth/auth.controller.ts
- Command line
-
hf download hf://spaces/WaiYanLynn/meow-map/src/app/auth/auth.controller.ts
-
curl -L -o auth.controller.ts https://huggingface.co/spaces/WaiYanLynn/meow-map/resolve/main/src/app/auth/auth.controller.ts
1.52 kB
| import { Body, Controller, Get, Post, Query, Req } from '@nestjs/common'; | |
| import { AuthSignUpDto } from './dto/auth-sign-up.dto'; | |
| import { AuthSignInDto } from './dto/auth-sign-in.dto'; | |
| import { AuthService } from './auth.service'; | |
| import { JwtService } from '@nestjs/jwt'; | |
| import { Public } from './guard/jwt.guard'; | |
| import { Request } from 'express'; | |
| ('auth') | |
| export class AuthController { | |
| constructor( | |
| private readonly authService: AuthService, | |
| private readonly jwtService: JwtService, | |
| ) {} | |
| () | |
| ('sign-in') | |
| signIn(() body: AuthSignInDto, () request: Request) { | |
| const ip = request.ip; | |
| const device = request.headers['user-agent']; | |
| return this.authService.signIn({ | |
| email: body.email, | |
| password: body.password, | |
| ip, | |
| device, | |
| }); | |
| } | |
| () | |
| ('sign-up') | |
| signUp(() authSignUpDto: AuthSignUpDto) { | |
| return this.authService.signUp(authSignUpDto); | |
| } | |
| () | |
| ('email-confirm') | |
| async emailConfirm(('token') token: string) { | |
| await this.authService.emailConfirm(token); | |
| return { success: true }; | |
| } | |
| () | |
| ('refresh') | |
| refresh(() body: { refreshToken: string }, () request: Request) { | |
| return this.authService.newToken({ | |
| refreshToken: body.refreshToken, | |
| device: request.headers['user-agent'], | |
| ip: request.ip, | |
| }); | |
| } | |
| } | |