Skip to content

Commit

Permalink
remove admin route from workspace role
Browse files Browse the repository at this point in the history
  • Loading branch information
rajdip-b committed Feb 19, 2024
1 parent 5dc7c8f commit bcaaee4
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 40 deletions.
38 changes: 18 additions & 20 deletions apps/api/src/workspace-role/controller/workspace-role.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@ import {
Param,
Post,
Put,
Query,
UseGuards
Query
} from '@nestjs/common'
import { WorkspaceRoleService } from '../service/workspace-role.service'
import { CurrentUser } from '../../decorators/user.decorator'
import { Authority, User, Workspace, WorkspaceRole } from '@prisma/client'
import { CreateWorkspaceRole } from '../dto/create-workspace-role/create-workspace-role'
import { AdminGuard } from '../../auth/guard/admin/admin.guard'
import { UpdateWorkspaceRole } from '../dto/update-workspace-role/update-workspace-role'
import { RequiredApiKeyAuthorities } from '../../decorators/required-api-key-authorities.decorator'

Expand Down Expand Up @@ -111,21 +109,21 @@ export class WorkspaceRoleController {
)
}

@Get()
@UseGuards(AdminGuard)
async getAllWorkspaceRoles(
@Query('page') page: number = 0,
@Query('limit') limit: number = 10,
@Query('sort') sort: string = 'name',
@Query('order') order: string = 'asc',
@Query('search') search: string = ''
) {
return await this.workspaceRoleService.getWorkspaceRoles(
page,
limit,
sort,
order,
search
)
}
// @Get()
// @UseGuards(AdminGuard)
// async getAllWorkspaceRoles(
// @Query('page') page: number = 0,
// @Query('limit') limit: number = 10,
// @Query('sort') sort: string = 'name',
// @Query('order') order: string = 'asc',
// @Query('search') search: string = ''
// ) {
// return await this.workspaceRoleService.getWorkspaceRoles(
// page,
// limit,
// sort,
// order,
// search
// )
// }
}
40 changes: 20 additions & 20 deletions apps/api/src/workspace-role/service/workspace-role.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,26 +307,26 @@ export class WorkspaceRoleService {
})
}

async getWorkspaceRoles(
page: number,
limit: number,
sort: string,
order: string,
search: string
): Promise<WorkspaceRole[]> {
return await this.prisma.workspaceRole.findMany({
where: {
name: {
contains: search
}
},
skip: page * limit,
take: limit,
orderBy: {
[sort]: order
}
})
}
// async getWorkspaceRoles(
// page: number,
// limit: number,
// sort: string,
// order: string,
// search: string
// ): Promise<WorkspaceRole[]> {
// return await this.prisma.workspaceRole.findMany({
// where: {
// name: {
// contains: search
// }
// },
// skip: page * limit,
// take: limit,
// orderBy: {
// [sort]: order
// }
// })
// }

private async getWorkspaceRoleWithAuthority(
userId: User['id'],
Expand Down

0 comments on commit bcaaee4

Please sign in to comment.