updates to product listings

This commit is contained in:
Mikayla Dobson
2022-09-28 10:48:38 -05:00
parent 9c80989860
commit 404bc27c57
4 changed files with 53 additions and 131 deletions

View File

@@ -65,6 +65,7 @@ async function main() {
categoryId INT REFERENCES category(id), categoryId INT REFERENCES category(id),
regionId INT REFERENCES region(id), regionId INT REFERENCES region(id),
price NUMERIC, price NUMERIC,
unit VARCHAR,
inventory INT inventory INT
); );
`; `;

View File

@@ -1,51 +1,51 @@
name,regionid,categoryid name,regionid,categoryid,price,inventory,unit,description
Allspice - Whole,8,1 Allspice - Whole,8,1,7,50,oz,"Whole allspice, gives a bitter, earthy, floral aroma to dishes"
Cocoa Powder,1,1 Cocoa Powder,1,1,3,50,oz,A necessary component of the pantry. Chocolate is good.
Cardamom - Green,3,1 Cardamom - Green,3,1,7,50,oz,"A whole spice used in many savory dishes. Aromatic, pungent, and floral."
Cardamom - Black,4,1 Cardamom - Black,4,1,9,50,oz,"A whole spice used in many savory dishes. Earthy, pungent, spicy."
Cinnamon,2,1 Cinnamon,2,1,5,50,oz,A necessary component of the pantry. Useful in sweet and savory dishes.
Cloves,1,1 Cloves,1,1,5,50,oz,"A potent whole spice which provides heat, bitterness, and complex flavor."
Fenugreek Seed,4,1 Fenugreek Seed,4,1,5,50,oz,"Commonly used in Indian cuisine, and is extremely bitter with a flavor similar to anise."
Lavender Flowers,3,2 Lavender Flowers,3,2,6,50,oz,"Culinary lavender, very useful for providing floral, perfumed notes to desserts and baked goods."
Nutmeg,8,1 Nutmeg,8,1,6,50,oz,"A whole spice, brings a spicy, nutty, butter flavor."
Star Anise,2,1 Star Anise,2,1,7,50,oz,"A strong, characteristic flavor not unlike licorice."
Vanilla Bean - Madagascar,1,1 Vanilla Bean - Madagascar,1,1,15,50,each,"From the fruit of an orchid variety Vanilla planifolia, Madagascar vanilla beans are renowned for their rich, creamy, sweet aroma. Suitable for baking, extracts, and more."
Vanilla Bean - Mexico,5,1 Vanilla Bean - Mexico,5,1,12,50,each,"From the fruit of an orchid variety Vanilla planifolia, Mexican vanilla beans share the characteristic smooth, creamy flavor of vanilla beans with a somewhat spicier flavor profile."
Vanilla Paste,8,1 Vanilla Paste,8,1,10,50,fl oz,"This paste features the same organic vanilla bean materials, reduced to a paste suitable in the place of vanilla extract."
Ancho Chile,5,3 Ancho Chile,5,3,7.5,50,oz,"The name ancho (wide) referring to its size and shape in Spanish, ancho is a popular chili with mild heat, about as hot as the average poblano pepper."
Cayenne - African,1,3 Cayenne - African,1,3,5,50,oz,null
Cayenne - Indian,4,3 Cayenne - Indian,4,3,5,50,oz,null
Chipotle Chile,5,3 Chipotle Chile,5,3,4.5,50,oz,"Chipotle chiles are jalapeno peppers which are ripened, smoked and dried. They have a rich, smoky flavor and are commonly used in Mexican and Tex-Mex cuisine."
Ghost Chile,4,3 Ghost Chile,4,3,7.5,50,oz,"Well known as one of the hottest chili varietals, bhut jolokia was at one time the world's hottest chili peppers, 170 times hotter than Tabasco hot sauce."
Guajillo Chile,5,3 Guajillo Chile,5,3,6,50,oz,"One of the more common varieties of chilis used in Mexican cuisine, it is described to have a fruity and smoky aroma and moderate heat."
Paprika - Hungarian,3,3 Paprika - Hungarian,3,3,5,50,oz,null
Paprika - Spain,3,3 Paprika - Spain,3,3,5,50,oz,null
Piment d'Esplette,3,3 Piment d'Esplette,3,3,5,50,oz,null
Thai Chile,2,3 Thai Chile,2,3,5,50,oz,"A pungent chile used in Southeast Asian cuisines. The chiles grow on small bushes, and bring considerable heat as well as a complex fruity flavor."
Basil,1,2 Basil,1,2,3,50,oz,"A common culinary herb, used often in Mediterranean cuisines."
Bay Leaf - California,7,2 Bay Leaf - California,7,2,4,50,oz,null
Bay Leaf - Turkish,3,2 Bay Leaf - Turkish,3,2,6,50,oz,null
Chives,7,2 Chives,7,2,4,50,oz,"Chives are a close relative to the onion family, with a mild flavor somewhat akin to leeks."
Dill Weed,7,2 Dill Weed,7,2,4,50,oz,null
Fenugreek Leaf,4,2 Fenugreek Leaf,4,2,5.5,50,oz,"The leaf of the fenugreek plant. Like its seeds, fenugreek leaves are very bitter and have a distinctive flavor."
Herbes de Provence,3,2 Herbes de Provence,3,2,5.5,50,oz,"A French blend of herbs and spices including fennel, lavender, and rosemary."
Lemongrass,2,2 Lemongrass,2,2,7,50,oz,null
Marjoram,1,2 Marjoram,1,2,6,50,oz,null
Oregano - Mexican,5,2 Oregano - Mexican,5,2,5,50,oz,null
Oregano - Turkish,3,2 Oregano - Turkish,3,2,5,50,oz,null
Parsley,7,2 Parsley,7,2,4,50,oz,null
Peppermint,7,2 Peppermint,7,2,4,50,oz,"Peppermint is a common culinary herb used in many cuisines as well as desserts, beverages, and salads. It is pungent and cooling with a sweet aroma."
Rosemary,3,2 Rosemary,3,2,4,50,oz,"A favorite component of many savory dishes in the west, rosemary has a distinct woody and earthy aroma. Its flavor can be somewhat perfumed."
Sage,3,2 Saffron,4,2,12,50,gram,"Derived from the dried stigmas of Autumn Crocus, saffron is a prized component of a culinary enthusiast's spice cabinet. Its flavor is pungent yet sweet, with elements of perfume, honey, and cherry."
Tarragon,3,2 Sage,3,2,4,50,oz,"Sage is an herb from an evergreen shrub in the mint family. Its flavor is rich, earthy and peppery, and has long held a revered place in traditional medicine."
Fleur de Sel,3,4 Tarragon,3,2,4,50,oz,null
Grains of Paradise,1,4 Fleur de Sel,3,4,6,50,oz,null
Himalayan Pink Salt,2,4 Grains of Paradise,1,4,8,50,oz,null
Long Pepper,2,4 Himalayan Pink Salt,2,4,4,50,oz,null
Maldon Flake Sea Salt,3,4 Long Pepper,2,4,9,50,oz,null
Peppercorn - Black,4,4 Maldon Flake Sea Salt,3,4,6,50,oz,null
Peppercorn - Green,4,4 Peppercorn - Black,4,4,8,50,oz,"Peppercorns of all sorts are loved for the earthy, floral, and spicy flavors they bring to recipes across cultures. They come from the vine Piper nigrum, and its color variation arises from different stages of development! Learn more at https://www.thespruceeats.com/peppercorn-and-pepper-varieties-1809318"
Peppercorn - Pink,8,4 Peppercorn - Green,4,4,8,50,oz,"Peppercorns of all sorts are loved for the earthy, floral, and spicy flavors they bring to recipes across cultures. They come from the vine Piper nigrum, and its color variation arises from different stages of development! Learn more at https://www.thespruceeats.com/peppercorn-and-pepper-varieties-1809318"
Peppercorn - Red,2,4 Peppercorn - Pink,8,4,8,50,oz,"Peppercorns of all sorts are loved for the earthy, floral, and spicy flavors they bring to recipes across cultures. They come from the vine Piper nigrum, and its color variation arises from different stages of development! Learn more at https://www.thespruceeats.com/peppercorn-and-pepper-varieties-1809318"
Peppercorn - White,2,4 Peppercorn - White,2,4,8,50,oz,"Peppercorns of all sorts are loved for the earthy, floral, and spicy flavors they bring to recipes across cultures. They come from the vine Piper nigrum, and its color variation arises from different stages of development! Learn more at https://www.thespruceeats.com/peppercorn-and-pepper-varieties-1809318"
Pepper - Szechuan,2,4 Pepper - Szechuan,2,4,8,50,oz,"Szechuan pepper is a very unique spice used commonly in Szechuan cuisine. It has a woody, piney flavor profile, and creates a tingling, numbing sensation in the mouth."
1 name regionid categoryid price inventory unit description
2 Allspice - Whole 8 1 7 50 oz Whole allspice, gives a bitter, earthy, floral aroma to dishes
3 Cocoa Powder 1 1 3 50 oz A necessary component of the pantry. Chocolate is good.
4 Cardamom - Green 3 1 7 50 oz A whole spice used in many savory dishes. Aromatic, pungent, and floral.
5 Cardamom - Black 4 1 9 50 oz A whole spice used in many savory dishes. Earthy, pungent, spicy.
6 Cinnamon 2 1 5 50 oz A necessary component of the pantry. Useful in sweet and savory dishes.
7 Cloves 1 1 5 50 oz A potent whole spice which provides heat, bitterness, and complex flavor.
8 Fenugreek Seed 4 1 5 50 oz Commonly used in Indian cuisine, and is extremely bitter with a flavor similar to anise.
9 Lavender Flowers 3 2 6 50 oz Culinary lavender, very useful for providing floral, perfumed notes to desserts and baked goods.
10 Nutmeg 8 1 6 50 oz A whole spice, brings a spicy, nutty, butter flavor.
11 Star Anise 2 1 7 50 oz A strong, characteristic flavor not unlike licorice.
12 Vanilla Bean - Madagascar 1 1 15 50 each From the fruit of an orchid variety Vanilla planifolia, Madagascar vanilla beans are renowned for their rich, creamy, sweet aroma. Suitable for baking, extracts, and more.
13 Vanilla Bean - Mexico 5 1 12 50 each From the fruit of an orchid variety Vanilla planifolia, Mexican vanilla beans share the characteristic smooth, creamy flavor of vanilla beans with a somewhat spicier flavor profile.
14 Vanilla Paste 8 1 10 50 fl oz This paste features the same organic vanilla bean materials, reduced to a paste suitable in the place of vanilla extract.
15 Ancho Chile 5 3 7.5 50 oz The name ancho (wide) referring to its size and shape in Spanish, ancho is a popular chili with mild heat, about as hot as the average poblano pepper.
16 Cayenne - African 1 3 5 50 oz null
17 Cayenne - Indian 4 3 5 50 oz null
18 Chipotle Chile 5 3 4.5 50 oz Chipotle chiles are jalapeno peppers which are ripened, smoked and dried. They have a rich, smoky flavor and are commonly used in Mexican and Tex-Mex cuisine.
19 Ghost Chile 4 3 7.5 50 oz Well known as one of the hottest chili varietals, bhut jolokia was at one time the world's hottest chili peppers, 170 times hotter than Tabasco hot sauce.
20 Guajillo Chile 5 3 6 50 oz One of the more common varieties of chilis used in Mexican cuisine, it is described to have a fruity and smoky aroma and moderate heat.
21 Paprika - Hungarian 3 3 5 50 oz null
22 Paprika - Spain 3 3 5 50 oz null
23 Piment d'Esplette 3 3 5 50 oz null
24 Thai Chile 2 3 5 50 oz A pungent chile used in Southeast Asian cuisines. The chiles grow on small bushes, and bring considerable heat as well as a complex fruity flavor.
25 Basil 1 2 3 50 oz A common culinary herb, used often in Mediterranean cuisines.
26 Bay Leaf - California 7 2 4 50 oz null
27 Bay Leaf - Turkish 3 2 6 50 oz null
28 Chives 7 2 4 50 oz Chives are a close relative to the onion family, with a mild flavor somewhat akin to leeks.
29 Dill Weed 7 2 4 50 oz null
30 Fenugreek Leaf 4 2 5.5 50 oz The leaf of the fenugreek plant. Like its seeds, fenugreek leaves are very bitter and have a distinctive flavor.
31 Herbes de Provence 3 2 5.5 50 oz A French blend of herbs and spices including fennel, lavender, and rosemary.
32 Lemongrass 2 2 7 50 oz null
33 Marjoram 1 2 6 50 oz null
34 Oregano - Mexican 5 2 5 50 oz null
35 Oregano - Turkish 3 2 5 50 oz null
36 Parsley 7 2 4 50 oz null
37 Peppermint 7 2 4 50 oz Peppermint is a common culinary herb used in many cuisines as well as desserts, beverages, and salads. It is pungent and cooling with a sweet aroma.
38 Rosemary 3 2 4 50 oz A favorite component of many savory dishes in the west, rosemary has a distinct woody and earthy aroma. Its flavor can be somewhat perfumed.
39 Sage Saffron 3 4 2 12 50 gram Derived from the dried stigmas of Autumn Crocus, saffron is a prized component of a culinary enthusiast's spice cabinet. Its flavor is pungent yet sweet, with elements of perfume, honey, and cherry.
40 Tarragon Sage 3 2 4 50 oz Sage is an herb from an evergreen shrub in the mint family. Its flavor is rich, earthy and peppery, and has long held a revered place in traditional medicine.
41 Fleur de Sel Tarragon 3 4 2 4 50 oz null
42 Grains of Paradise Fleur de Sel 1 3 4 6 50 oz null
43 Himalayan Pink Salt Grains of Paradise 2 1 4 8 50 oz null
44 Long Pepper Himalayan Pink Salt 2 4 4 50 oz null
45 Maldon Flake Sea Salt Long Pepper 3 2 4 9 50 oz null
46 Peppercorn - Black Maldon Flake Sea Salt 4 3 4 6 50 oz null
47 Peppercorn - Green Peppercorn - Black 4 4 8 50 oz Peppercorns of all sorts are loved for the earthy, floral, and spicy flavors they bring to recipes across cultures. They come from the vine Piper nigrum, and its color variation arises from different stages of development! Learn more at https://www.thespruceeats.com/peppercorn-and-pepper-varieties-1809318
48 Peppercorn - Pink Peppercorn - Green 8 4 4 8 50 oz Peppercorns of all sorts are loved for the earthy, floral, and spicy flavors they bring to recipes across cultures. They come from the vine Piper nigrum, and its color variation arises from different stages of development! Learn more at https://www.thespruceeats.com/peppercorn-and-pepper-varieties-1809318
49 Peppercorn - Red Peppercorn - Pink 2 8 4 8 50 oz Peppercorns of all sorts are loved for the earthy, floral, and spicy flavors they bring to recipes across cultures. They come from the vine Piper nigrum, and its color variation arises from different stages of development! Learn more at https://www.thespruceeats.com/peppercorn-and-pepper-varieties-1809318
50 Peppercorn - White 2 4 8 50 oz Peppercorns of all sorts are loved for the earthy, floral, and spicy flavors they bring to recipes across cultures. They come from the vine Piper nigrum, and its color variation arises from different stages of development! Learn more at https://www.thespruceeats.com/peppercorn-and-pepper-varieties-1809318
51 Pepper - Szechuan 2 4 8 50 oz Szechuan pepper is a very unique spice used commonly in Szechuan cuisine. It has a woody, piney flavor profile, and creates a tingling, numbing sensation in the mouth.

