Add workspace scoping to pipeline progress and expose findManyPipelineeProgress on graphql (#292)
Add workspace scoping to pipeline progress and expose findManyPipelineProgress on graphql
This commit is contained in:
31
server/src/api/resolvers/pipeline-progress.resolver.ts
Normal file
31
server/src/api/resolvers/pipeline-progress.resolver.ts
Normal file
@ -0,0 +1,31 @@
|
||||
import { Resolver, Args, Query } from '@nestjs/graphql';
|
||||
import { UseGuards } from '@nestjs/common';
|
||||
import { JwtAuthGuard } from 'src/auth/guards/jwt.auth.guard';
|
||||
import { PrismaService } from 'src/database/prisma.service';
|
||||
import { Workspace } from '../@generated/workspace/workspace.model';
|
||||
import { AuthWorkspace } from './decorators/auth-workspace.decorator';
|
||||
import { ArgsService } from './services/args.service';
|
||||
import { FindManyPipelineProgressArgs } from '../@generated/pipeline-progress/find-many-pipeline-progress.args';
|
||||
import { PipelineProgress } from '../@generated/pipeline-progress/pipeline-progress.model';
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Resolver(() => PipelineProgress)
|
||||
export class PipelineProgressResolver {
|
||||
constructor(
|
||||
private readonly prismaService: PrismaService,
|
||||
private readonly argsService: ArgsService,
|
||||
) {}
|
||||
|
||||
@Query(() => [PipelineProgress])
|
||||
async findManyPipelineProgress(
|
||||
@Args() args: FindManyPipelineProgressArgs,
|
||||
@AuthWorkspace() workspace: Workspace,
|
||||
) {
|
||||
const preparedArgs =
|
||||
await this.argsService.prepareFindManyArgs<FindManyPipelineProgressArgs>(
|
||||
args,
|
||||
workspace,
|
||||
);
|
||||
return this.prismaService.pipelineProgress.findMany(preparedArgs);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user