@simpleview/crm-client
Advanced tools
Comparing version 1.0.4 to 1.0.5
{ | ||
"name" : "@simpleview/crm-client", | ||
"version" : "1.0.4", | ||
"version" : "1.0.5", | ||
"description" : "Client for communicating with sv-crm", | ||
@@ -5,0 +5,0 @@ "author" : "Sean Albert <smabert@gmail.com>", |
@@ -9,3 +9,3 @@ const { query } = require("@simpleview/sv-graphql-client"); | ||
} | ||
async get_old({ type, queryString, context, fragments="" }) { | ||
async get_old({ type, queryString, context, fragments = "" }) { | ||
context = context || this._graphServer.context; | ||
@@ -48,3 +48,6 @@ | ||
if (filter) { | ||
rootString += `, $filter: crm_${type}_filter`; | ||
const filterType = filter.filterType ? filter.filterType : `crm_${type}_filter`; | ||
delete filter.filterType; | ||
rootString += `, $filter: ${filterType}`; | ||
argString += "filter: $filter"; | ||
@@ -62,3 +65,3 @@ if (options) { | ||
argString += filter || options ? ")" : ""; | ||
argString += filter || options ? ")" : ""; | ||
@@ -165,3 +168,3 @@ let fieldString = ""; | ||
* Just delete the record, doesn't care what will happen | ||
* | ||
* | ||
* @param {Object} option | ||
@@ -172,3 +175,3 @@ * @param {Pbject} option.context | ||
*/ | ||
async delete({recType, recId, context}) { | ||
async delete({ recType, recId, context }) { | ||
context = context || this._graphServer.context; | ||
@@ -178,3 +181,3 @@ const variables = { | ||
acct_id: context.acct_id | ||
} | ||
}; | ||
const queryStr = `mutation($acct_id: String!, $recId: Int!) { | ||
@@ -186,3 +189,3 @@ crm(acct_id: $acct_id) { | ||
} | ||
}` | ||
}`; | ||
const response = await query({ | ||
@@ -193,3 +196,3 @@ query: queryStr, | ||
token: context.token | ||
}) | ||
}); | ||
return response.crm[`delete_${recType}`]; | ||
@@ -200,5 +203,5 @@ } | ||
* TODO: This is not implemented yet on graph side, the way to handle delete check is TBD | ||
* | ||
* | ||
* New way of doing delete, can just check to see if something is deletable, and return the status of what exactly happened like if the record is removed permanantly, if the record is actually deleted, or if the record is even deletable. | ||
* | ||
* | ||
* @param {Object} option | ||
@@ -210,3 +213,3 @@ * @param {Object} option.context | ||
*/ | ||
async delete_future({recType, recId, preventExecute, context}) { | ||
async delete_future({ recType, recId, preventExecute, context }) { | ||
context = context || this._graphServer.context; | ||
@@ -216,3 +219,3 @@ const variables = { | ||
acct_id: context.acct_id | ||
} | ||
}; | ||
const queryStr = `mutation($acct_id: String!, $recId: Int!) { | ||
@@ -232,3 +235,3 @@ crm(acct_id: $acct_id) { | ||
} | ||
}` | ||
}`; | ||
const response = await query({ | ||
@@ -239,8 +242,8 @@ query: queryStr, | ||
token: context.token | ||
}) | ||
}); | ||
return response.crm[`delete_${recType}`]; | ||
} | ||
}; | ||
} | ||
module.exports = General; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10759
261