View File

@@ -3,9 +3,8 @@ const yaml = require('js-yaml');
const fs = require('fs'); const fs = require('fs');
const path = require('path'); const path = require('path');
// Loading via yml.safeLoad to avoid errors with special characters during processing
const swaggerDocument = yaml.load(fs.readFileSync(path.resolve(__dirname, '../swagger.yml'), 'utf8')); const swaggerDocument = yaml.load(fs.readFileSync(path.resolve(__dirname, '../swagger.yml'), 'utf8'));
module.exports = async (app) => { module.exports = (app) => {
app.use('/api-docs', swaggerUI.serve, swaggerUI.setup(swaggerDocument)); app.use('/api-docs', swaggerUI.serve, swaggerUI.setup(swaggerDocument));
} }

View File

@@ -1,78 +0,0 @@
/**
* IMPORTANT:
* THIS VERSION OF THE AUTH SERVICE IS DEPRECATED
* THESE SERVICES WILL BE MIGRATED TO AuthService.js
* WITHIN THE SAME DIRECTORY
**/
const { connect } = require('../db/Pool');
const bcrypt = require('bcrypt');
async function LoginService(email, password) {
const client = await connect();
let session;
console.log('login service');
try {
let hash = await client.query("SELECT password FROM users WHERE email = ($1)", [email]);
hash = hash.rows[0].password;
const match = bcrypt.compare(password, hash);
if (!match) res.status(403).json({ msg: "Login unsuccessful. Please try again" });
if (match) {
session = {
authenticated: true,
user: {
email: email,
password: password
}
}
// req.session.authenticated = true;
// req.session.user = { email: email, password: password }
let fullUserProfile = await client.query("SELECT * FROM users WHERE email = ($1)", [email]);
return {
session: session,
userProfile: fullUserProfile.rows[0]
}
} else {
throw new Error("Auth unsuccessful.");
}
} catch(e) {
await client.query("ROLLBACK");
throw new Error(e);
} finally {
client.release();
console.log("Client disconnected.");
}
}
async function RegisterService(firstName, lastName, email, password) {
const input = "INSERT INTO users (first_name, last_name, email, password) values ($1, $2, $3, $4)";
const salt = await bcrypt.genSalt(10);
const hash = await bcrypt.hash(password, salt);
const client = await connect();
let success;
try {
await client.query("BEGIN");
await client.query(input, [firstName, lastName, email, hash]);
await client.query("COMMIT");
success = true;
} catch(e) {
await client.query("ROLLBACK");
console.log(e);
success = false;
} finally {
client.release();
console.log("Client disconnected.");
return success;
}
}
module.exports = { LoginService, RegisterService }