mirror of
https://github.com/OpenSignLabs/OpenSign.git
synced 2026-08-17 21:25:54 +02:00
fix: create contact not working properly & update 400 error
This commit is contained in:
@@ -318,6 +318,6 @@ export default async function createDocumentWithTemplate(request, response) {
|
||||
if (err.code === 101) {
|
||||
return response.status(404).json({ error: 'Invalid template id!' });
|
||||
}
|
||||
return response.status(400).json({ error: 'Something went wrong!' });
|
||||
return response.status(400).json({ error: 'Something went wrong, please try again later!' });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ export default async function createContact(request, response) {
|
||||
const contactbook = new Parse.Query('contracts_Contactbook');
|
||||
contactbook.equalTo('Email', email);
|
||||
contactbook.equalTo('CreatedBy', userPtr);
|
||||
|
||||
contactbook.notEqualTo('IsDeleted', true);
|
||||
const userExists = await contactbook.first({ useMasterKey: true });
|
||||
|
||||
if (userExists) {
|
||||
|
||||
@@ -128,6 +128,6 @@ export default async function createDocument(request, response) {
|
||||
}
|
||||
} catch (err) {
|
||||
console.log('err ', err);
|
||||
return response.status(400).json({ error: 'Something went wrong!' });
|
||||
return response.status(400).json({ error: 'Something went wrong, please try again later!' });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,6 +186,6 @@ export default async function createTemplatewithCoordinate(request, response) {
|
||||
}
|
||||
} catch (err) {
|
||||
console.log('err ', err);
|
||||
return response.status(400).json({ error: 'Something went wrong!' });
|
||||
return response.status(400).json({ error: 'Something went wrong, please try again later!' });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ export default async function getContactList(request, response) {
|
||||
Contactbook.notEqualTo('IsDeleted', true);
|
||||
Contactbook.limit(limit);
|
||||
Contactbook.skip(skip);
|
||||
Contactbook.descending('createdAt');
|
||||
const res = await Contactbook.find({ useMasterKey: true });
|
||||
if (res && res.length > 0) {
|
||||
const parseRes = JSON.parse(JSON.stringify(res));
|
||||
|
||||
@@ -18,14 +18,21 @@ export default async function saveWebhook(request, response) {
|
||||
const isUrlExist = parseUser?.Webhook && parseUser?.Webhook === Url;
|
||||
|
||||
if (!isUrlExist) {
|
||||
const updateQuery = new Parse.Object('contracts_Users');
|
||||
updateQuery.id = user.id;
|
||||
updateQuery.set('Webhook', Url);
|
||||
const res = await updateQuery.save(null, { useMasterKey: true });
|
||||
if (res) {
|
||||
return response.json({
|
||||
result: 'Webhook updated successfully!',
|
||||
});
|
||||
try {
|
||||
const updateQuery = new Parse.Object('contracts_Users');
|
||||
updateQuery.id = user.id;
|
||||
updateQuery.set('Webhook', Url);
|
||||
const res = await updateQuery.save(null, { useMasterKey: true });
|
||||
if (res) {
|
||||
return response.json({
|
||||
result: 'Webhook updated successfully!',
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
console.log('Err ', err);
|
||||
return response
|
||||
.status(400)
|
||||
.json({ error: 'Something went wrong, please try again later!' });
|
||||
}
|
||||
} else {
|
||||
return response.status(401).json({ error: 'Webhook url already exists!' });
|
||||
|
||||
@@ -33,7 +33,7 @@ export default async function updateDocument(request, response) {
|
||||
updateQuery.set('Note', request?.body?.note);
|
||||
}
|
||||
if (request?.body?.description) {
|
||||
updateQuery.set('Name', request?.body?.description);
|
||||
updateQuery.set('Description', request?.body?.description);
|
||||
}
|
||||
if (request?.body?.folderId) {
|
||||
updateQuery.set('Folder', {
|
||||
|
||||
@@ -33,7 +33,7 @@ export default async function updateTemplate(request, response) {
|
||||
updateQuery.set('Note', request?.body?.note);
|
||||
}
|
||||
if (request?.body?.description) {
|
||||
updateQuery.set('Name', request?.body?.description);
|
||||
updateQuery.set('Description', request?.body?.description);
|
||||
}
|
||||
if (request?.body?.folderId) {
|
||||
updateQuery.set('Folder', {
|
||||
|
||||
Reference in New Issue
Block a user