95 lines
2.0 KiB
JavaScript
95 lines
2.0 KiB
JavaScript
import {gql} from "@apollo/client";
|
|
|
|
export const QUERY_SURVEY = gql`
|
|
query QUERY_SURVEY($surveyId: uuid!) {
|
|
csi_by_pk(id: $surveyId) {
|
|
relateddata
|
|
valid
|
|
validuntil
|
|
id
|
|
csiquestion {
|
|
id
|
|
config
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
export const COMPLETE_SURVEY = gql`
|
|
mutation COMPLETE_SURVEY($surveyId: uuid!, $survey: csi_set_input) {
|
|
update_csi(where: { id: { _eq: $surveyId } }, _set: $survey) {
|
|
affected_rows
|
|
}
|
|
}
|
|
`;
|
|
|
|
export const GET_ALL_QUESTION_SETS = gql`
|
|
query GET_ALL_QUESTION_SETS {
|
|
csiquestions(order_by: { created_at: desc }) {
|
|
id
|
|
created_at
|
|
config
|
|
current
|
|
csis_aggregate {
|
|
aggregate {
|
|
count
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
export const GET_CURRENT_QUESTIONSET_ID = gql`
|
|
query GET_CURRENT_QUESTIONSET_ID {
|
|
csiquestions(where: { current: { _eq: true } }) {
|
|
id
|
|
}
|
|
}
|
|
`;
|
|
|
|
export const INSERT_CSI = gql`
|
|
mutation INSERT_CSI($csiInput: [csi_insert_input!]!) {
|
|
insert_csi(objects: $csiInput) {
|
|
returning {
|
|
id
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
export const QUERY_CSI_RESPONSE_PAGINATED = gql`
|
|
query QUERY_CSI_RESPONSE_PAGINATED{
|
|
|
|
csi(order_by: { completedon: desc_nulls_last }) {
|
|
id
|
|
completedon
|
|
job {
|
|
ownr_fn
|
|
ownr_ln
|
|
owneridro_number
|
|
|
|
id
|
|
}
|
|
}
|
|
csi_aggregate {
|
|
aggregate {
|
|
count(distinct: true)
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
export const QUERY_CSI_RESPONSE_BY_PK = gql`
|
|
query QUERY_CSI_RESPONSE_BY_PK($id: uuid!) {
|
|
csi_by_pk(id: $id) {
|
|
completedonrelateddata
|
|
valid
|
|
validuntil
|
|
id
|
|
response
|
|
csiquestion {
|
|
id
|
|
config
|
|
}
|
|
}
|
|
}
|
|
`;
|