mirror of
https://github.com/SyncrowIOT/backend.git
synced 2026-10-23 18:57:55 +00:00
Refactor and add new user-related endpoints for projects
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
import { ControllerRoute } from '@app/common/constants/controller-route';
|
||||
import { Controller, Get, Param, UseGuards } from '@nestjs/common';
|
||||
import { ApiBearerAuth, ApiOperation, ApiTags } from '@nestjs/swagger';
|
||||
import { BaseResponseDto } from '@app/common/dto/base.response.dto';
|
||||
import { JwtAuthGuard } from '@app/common/guards/jwt.auth.guard';
|
||||
import { GetProjectParam } from '../dto';
|
||||
import { ProjectUserService } from '../services/project-user.service';
|
||||
|
||||
@ApiTags('Project Module')
|
||||
@Controller({
|
||||
version: '1',
|
||||
path: ControllerRoute.PROJECT_USER.ROUTE,
|
||||
})
|
||||
export class ProjectUserController {
|
||||
constructor(private readonly projectUserService: ProjectUserService) {}
|
||||
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@ApiOperation({
|
||||
summary:
|
||||
ControllerRoute.PROJECT.ACTIONS.GET_USER_BY_UUID_IN_PROJECT_SUMMARY,
|
||||
description:
|
||||
ControllerRoute.PROJECT.ACTIONS.GET_USER_BY_UUID_IN_PROJECT_DESCRIPTION,
|
||||
})
|
||||
@Get()
|
||||
async findUsersByProject(
|
||||
@Param() params: GetProjectParam,
|
||||
): Promise<BaseResponseDto> {
|
||||
return this.projectUserService.getUsersByProject(params.projectUuid);
|
||||
}
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@ApiOperation({
|
||||
summary: ControllerRoute.PROJECT.ACTIONS.GET_USERS_BY_PROJECT_SUMMARY,
|
||||
description:
|
||||
ControllerRoute.PROJECT.ACTIONS.GET_USERS_BY_PROJECT_DESCRIPTION,
|
||||
})
|
||||
@Get(':userUuid')
|
||||
async findUserByUuidInProject(
|
||||
@Param() params: GetProjectParam,
|
||||
@Param('userUuid') userUuid: string,
|
||||
): Promise<BaseResponseDto> {
|
||||
return this.projectUserService.getUserByUuidInProject(
|
||||
params.projectUuid,
|
||||
userUuid,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user