Skip to content

Commit 5142a8c

Browse files
fix: create contact not working properly & update 400 error
1 parent ebfd9d3 commit 5142a8c

File tree

8 files changed

+22
-14
lines changed

8 files changed

+22
-14
lines changed

apps/OpenSignServer/cloud/customRoute/v1/routes/CreateDocumentWithTemplate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,6 @@ export default async function createDocumentWithTemplate(request, response) {
318318
if (err.code === 101) {
319319
return response.status(404).json({ error: 'Invalid template id!' });
320320
}
321-
return response.status(400).json({ error: 'Something went wrong!' });
321+
return response.status(400).json({ error: 'Something went wrong, please try again later!' });
322322
}
323323
}

apps/OpenSignServer/cloud/customRoute/v1/routes/createContact.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default async function createContact(request, response) {
1919
const contactbook = new Parse.Query('contracts_Contactbook');
2020
contactbook.equalTo('Email', email);
2121
contactbook.equalTo('CreatedBy', userPtr);
22-
22+
contactbook.notEqualTo('IsDeleted', true);
2323
const userExists = await contactbook.first({ useMasterKey: true });
2424

2525
if (userExists) {

apps/OpenSignServer/cloud/customRoute/v1/routes/createDocument.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,6 @@ export default async function createDocument(request, response) {
128128
}
129129
} catch (err) {
130130
console.log('err ', err);
131-
return response.status(400).json({ error: 'Something went wrong!' });
131+
return response.status(400).json({ error: 'Something went wrong, please try again later!' });
132132
}
133133
}

apps/OpenSignServer/cloud/customRoute/v1/routes/createTemplatewithCoordinate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,6 @@ export default async function createTemplatewithCoordinate(request, response) {
186186
}
187187
} catch (err) {
188188
console.log('err ', err);
189-
return response.status(400).json({ error: 'Something went wrong!' });
189+
return response.status(400).json({ error: 'Something went wrong, please try again later!' });
190190
}
191191
}

apps/OpenSignServer/cloud/customRoute/v1/routes/getContactList.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export default async function getContactList(request, response) {
1717
Contactbook.notEqualTo('IsDeleted', true);
1818
Contactbook.limit(limit);
1919
Contactbook.skip(skip);
20+
Contactbook.descending('createdAt');
2021
const res = await Contactbook.find({ useMasterKey: true });
2122
if (res && res.length > 0) {
2223
const parseRes = JSON.parse(JSON.stringify(res));

apps/OpenSignServer/cloud/customRoute/v1/routes/saveWebhook.js

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,21 @@ export default async function saveWebhook(request, response) {
1818
const isUrlExist = parseUser?.Webhook && parseUser?.Webhook === Url;
1919

2020
if (!isUrlExist) {
21-
const updateQuery = new Parse.Object('contracts_Users');
22-
updateQuery.id = user.id;
23-
updateQuery.set('Webhook', Url);
24-
const res = await updateQuery.save(null, { useMasterKey: true });
25-
if (res) {
26-
return response.json({
27-
result: 'Webhook updated successfully!',
28-
});
21+
try {
22+
const updateQuery = new Parse.Object('contracts_Users');
23+
updateQuery.id = user.id;
24+
updateQuery.set('Webhook', Url);
25+
const res = await updateQuery.save(null, { useMasterKey: true });
26+
if (res) {
27+
return response.json({
28+
result: 'Webhook updated successfully!',
29+
});
30+
}
31+
} catch (err) {
32+
console.log('Err ', err);
33+
return response
34+
.status(400)
35+
.json({ error: 'Something went wrong, please try again later!' });
2936
}
3037
} else {
3138
return response.status(401).json({ error: 'Webhook url already exists!' });

apps/OpenSignServer/cloud/customRoute/v1/routes/updateDocument.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default async function updateDocument(request, response) {
3333
updateQuery.set('Note', request?.body?.note);
3434
}
3535
if (request?.body?.description) {
36-
updateQuery.set('Name', request?.body?.description);
36+
updateQuery.set('Description', request?.body?.description);
3737
}
3838
if (request?.body?.folderId) {
3939
updateQuery.set('Folder', {

apps/OpenSignServer/cloud/customRoute/v1/routes/updateTemplate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default async function updateTemplate(request, response) {
3333
updateQuery.set('Note', request?.body?.note);
3434
}
3535
if (request?.body?.description) {
36-
updateQuery.set('Name', request?.body?.description);
36+
updateQuery.set('Description', request?.body?.description);
3737
}
3838
if (request?.body?.folderId) {
3939
updateQuery.set('Folder', {

0 commit comments

Comments
 (0)