fetches and displays measurement units

This commit is contained in:
Mikayla Dobson
2023-02-16 17:57:40 -06:00
parent 8ae6cf4ab0
commit 9e146f0825
6 changed files with 104 additions and 54 deletions

View File

@@ -3,7 +3,7 @@ import pool from "../db";
export default class Dropdown {
async getMeasurements() {
try {
const statement = `SELECT * FROM recipin.dropdownVals WHERE datatype = MEASUREMENTS`;
const statement = `SELECT * FROM recipin.dropdownVals WHERE datatype = 'MEASUREMENTS'`;
const result = await pool.query(statement);
if (result.rows.length) return result.rows;
return null;

View File

@@ -5,7 +5,7 @@ import { DropdownDataType } from '../schemas';
const router = Router();
const DDInstance = new DropdownCtl();
export const dropdownValue = (app: Express) => {
export const dropdownValueRouter = (app: Express) => {
app.use('/app/dropdown', router);
router.get('/', async (req, res, next) => {
@@ -24,4 +24,5 @@ export const dropdownValue = (app: Express) => {
}
})
return router;
}

View File

@@ -11,6 +11,7 @@ import { subscriptionRoute } from "./subscription";
import { friendRouter } from "./friend";
import { cuisineRouter } from "./cuisine";
import { courseRouter } from "./course";
import { dropdownValueRouter } from "./dropdownValues";
dotenv.config();
@@ -47,6 +48,7 @@ export const routes = async (app: Express) => {
subscriptionRoute(app);
groceryListRoute(app);
courseRouter(app);
dropdownValueRouter(app);
// deprecate?
cuisineRouter(app);