-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #752 from OneCommunityGlobal/development
Backend Release to Main [1.44]
- Loading branch information
Showing
14 changed files
with
1,153 additions
and
794 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,13 +23,13 @@ const dashboardcontroller = function () { | |
return User.findOneAndUpdate( | ||
{ _id: req.params.userId }, | ||
{ copiedAiPrompt: Date.now() }, | ||
{ new: true }, | ||
{ new: true } | ||
) | ||
.then((user) => { | ||
if (user) { | ||
res.status(200).send('Copied AI prompt'); | ||
res.status(200).send("Copied AI prompt"); | ||
} else { | ||
res.status(404).send({ message: 'User not found ' }); | ||
res.status(404).send({ message: "User not found " }); | ||
} | ||
}) | ||
.catch((error) => { | ||
|
@@ -51,12 +51,12 @@ const dashboardcontroller = function () { | |
...req.body, | ||
aIPromptText: req.body.aIPromptText, | ||
modifiedDatetime: Date.now(), | ||
}, | ||
} | ||
) | ||
.then(() => { | ||
res.status(200).send("Successfully saved AI prompt."); | ||
}) | ||
.catch(error => res.status(500).send(error)); | ||
.catch((error) => res.status(500).send(error)); | ||
} | ||
}; | ||
|
||
|
@@ -82,15 +82,15 @@ const dashboardcontroller = function () { | |
}); | ||
} | ||
}) | ||
.catch(error => res.status(500).send(error)); | ||
.catch((error) => res.status(500).send(error)); | ||
}; | ||
|
||
const monthlydata = function (req, res) { | ||
const userId = mongoose.Types.ObjectId(req.params.userId); | ||
const laborthismonth = dashboardhelper.laborthismonth( | ||
userId, | ||
req.params.fromDate, | ||
req.params.toDate, | ||
req.params.toDate | ||
); | ||
laborthismonth.then((results) => { | ||
if (!results || results.length === 0) { | ||
|
@@ -112,7 +112,7 @@ const dashboardcontroller = function () { | |
const laborthisweek = dashboardhelper.laborthisweek( | ||
userId, | ||
req.params.fromDate, | ||
req.params.toDate, | ||
req.params.toDate | ||
); | ||
laborthisweek.then((results) => { | ||
res.status(200).send(results); | ||
|
@@ -133,7 +133,7 @@ const dashboardcontroller = function () { | |
}); | ||
} | ||
}) | ||
.catch(error => res.status(400).send(error)); | ||
.catch((error) => res.status(400).send(error)); | ||
}; | ||
|
||
const orgData = function (req, res) { | ||
|
@@ -143,7 +143,7 @@ const dashboardcontroller = function () { | |
.then((results) => { | ||
res.status(200).send(results[0]); | ||
}) | ||
.catch(error => res.status(400).send(error)); | ||
.catch((error) => res.status(400).send(error)); | ||
}; | ||
|
||
const getBugReportEmailBody = function ( | ||
|
@@ -155,7 +155,7 @@ const dashboardcontroller = function () { | |
expected, | ||
actual, | ||
visual, | ||
severity, | ||
severity | ||
) { | ||
const text = `New Bug Report From <b>${firstName} ${lastName}</b>: | ||
<p>[Feature Name] Bug Title:</p> | ||
|
@@ -200,15 +200,15 @@ const dashboardcontroller = function () { | |
expected, | ||
actual, | ||
visual, | ||
severity, | ||
severity | ||
); | ||
|
||
try { | ||
emailSender( | ||
"[email protected]", | ||
`Bug Rport from ${firstName} ${lastName}`, | ||
emailBody, | ||
email, | ||
); | ||
res.status(200).send("Success"); | ||
} catch { | ||
|
@@ -234,8 +234,8 @@ const dashboardcontroller = function () { | |
let fieldaaray = []; | ||
if (suggestionData.field.length) { | ||
fieldaaray = suggestionData.field.map( | ||
item => `<p>${item}</p> | ||
<p>${args[3][item]}</p>`, | ||
(item) => `<p>${item}</p> | ||
<p>${args[3][item]}</p>` | ||
); | ||
} | ||
const text = `New Suggestion From <b>${args[3].firstName} ${ | ||
|
@@ -263,15 +263,13 @@ const dashboardcontroller = function () { | |
|
||
// send suggestion email | ||
const sendMakeSuggestion = async (req, res) => { | ||
const { | ||
suggestioncate, suggestion, confirm, email, ...rest | ||
} = req.body; | ||
const { suggestioncate, suggestion, confirm, email, ...rest } = req.body; | ||
const emailBody = await getsuggestionEmailBody( | ||
suggestioncate, | ||
suggestion, | ||
confirm, | ||
rest, | ||
email, | ||
); | ||
try { | ||
emailSender( | ||
|
@@ -281,7 +279,7 @@ const dashboardcontroller = function () { | |
null, | ||
null, | ||
email, | ||
null, | ||
null | ||
); | ||
res.status(200).send("Success"); | ||
} catch { | ||
|
@@ -310,7 +308,7 @@ const dashboardcontroller = function () { | |
} | ||
if (req.body.action === "delete") { | ||
suggestionData.suggestion = suggestionData.suggestion.filter( | ||
(item, index) => index + 1 !== +req.body.newField, | ||
(item, index) => index + 1 !== +req.body.newField | ||
); | ||
} | ||
} else { | ||
|
@@ -319,7 +317,7 @@ const dashboardcontroller = function () { | |
} | ||
if (req.body.action === "delete") { | ||
suggestionData.field = suggestionData.field.filter( | ||
item => item !== req.body.newField, | ||
(item) => item !== req.body.newField | ||
); | ||
} | ||
} | ||
|
Oops, something went wrong.