Implement 'getMe' endpoint in AdminController to retrieve current admin details; update AdminService to return transformed admin details and adjust findById method for improved data handling. Remove unused user profile retrieval method from AdminUserController.
This commit is contained in:
@@ -3,7 +3,6 @@ import { ApiTags, ApiBearerAuth, ApiOperation, ApiOkResponse } from '@nestjs/swa
|
||||
import { AdminAuthGuard } from 'src/modules/auth/guards/adminAuth.guard';
|
||||
import { UserService } from '../user.service';
|
||||
import { FindUsersDto } from '../dto/find-user.dto';
|
||||
import { UserId } from 'src/common/decorators/user-id.decorator';
|
||||
import { RestId } from 'src/common/decorators';
|
||||
|
||||
@UseGuards(AdminAuthGuard)
|
||||
@@ -13,21 +12,6 @@ import { RestId } from 'src/common/decorators';
|
||||
export class AdminUserController {
|
||||
constructor(private readonly userService: UserService) {}
|
||||
|
||||
@UseGuards(AdminAuthGuard)
|
||||
@ApiBearerAuth()
|
||||
@ApiOperation({ summary: 'Get the current authenticated user profile' })
|
||||
@Get('/me')
|
||||
async getUser(@UserId() userId: string) {
|
||||
const user = await this.userService.findById(userId);
|
||||
return {
|
||||
message: `GET request: Retrieving profile for authenticated user`,
|
||||
user,
|
||||
userId,
|
||||
};
|
||||
}
|
||||
|
||||
@UseGuards(AdminAuthGuard)
|
||||
@ApiBearerAuth()
|
||||
@ApiOperation({ summary: 'Get paginated list of users with filters' })
|
||||
@ApiOkResponse({ description: 'Paginated list of users' })
|
||||
@Get('/')
|
||||
|
||||
Reference in New Issue
Block a user