refactor: extract server-side CRM contact update
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { updateAccount } from "../../../actions/services/accountService";
|
||||
import { updateCrmContact } from "../../../lib/server/updateCrmContact";
|
||||
import { hashAPIPath } from "../../../actions/core/hash";
|
||||
import { consoleLogger } from "../../../actions/core/logger";
|
||||
import {
|
||||
@@ -59,10 +59,7 @@ ApiProxy.get(async (req, res) => {
|
||||
});
|
||||
}
|
||||
|
||||
if (
|
||||
!isValidContainer(containerName) ||
|
||||
!isValidTempCaseRef(tempCaseRef)
|
||||
) {
|
||||
if (!isValidContainer(containerName) || !isValidTempCaseRef(tempCaseRef)) {
|
||||
return respondError(res, {
|
||||
status: 400,
|
||||
code: "INVALID_REQUEST",
|
||||
@@ -158,13 +155,9 @@ ApiProxy.get(async (req, res) => {
|
||||
if (typeofinvolvement != 846040000) {
|
||||
void (async () => {
|
||||
try {
|
||||
await updateAccount(
|
||||
contactId[1],
|
||||
{
|
||||
pinswg_typeofinvolvement: 846040001
|
||||
},
|
||||
true
|
||||
);
|
||||
await updateCrmContact(contactId[1], {
|
||||
pinswg_typeofinvolvement: 846040001
|
||||
});
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user