added functionality for user subscriptions
This commit is contained in:
@@ -6,13 +6,13 @@ export default async function populate() {
|
||||
|
||||
const populateUsers = `
|
||||
INSERT INTO recipin.appusers
|
||||
(firstname, lastname, handle, email, password, active, datecreated, datemodified)
|
||||
(firstname, lastname, handle, email, password, active, isadmin, datecreated, datemodified)
|
||||
VALUES
|
||||
('Mikayla', 'Dobson', 'innocuoussymmetry', 'mikaylaherself@gmail.com', 'password1', true, $1, $1),
|
||||
('Emily', 'Dobson', 'emjdobson', 'emily@email.com', 'password2', true, $1, $1),
|
||||
('Montanna', 'Dobson', 'delayedlemon', 'montanna@email.com', 'password3', true, $1, $1),
|
||||
('Christine', 'Riley', 'christine', 'christine@email.com', 'password4', true, $1, $1),
|
||||
('Someone', 'Not active', 'someone', 'someone@email.com', 'notactive', false, $1, $1)
|
||||
('Mikayla', 'Dobson', 'innocuoussymmetry', 'mikaylaherself@gmail.com', 'password1', 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),
|
||||
('Someone', 'Not active', 'someone', 'someone@email.com', 'notactive', false, false, $1, $1)
|
||||
;
|
||||
`
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ CREATE TABLE IF NOT EXISTS recipin.appusers (
|
||||
email varchar NOT NULL UNIQUE,
|
||||
password varchar NOT NULL,
|
||||
active boolean NOT NULL,
|
||||
isadmin boolean NOT NULL,
|
||||
datecreated varchar NOT NULL,
|
||||
datemodified varchar NOT NULL
|
||||
);
|
||||
3
server/db/sql/derived/checksubscription.sql
Normal file
3
server/db/sql/derived/checksubscription.sql
Normal file
@@ -0,0 +1,3 @@
|
||||
-- SELECT * FROM cmp_usersubscriptions
|
||||
-- WHERE usermemberid = $1
|
||||
-- AND collectionid = $2;
|
||||
13
server/db/sql/get/getsubscriptions.sql
Normal file
13
server/db/sql/get/getsubscriptions.sql
Normal file
@@ -0,0 +1,13 @@
|
||||
SELECT
|
||||
recipin.cmp_usersubscriptions.collectionid as collectionid,
|
||||
recipin.collection.ownerid as ownerid,
|
||||
recipin.cmp_usersubscriptions.usermemberid as memberid,
|
||||
recipin.collection.name as collectionname,
|
||||
recipin.appusers.firstname as owner_first,
|
||||
recipin.appusers.lastname as owner_last
|
||||
FROM recipin.collection
|
||||
INNER JOIN recipin.appusers
|
||||
ON recipin.collection.ownerid = recipin.appusers.id
|
||||
INNER JOIN recipin.cmp_usersubscriptions
|
||||
ON recipin.collection.id = recipin.cmp_usersubscriptions.collectionid
|
||||
WHERE recipin.cmp_usersubscriptions.usermemberid = $1;
|
||||
Reference in New Issue
Block a user