Merge branch 'rafi/taskmanager'
Build and Deploy Docker Images / build_and_deploy (push) Has been cancelled
Build and Deploy Docker Images / build_and_deploy (push) Has been cancelled
This commit is contained in:
@@ -20,6 +20,15 @@ import { ITokenPayload } from "../../auth/interfaces/IToken-payload";
|
|||||||
export class ProjectController {
|
export class ProjectController {
|
||||||
constructor(private readonly projectService: ProjectService) {}
|
constructor(private readonly projectService: ProjectService) {}
|
||||||
|
|
||||||
|
@Get(':id')
|
||||||
|
@ApiOperation({summary: 'Get one project by ID'})
|
||||||
|
@ApiResponse({status: 200, description: 'received the project successfully!'})
|
||||||
|
@ApiResponse({status: 404, description: 'Project Not Found!'})
|
||||||
|
@ApiResponse({status: 400, description: 'Bad Request!'})
|
||||||
|
findOne(@Param('id') id: string) {
|
||||||
|
return this.projectService.findOneOrFail(id);
|
||||||
|
}
|
||||||
|
|
||||||
@Post()
|
@Post()
|
||||||
@PermissionsDec(PermissionEnum.PROJECT)
|
@PermissionsDec(PermissionEnum.PROJECT)
|
||||||
@ApiOperation({ summary: "Create a new project" })
|
@ApiOperation({ summary: "Create a new project" })
|
||||||
@@ -63,7 +72,7 @@ export class ProjectController {
|
|||||||
return this.projectService.findUserProjectsByWorkspace(user.id, user.permissions, paramDto.id, pagination);
|
return this.projectService.findUserProjectsByWorkspace(user.id, user.permissions, paramDto.id, pagination);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get("project/:id")
|
@Get("detail/:id")
|
||||||
@ApiOperation({ summary: "Get project detail" })
|
@ApiOperation({ summary: "Get project detail" })
|
||||||
@ApiResponse({ status: 200, description: "Got Project Detail Successfully!" })
|
@ApiResponse({ status: 200, description: "Got Project Detail Successfully!" })
|
||||||
@ApiResponse({ status: 400, description: "Bad request!" })
|
@ApiResponse({ status: 400, description: "Bad request!" })
|
||||||
|
|||||||
@@ -18,6 +18,16 @@ import { ITokenPayload } from '../../auth/interfaces/IToken-payload';
|
|||||||
export class WorkspaceController {
|
export class WorkspaceController {
|
||||||
constructor(private readonly workspaceService: WorkspaceService) {}
|
constructor(private readonly workspaceService: WorkspaceService) {}
|
||||||
|
|
||||||
|
@Get(':id')
|
||||||
|
@PermissionsDec(PermissionEnum.WORKSPACE)
|
||||||
|
@ApiOperation({summary: "Get one workspace by ID"})
|
||||||
|
@ApiResponse({status: 200, description: 'Received workspace', type: TMWorkspace})
|
||||||
|
@ApiResponse({status: 404, description: 'Workspace Not Found!'})
|
||||||
|
@ApiResponse({status: 400, description: 'Bad Request!'})
|
||||||
|
findOne(@Param('id') id: string): Promise<TMWorkspace> {
|
||||||
|
return this.workspaceService.findOneOrFail(id);
|
||||||
|
}
|
||||||
|
|
||||||
@Post()
|
@Post()
|
||||||
@PermissionsDec(PermissionEnum.WORKSPACE)
|
@PermissionsDec(PermissionEnum.WORKSPACE)
|
||||||
@ApiOperation({ summary: 'Create a new workspace' })
|
@ApiOperation({ summary: 'Create a new workspace' })
|
||||||
|
|||||||
@@ -17,10 +17,6 @@ export class WorkspaceService {
|
|||||||
private readonly userRepository: Repository<User>,
|
private readonly userRepository: Repository<User>,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
findAll(): Promise<TMWorkspace[]> {
|
|
||||||
return this.workspaceRepository.find({});
|
|
||||||
}
|
|
||||||
|
|
||||||
async findOneOrFail(id: string): Promise<TMWorkspace> {
|
async findOneOrFail(id: string): Promise<TMWorkspace> {
|
||||||
const workspace = await this.workspaceRepository.findOneWorkSpace(id);
|
const workspace = await this.workspaceRepository.findOneWorkSpace(id);
|
||||||
if (!workspace) throw new NotFoundException(WorkSpaceMessage.WORKSPACE_NOT_FOUND);
|
if (!workspace) throw new NotFoundException(WorkSpaceMessage.WORKSPACE_NOT_FOUND);
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export enum PermissionEnum {
|
|||||||
DPAGE = "dpage",
|
DPAGE = "dpage",
|
||||||
DMAIL = 'dmail',
|
DMAIL = 'dmail',
|
||||||
RESELLER="reseller",
|
RESELLER="reseller",
|
||||||
WORKSPACE="workspace", // create, update, remove
|
WORKSPACE="workspace", // create, update, remove, read-one(for update purposes)
|
||||||
VIEW_ALL_WORKSPACES="view_all_workspaces",
|
VIEW_ALL_WORKSPACES="view_all_workspaces",
|
||||||
PROJECT="project", // create, update, remove
|
PROJECT="project", // create, update, remove
|
||||||
VIEW_ALL_PROJECTS="view_all_projects",
|
VIEW_ALL_PROJECTS="view_all_projects",
|
||||||
|
|||||||
Reference in New Issue
Block a user