18 lines
574 B
TypeScript
18 lines
574 B
TypeScript
import { Controller, Post, Body, UseGuards, Req } from '@nestjs/common';
|
|
import { AdminService } from './admin.service';
|
|
import { JwtAuthGuard } from '../auth/jwt-auth.guard';
|
|
|
|
@Controller('admin')
|
|
export class AdminController {
|
|
constructor(private readonly adminService: AdminService) {}
|
|
|
|
@Post('change-password')
|
|
@UseGuards(JwtAuthGuard)
|
|
async changePassword(
|
|
@Req() req,
|
|
@Body('oldPassword') oldPassword: string,
|
|
@Body('newPassword') newPassword: string,
|
|
) {
|
|
return this.adminService.changePassword(req.user.id, oldPassword, newPassword);
|
|
}
|
|
}
|