Various fixes (#362)
This commit is contained in:
@ -1517,7 +1517,6 @@ export type WorkspaceMember = {
|
||||
user: User;
|
||||
userId: Scalars['String'];
|
||||
workspace: Workspace;
|
||||
workspaceId: Scalars['String'];
|
||||
};
|
||||
|
||||
export type CreateCommentMutationVariables = Exact<{
|
||||
@ -1633,6 +1632,7 @@ export type UpdateOnePipelineProgressMutationVariables = Exact<{
|
||||
export type UpdateOnePipelineProgressMutation = { __typename?: 'Mutation', updateOnePipelineProgress?: { __typename?: 'PipelineProgress', id: string } | null };
|
||||
|
||||
export type CreateOnePipelineProgressMutationVariables = Exact<{
|
||||
uuid: Scalars['String'];
|
||||
entityType: PipelineProgressableType;
|
||||
entityId: Scalars['String'];
|
||||
pipelineId: Scalars['String'];
|
||||
@ -2298,9 +2298,9 @@ export type UpdateOnePipelineProgressMutationHookResult = ReturnType<typeof useU
|
||||
export type UpdateOnePipelineProgressMutationResult = Apollo.MutationResult<UpdateOnePipelineProgressMutation>;
|
||||
export type UpdateOnePipelineProgressMutationOptions = Apollo.BaseMutationOptions<UpdateOnePipelineProgressMutation, UpdateOnePipelineProgressMutationVariables>;
|
||||
export const CreateOnePipelineProgressDocument = gql`
|
||||
mutation CreateOnePipelineProgress($entityType: PipelineProgressableType!, $entityId: String!, $pipelineId: String!, $pipelineStageId: String!) {
|
||||
mutation CreateOnePipelineProgress($uuid: String!, $entityType: PipelineProgressableType!, $entityId: String!, $pipelineId: String!, $pipelineStageId: String!) {
|
||||
createOnePipelineProgress(
|
||||
data: {progressableType: $entityType, progressableId: $entityId, pipeline: {connect: {id: $pipelineId}}, pipelineStage: {connect: {id: $pipelineStageId}}}
|
||||
data: {id: $uuid, progressableType: $entityType, progressableId: $entityId, pipeline: {connect: {id: $pipelineId}}, pipelineStage: {connect: {id: $pipelineStageId}}}
|
||||
) {
|
||||
id
|
||||
}
|
||||
@ -2321,6 +2321,7 @@ export type CreateOnePipelineProgressMutationFn = Apollo.MutationFunction<Create
|
||||
* @example
|
||||
* const [createOnePipelineProgressMutation, { data, loading, error }] = useCreateOnePipelineProgressMutation({
|
||||
* variables: {
|
||||
* uuid: // value for 'uuid'
|
||||
* entityType: // value for 'entityType'
|
||||
* entityId: // value for 'entityId'
|
||||
* pipelineId: // value for 'pipelineId'
|
||||
|
||||
@ -48,6 +48,7 @@ export function NewButton({ pipelineId, columnId }: OwnProps) {
|
||||
setBoard(newBoard);
|
||||
await createOnePipelineProgress({
|
||||
variables: {
|
||||
uuid: newUuid,
|
||||
pipelineStageId: columnId,
|
||||
pipelineId,
|
||||
entityId: company.id,
|
||||
|
||||
@ -33,6 +33,7 @@ export const UPDATE_PIPELINE_STAGE = gql`
|
||||
|
||||
export const ADD_ENTITY_TO_PIPELINE = gql`
|
||||
mutation CreateOnePipelineProgress(
|
||||
$uuid: String!
|
||||
$entityType: PipelineProgressableType!
|
||||
$entityId: String!
|
||||
$pipelineId: String!
|
||||
@ -40,6 +41,7 @@ export const ADD_ENTITY_TO_PIPELINE = gql`
|
||||
) {
|
||||
createOnePipelineProgress(
|
||||
data: {
|
||||
id: $uuid
|
||||
progressableType: $entityType
|
||||
progressableId: $entityId
|
||||
pipeline: { connect: { id: $pipelineId } }
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import styled from '@emotion/styled';
|
||||
|
||||
import { Pipeline } from '../interfaces/pipeline.interface';
|
||||
import { Pipeline } from '~/generated/graphql';
|
||||
|
||||
type OwnProps = {
|
||||
opportunity: Pipeline;
|
||||
|
||||
@ -1,12 +0,0 @@
|
||||
export interface Pipeline {
|
||||
id: string;
|
||||
name?: string;
|
||||
icon?: string | null;
|
||||
}
|
||||
|
||||
export interface GraphqlQueryPipeline {
|
||||
id: string;
|
||||
name?: string;
|
||||
icon?: string | null;
|
||||
__typename?: string;
|
||||
}
|
||||
@ -61,18 +61,24 @@ export class AbilityFactory {
|
||||
|
||||
// Company
|
||||
can(AbilityAction.Read, 'Company', { workspaceId: workspace.id });
|
||||
can(AbilityAction.Create, 'Company');
|
||||
can(AbilityAction.Update, 'Company', { workspaceId: workspace.id });
|
||||
|
||||
// Person
|
||||
can(AbilityAction.Read, 'Person', { workspaceId: workspace.id });
|
||||
can(AbilityAction.Create, 'Person');
|
||||
can(AbilityAction.Update, 'Person', { workspaceId: workspace.id });
|
||||
|
||||
// RefreshToken
|
||||
cannot(AbilityAction.Manage, 'RefreshToken');
|
||||
|
||||
// CommentThread
|
||||
can(AbilityAction.Read, 'CommentThread', { workspaceId: workspace.id });
|
||||
can(AbilityAction.Create, 'CommentThread');
|
||||
|
||||
// Comment
|
||||
can(AbilityAction.Read, 'Comment', { workspaceId: workspace.id });
|
||||
can(AbilityAction.Create, 'Comment');
|
||||
can(AbilityAction.Update, 'Comment', {
|
||||
workspaceId: workspace.id,
|
||||
authorId: user.id,
|
||||
|
||||
@ -47,6 +47,7 @@ export class UpdateCompanyAbilityHandler implements IAbilityHandler {
|
||||
const company = await this.prismaService.company.findFirst({
|
||||
where: args.where,
|
||||
});
|
||||
|
||||
assert(company, '', NotFoundException);
|
||||
|
||||
return ability.can(AbilityAction.Update, subject('Company', company));
|
||||
|
||||
@ -24,11 +24,11 @@ import {
|
||||
CreateCompanyAbilityHandler,
|
||||
DeleteCompanyAbilityHandler,
|
||||
ReadCompanyAbilityHandler,
|
||||
UpdateCompanyAbilityHandler,
|
||||
} from 'src/ability/handlers/company.ability-handler';
|
||||
import { UserAbility } from 'src/decorators/user-ability.decorator';
|
||||
import { AppAbility } from 'src/ability/ability.factory';
|
||||
import { accessibleBy } from '@casl/prisma';
|
||||
import { UpdateCommentAbilityHandler } from 'src/ability/handlers/comment.ability-handler';
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Resolver(() => Company)
|
||||
@ -59,7 +59,7 @@ export class CompanyResolver {
|
||||
nullable: true,
|
||||
})
|
||||
@UseGuards(AbilityGuard)
|
||||
@CheckAbilities(UpdateCommentAbilityHandler)
|
||||
@CheckAbilities(UpdateCompanyAbilityHandler)
|
||||
async updateOneCompany(
|
||||
@Args() args: UpdateOneCompanyArgs,
|
||||
@PrismaSelector({ modelName: 'Company' })
|
||||
|
||||
Reference in New Issue
Block a user