aboutsummaryrefslogtreecommitdiff
path: root/api/routes
diff options
context:
space:
mode:
authorAndrew Lee <andrew@alee14.me>2025-03-01 23:32:43 -0500
committerAndrew Lee <andrew@alee14.me>2025-03-01 23:32:43 -0500
commit1e2292f197ba69cc50d9471c8fac5951bcda4352 (patch)
tree9e4b83d3242b0134269bd25fa163e0d59d08aaa2 /api/routes
parent44f7f14736aaf77858ee71c80abeb3c13343d3c2 (diff)
downloadAleeBot-1e2292f197ba69cc50d9471c8fac5951bcda4352.tar.gz
AleeBot-1e2292f197ba69cc50d9471c8fac5951bcda4352.tar.bz2
AleeBot-1e2292f197ba69cc50d9471c8fac5951bcda4352.zip
New api endpoint; Now should display the submitter's username
Diffstat (limited to 'api/routes')
-rw-r--r--api/routes/quotes.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/api/routes/quotes.js b/api/routes/quotes.js
index 39aba7b..9c933f8 100644
--- a/api/routes/quotes.js
+++ b/api/routes/quotes.js
@@ -16,6 +16,23 @@ router.get('/pending-quotes', async (req, res) => {
}
});
+router.post('/add-quote', async (req, res) => {
+ const { author, authorImage, quote, year, submitterID } = req.body;
+ try {
+ await approvedQuote.create({
+ author: author,
+ authorImage: authorImage,
+ quote: quote,
+ year: year,
+ submitter: submitterID
+ });
+ res.status(200).send('Added a new quote');
+ } catch (error) {
+ console.error('Something went wrong:', error);
+ res.status(500).send('Internal Server Error');
+ }
+});
+
router.post('/approve-quote', async (req, res) => {
const { id } = req.body;
try {