-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtestController.js
More file actions
52 lines (52 loc) · 1.34 KB
/
testController.js
File metadata and controls
52 lines (52 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
const models = require('../models/aModel.js');
const fs = require('fs');
const path = require('path');
const dataController = {};
// vendorItems: array
// productPrice: array
// productDetails: array
// vendorName: string
// marketName: string
// blogPost: string
// vendorEmail: string
// vendorWebsite: string
// vendorPhone: string or number
dataController.getAllVendors = (req, res, next) => {
let querryString = 'SELECT vendor_name FROM vendor';
models.query(querryString)
.then((data) => {
console.log(data);
res.locals.vendorNames = data;
return next();
})
.catch((err) => {
return next({
log: 'dataController.getAllVendors: ERROR: Error from querry',
message: { err: 'Error occurred in dataController.getAllVendors. Check server logs for more details.' }
})
})
}
dataController.uploadVendorDetails = (req, res, next) => {
let queryString = '';
let {vendorItems,
productPrice,
productDetails,
vendorName,
marketName,
blogPost,
vendorEmail,
vendorWebsite,
vendorPhone,} = req.body;
models.query(querryString)
};
dataController.uploadVendorItems = (req, res, next) => {
let queryString = '';
let {vendorItems,
productPrice,
productDetails,
vendorName,
} = req.body;
models.query(queryString)
};
//add controllers for DB works
module.exports = dataController