get all accessible recipes

This commit is contained in:
Mikayla Dobson
2022-12-17 14:22:24 -06:00
parent 9a43f58ee3
commit 6c3f835b25
10 changed files with 54 additions and 18 deletions

View File

@@ -8,7 +8,7 @@ export default async function populate() {
INSERT INTO recipin.appusers
(firstname, lastname, handle, email, password, active, isadmin, datecreated, datemodified)
VALUES
('Mikayla', 'Dobson', 'innocuoussymmetry', 'mikaylaherself@gmail.com', 'password1', true, true, $1, $1),
('Mikayla', 'Dobson', 'innocuoussymmetry', 'mikaylaherself@gmail.com', '$2a$10$T9..JhNxfha86mQZNrwFo.CW7sR.d7w.9.T1M32aXL6r3vE2B.GhS', true, true, $1, $1),
('Emily', 'Dobson', 'emjdobson', 'emily@email.com', 'password2', true, false, $1, $1),
('Montanna', 'Dobson', 'delayedlemon', 'montanna@email.com', 'password3', true, false, $1, $1),
('Christine', 'Riley', 'christine', 'christine@email.com', 'password4', true, false, $1, $1),

View File

@@ -0,0 +1,9 @@
SELECT * FROM recipin.recipe
WHERE authoruserid = $1
OR authoruserid IN (
SELECT targetid FROM recipin.cmp_userfriendships
WHERE senderid = $1
UNION
SELECT senderid FROM recipin.cmp_userfriendships
WHERE targetid =$ 1
);