mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-26 08:54:54 +00:00
SPRINT-1 related tasks done
This commit is contained in:
@ -2,9 +2,11 @@ import {
|
||||
Body,
|
||||
Controller,
|
||||
Delete,
|
||||
Get,
|
||||
HttpStatus,
|
||||
Param,
|
||||
Post,
|
||||
Req,
|
||||
UseGuards,
|
||||
} from '@nestjs/common';
|
||||
import { UserAuthService } from '../services/user-auth.service';
|
||||
@ -14,6 +16,8 @@ import { ResponseMessage } from '../../../libs/common/src/response/response.deco
|
||||
import { UserLoginDto } from '../dtos/user-login.dto';
|
||||
import { JwtAuthGuard } from '../../../libs/common/src/guards/jwt.auth.guard';
|
||||
import { ForgetPasswordDto, UserOtpDto, VerifyOtpDto } from '../dtos';
|
||||
import { Request } from 'express';
|
||||
import { RefreshTokenGuard } from '@app/common/guards/jwt-refresh.auth.guard';
|
||||
|
||||
@Controller({
|
||||
version: '1',
|
||||
@ -93,4 +97,33 @@ export class UserAuthController {
|
||||
message: 'Password changed successfully',
|
||||
};
|
||||
}
|
||||
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Get('user/list')
|
||||
async userList(@Req() req) {
|
||||
const userList = await this.userAuthService.userList();
|
||||
return {
|
||||
statusCode: HttpStatus.OK,
|
||||
data: userList,
|
||||
message: 'User List Fetched Successfully',
|
||||
};
|
||||
}
|
||||
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(RefreshTokenGuard)
|
||||
@Get('refresh-token')
|
||||
async refreshToken(@Req() req) {
|
||||
const refreshToken = await this.userAuthService.refreshToken(
|
||||
req.user.uuid,
|
||||
req.headers.authorization,
|
||||
req.user.type,
|
||||
req.user.sessionId,
|
||||
);
|
||||
return {
|
||||
statusCode: HttpStatus.OK,
|
||||
data: refreshToken,
|
||||
message: 'Refresh Token added Successfully',
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user