chore: add guard to some routes
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
import { Injectable } from "@nestjs/common";
|
||||
|
||||
import { IFile } from "../utils/interfaces/IFile";
|
||||
import { S3Service } from "../utils/providers/s3.service";
|
||||
|
||||
@Injectable()
|
||||
export class UploaderService {
|
||||
constructor(private s3Service: S3Service) {}
|
||||
|
||||
async upload(file: any) {
|
||||
async upload(file: IFile) {
|
||||
return await this.s3Service.upload(file);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,12 @@ import { ApiOperation, ApiTags } from "@nestjs/swagger";
|
||||
|
||||
import { CheckValidityDTO } from "./DTO/check-validity.dto";
|
||||
import { UpdateProfileDto } from "./DTO/update-profile.dto";
|
||||
import { CreateUserGroupDto } from "./DTO/user-group.dto";
|
||||
import { User } from "./entities/user.entity";
|
||||
import { RoleEnum } from "./enums/role.enum";
|
||||
import { UsersService } from "./providers/users.service";
|
||||
import { AuthGuards } from "../../common/decorators/auth-guard.decorator";
|
||||
import { Roles } from "../../common/decorators/roles.decorator";
|
||||
import { UserDec } from "../../common/decorators/user.decorator";
|
||||
|
||||
@Controller("users")
|
||||
@@ -34,4 +37,13 @@ export class UsersController {
|
||||
checkValidity(@Body() checkValidityDto: CheckValidityDTO, @UserDec() user: User) {
|
||||
return this.usersService.checkValidity(checkValidityDto, user.id);
|
||||
}
|
||||
|
||||
@AuthGuards()
|
||||
@Roles(RoleEnum.ADMIN)
|
||||
@ApiOperation({ summary: "Create user group" })
|
||||
@HttpCode(HttpStatus.OK)
|
||||
@Post("user-group")
|
||||
createUserGroup(@Body() createDto: CreateUserGroupDto) {
|
||||
return this.usersService.createUserGroup(createDto);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user