[Feature] Implement Self-Serve Account Deletion

This commit is contained in:
Amruth Pillai
2023-01-19 00:11:15 +01:00
parent 5024c19f87
commit ff101dbfac
14 changed files with 235 additions and 14 deletions
+10 -1
View File
@@ -1,4 +1,4 @@
import { Body, Controller, Delete, Get, HttpCode, Post, UseGuards } from '@nestjs/common';
import { Body, Controller, Delete, Get, HttpCode, Patch, Post, UseGuards } from '@nestjs/common';
import { User } from '@/decorators/user.decorator';
import { User as UserEntity } from '@/users/entities/user.entity';
@@ -7,6 +7,7 @@ import { AuthService } from './auth.service';
import { ForgotPasswordDto } from './dto/forgot-password.dto';
import { RegisterDto } from './dto/register.dto';
import { ResetPasswordDto } from './dto/reset-password.dto';
import { UpdateProfileDto } from './dto/update-profile.dto';
import { JwtAuthGuard } from './guards/jwt.guard';
import { LocalAuthGuard } from './guards/local.guard';
@@ -57,6 +58,14 @@ export class AuthController {
return this.authService.resetPassword(resetPasswordDto);
}
@HttpCode(200)
@UseGuards(JwtAuthGuard)
@Patch('update-profile')
updateProfile(@User('id') userId: number, @Body() updateProfileDto: UpdateProfileDto) {
console.log({ userId, updateProfileDto });
return this.authService.updateProfile(userId, updateProfileDto);
}
@HttpCode(200)
@UseGuards(JwtAuthGuard)
@Delete()