red-lipped-batfish-scad / HugelMaps

MIT License
6 stars 2 forks source link

Backend: feedController.js #19

Open cmlooff opened 2 years ago

cmlooff commented 2 years ago

Link: feedController.js

Feed controller Flow Chart

graph TD;
    feedController[feedController.js] -->feedGet[feedRouter.get];
    feedController -->feedPost[feedRouter.post];
    feedController -->feedDelete[feedRouter.delete]
    feedGet-->Client[Client/Frontend]
    feedPost -->Client;
    feedDelete -->Client;

Controller methods

// Get request for all items in db
'SELECT * FROM feed;'

// Post request to the database
'INSERT INTO feed (material, detail, quantity, location, contact, post_date) VALUES ($1, $2, $3, $4, $5, $6);'

// Delete Request
'DELETE FROM feed WHERE feed_id = ${givenItem};'

Notes

We had a JS date algo for assigning an automatic date stamp. We might've resolved this by changing our postgresql table setting.