Spaces:
Sleeping
Sleeping
import { Body, Controller, Get, Post, Put, Query, Request } from '@nestjs/common'; | |
import { UserService } from './user.service.js'; | |
import { UserEntity } from 'src/entities/user.entity.js'; | |
import { Roles } from '../authentication/authorization/roles.decorator.js'; | |
import { Role } from '../../common/enums/role.enum.js'; | |
import { Paginate, PaginateQuery } from 'nestjs-paginate'; | |
import { UpdateUsersDto } from './dto/update-users.dto.js'; | |
'users') | (|
export class UsersController { | |
constructor(private readonly usersService: UserService) {} | |
'updateUser') | (|
async updateUser(){ () req | |
const userId = req.user.sub; | |
const updateUserDto = req.body; | |
return this.usersService.updateUserById(userId, updateUserDto); | |
} | |
'updateList') | (|
Role.ADMIN) | (|
async updateUsers( | |
() updateUsersDto: UpdateUsersDto[], | |
) { | |
return this.usersService.updateUsers(updateUsersDto); | |
} | |
'getUsers') | (|
Role.ADMIN, Role.AREA_MANAGER, Role.BRANCH_MANAGER) | (|
async getUsers( ) { () query: PaginateQuery, | |
return this.usersService.getUsers(query); | |
} | |
} | |