user registration connects to front end

This commit is contained in:
Mikayla Dobson
2022-11-21 15:05:57 -06:00
parent 48f6a60e77
commit 28c84efcd5
12 changed files with 130 additions and 90 deletions

View File

@@ -6,7 +6,7 @@ export default async function populate() {
const populateUsers = `
INSERT INTO recipin.appusers
(firstname, lastname, handle, email, password, active, dateregistered, datelastactive)
(firstname, lastname, handle, email, password, active, datecreated, datemodified)
VALUES
('Mikayla', 'Dobson', 'innocuoussymmetry', 'mikaylaherself@gmail.com', 'password1', true, $1, $1),
('Emily', 'Dobson', 'emjdobson', 'emily@email.com', 'password2', true, $1, $1),
@@ -68,9 +68,20 @@ export default async function populate() {
;
`
const populateComments = `
INSERT INTO recipin.cmp_recipecomments
(commentbody, datecreated, recipeid, authorid)
VALUES
('Very cool recipe!', $1, 2, 2),
('I love making this one', $1, 1, 2),
('Thanks for sharing this', $1, 1, 4)
;
`
const allStatements: Array<string> = [
populateUsers, populateRecipes, populateCollection,
populateIngredients, populateGroceryList, populateFriendships
populateIngredients, populateGroceryList, populateFriendships,
populateComments
];
await pool.query(setup);

View File

@@ -21,8 +21,8 @@ dotenv.config();
email varchar NOT NULL UNIQUE,
password varchar NOT NULL,
active boolean NOT NULL,
dateregistered varchar NOT NULL,
datelastactive varchar NOT NULL
datecreated varchar NOT NULL,
datemodified varchar NOT NULL
);
`
@@ -76,7 +76,8 @@ dotenv.config();
CREATE TABLE IF NOT EXISTS recipin.cmp_recipecomments (
id INT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
commentbody varchar NOT NULL,
parentcommentid int,
datecreated varchar NOT NULL,
recipeid int REFERENCES recipin.recipe (id) NOT NULL,
authorid int REFERENCES recipin.appusers (id) NOT NULL
);
`
@@ -112,7 +113,7 @@ dotenv.config();
`
const allStatements = [
setRole, appusers, ingredient, collection, recipe,
setRole, appusers, ingredient, collection, recipe, recipecomments,
groceryList, recipeingredient, userscollections, userfriendships
]