powr-sdk-api 2.0.3 → 2.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/forms.js +9 -3
- package/dist/admin/index.js +2 -2
- package/package.json +1 -1
package/dist/admin/forms.js
CHANGED
|
@@ -4,6 +4,9 @@ const express = require("express");
|
|
|
4
4
|
const router = express.Router();
|
|
5
5
|
const multer = require('multer');
|
|
6
6
|
const path = require('path');
|
|
7
|
+
const {
|
|
8
|
+
getDb
|
|
9
|
+
} = require('../services/dbService');
|
|
7
10
|
const upload = multer({
|
|
8
11
|
storage: multer.memoryStorage(),
|
|
9
12
|
fileFilter: function (req, file, cb) {
|
|
@@ -22,7 +25,8 @@ const upload = multer({
|
|
|
22
25
|
router.get("/powrform", async (req, res) => {
|
|
23
26
|
const projectId = req.query.projectId;
|
|
24
27
|
try {
|
|
25
|
-
const
|
|
28
|
+
const db = getDb();
|
|
29
|
+
const collection = db.collection("powrForm");
|
|
26
30
|
const forms = await collection.find({
|
|
27
31
|
projectId
|
|
28
32
|
}).toArray();
|
|
@@ -56,7 +60,8 @@ router.get('/:formName', async (req, res) => {
|
|
|
56
60
|
message: 'projectId is required as query parameter'
|
|
57
61
|
});
|
|
58
62
|
}
|
|
59
|
-
const
|
|
63
|
+
const db = getDb();
|
|
64
|
+
const collection = db.collection("powrForm");
|
|
60
65
|
const formData = await collection.findOne({
|
|
61
66
|
formName,
|
|
62
67
|
projectId
|
|
@@ -94,7 +99,8 @@ router.post('/studentform', async (req, res) => {
|
|
|
94
99
|
email,
|
|
95
100
|
...otherFormFields
|
|
96
101
|
} = formData;
|
|
97
|
-
const
|
|
102
|
+
const db = getDb();
|
|
103
|
+
const studentsFormCollection = db.collection('studentsForm');
|
|
98
104
|
const existingForm = await studentsFormCollection.findOne({
|
|
99
105
|
whatsapp: whatsapp,
|
|
100
106
|
projectId: projectId,
|
package/dist/admin/index.js
CHANGED
|
@@ -4,7 +4,7 @@ const express = require('express');
|
|
|
4
4
|
|
|
5
5
|
// Import all route modules
|
|
6
6
|
const commentsRoutes = require('./comments');
|
|
7
|
-
const filesRoutes = require('./files');
|
|
7
|
+
// const filesRoutes = require('./files'); // Commented out for now
|
|
8
8
|
const formsRoutes = require('./forms');
|
|
9
9
|
const invoiceRoutes = require('./invoice');
|
|
10
10
|
const likesRoutes = require('./likes');
|
|
@@ -24,7 +24,7 @@ const createAdminRoutes = () => {
|
|
|
24
24
|
|
|
25
25
|
// Mount all route modules
|
|
26
26
|
router.use('/comments', commentsRoutes);
|
|
27
|
-
router.use('/files', filesRoutes);
|
|
27
|
+
// router.use('/files', filesRoutes); // Commented out for now
|
|
28
28
|
router.use('/forms', formsRoutes);
|
|
29
29
|
router.use('/invoice', invoiceRoutes);
|
|
30
30
|
router.use('/likes', likesRoutes);
|