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