* Enable column edition, and fix ordering * Move queries to services * Add total amounts for board columns * Refactor totals selector as a family * Fix 0-index issue * Lint * Rename selector * Remove useless header * Address PR comments * Optimistically update board column names
86 lines
1.7 KiB
TypeScript
86 lines
1.7 KiB
TypeScript
import { gql } from '@apollo/client';
|
|
|
|
export const GET_PIPELINES = gql`
|
|
query GetPipelines($where: PipelineWhereInput) {
|
|
findManyPipeline(where: $where) {
|
|
id
|
|
name
|
|
pipelineProgressableType
|
|
pipelineStages {
|
|
id
|
|
name
|
|
color
|
|
index
|
|
pipelineProgresses {
|
|
id
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
export const GET_PIPELINE_PROGRESS = gql`
|
|
query GetPipelineProgress($where: PipelineProgressWhereInput) {
|
|
findManyPipelineProgress(where: $where, orderBy: { createdAt: asc }) {
|
|
id
|
|
progressableType
|
|
progressableId
|
|
amount
|
|
closeDate
|
|
}
|
|
}
|
|
`;
|
|
|
|
export const UPDATE_PIPELINE_PROGRESS = gql`
|
|
mutation UpdateOnePipelineProgress(
|
|
$id: String
|
|
$amount: Int
|
|
$closeDate: DateTime
|
|
) {
|
|
updateOnePipelineProgress(
|
|
where: { id: $id }
|
|
data: { amount: { set: $amount }, closeDate: { set: $closeDate } }
|
|
) {
|
|
id
|
|
amount
|
|
closeDate
|
|
}
|
|
}
|
|
`;
|
|
|
|
export const UPDATE_PIPELINE_PROGRESS_STAGE = gql`
|
|
mutation UpdateOnePipelineProgressStage(
|
|
$id: String
|
|
$pipelineStageId: String
|
|
) {
|
|
updateOnePipelineProgress(
|
|
where: { id: $id }
|
|
data: { pipelineStage: { connect: { id: $pipelineStageId } } }
|
|
) {
|
|
id
|
|
}
|
|
}
|
|
`;
|
|
|
|
export const ADD_ENTITY_TO_PIPELINE = gql`
|
|
mutation CreateOnePipelineProgress(
|
|
$uuid: String!
|
|
$entityType: PipelineProgressableType!
|
|
$entityId: String!
|
|
$pipelineId: String!
|
|
$pipelineStageId: String!
|
|
) {
|
|
createOnePipelineProgress(
|
|
data: {
|
|
id: $uuid
|
|
progressableType: $entityType
|
|
progressableId: $entityId
|
|
pipeline: { connect: { id: $pipelineId } }
|
|
pipelineStage: { connect: { id: $pipelineStageId } }
|
|
}
|
|
) {
|
|
id
|
|
}
|
|
}
|
|
`;
|