-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Backend: Waitlist (#97) * updating current capacity that's in the sample data * Adding waitlist mutation for Event + update current capacity for events. * Updating current capacity for seminars as well #94 * Fixing casing of sql statements in sample data, styling * updating casing for consistency * Fixing to add to event for following * package-lock.json being a dick * committing my life before I die * Putting update current capacity in a loop and adding a 5th seminar * Checking if user is already attending event when adding user to waitlist * Revising add user to eventwaitlist * Adding/removing user to/from seminar waitlist * More sample data for seminar participation (Full seminar:5) * Removing clg * Creating resolver for retrieving waitlist closes #99 * Fix to sample data for event participation * User will now unattend seminars+waitlist when unattending an event closes #101 * removing small comment * Frontend: Waitlist (#103) * waitlist started * updating current capacity that's in the sample data * Adding waitlist mutation for Event + update current capacity for events. * Updating current capacity for seminars as well #94 * Fixing casing of sql statements in sample data, styling * updating casing for consistency * Fixing to add to event for following * adding to wait list complete * package-lock.json being a dick * committing my life before I die * Putting update current capacity in a loop and adding a 5th seminar * Checking if user is already attending event when adding user to waitlist * Revising add user to eventwaitlist * Adding/removing user to/from seminar waitlist * More sample data for seminar participation (Full seminar:5) * Removing clg * Creating resolver for retrieving waitlist closes #99 * Fix to sample data for event participation * User will now unattend seminars+waitlist when unattending an event closes #101 * removing small comment * waitlist completed * Update sample data to correspond with pull request, + fix to B being an organizer and attendee
- Loading branch information
Showing
18 changed files
with
5,408 additions
and
6,603 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,23 @@ | ||
-- User insertion | ||
insert into doom_user (first_name, last_name, email, privacy_settings, password_hash) values ('Vivian','Ng','[email protected]', 'Private','$2b$12$rF.modokh7SuBpRHdg/xA.KN/zYvx0HmaxasTXmzWIiWcLPlhfWH2'); | ||
insert into doom_user (first_name, last_name, email, privacy_settings, password_hash) values ('Bhavanthy','Mod','[email protected]', 'Public','$2b$12$rF.modokh7SuBpRHdg/xA.KN/zYvx0HmaxasTXmzWIiWcLPlhfWH2'); | ||
insert into doom_user (first_name, last_name, email, privacy_settings, password_hash) values ('Alliyya','Mo','[email protected]', 'Public','$2b$12$rF.modokh7SuBpRHdg/xA.KN/zYvx0HmaxasTXmzWIiWcLPlhfWH2'); | ||
insert into doom_user (first_name, last_name, email, privacy_settings, password_hash) values ('Tamara','Charchoghlyan','[email protected]', 'Private','$2b$12$rF.modokh7SuBpRHdg/xA.KN/zYvx0HmaxasTXmzWIiWcLPlhfWH2'); | ||
insert into doom_user (first_name, last_name, email, privacy_settings, password_hash) values ('Tom','Riddle','[email protected]', 'Private','$2b$12$rF.modokh7SuBpRHdg/xA.KN/zYvx0HmaxasTXmzWIiWcLPlhfWH2'); | ||
insert into doom_user (first_name, last_name, email, privacy_settings, password_hash) values ('Tony','Stark','[email protected]', 'Public','$2b$12$rF.modokh7SuBpRHdg/xA.KN/zYvx0HmaxasTXmzWIiWcLPlhfWH2'); | ||
insert into doom_user (first_name, last_name, email, privacy_settings, password_hash) values ('Steve','Rogers','[email protected]', 'Private','$2b$12$rF.modokh7SuBpRHdg/xA.KN/zYvx0HmaxasTXmzWIiWcLPlhfWH2'); | ||
insert into doom_user (first_name, last_name, email, privacy_settings, password_hash) values ('Bucky','Barnes','[email protected]', 'Private','$2b$12$rF.modokh7SuBpRHdg/xA.KN/zYvx0HmaxasTXmzWIiWcLPlhfWH2'); | ||
insert into doom_user (first_name, last_name, email, privacy_settings, password_hash) values ('Thor','Odinson','[email protected]', 'Private','$2b$12$rF.modokh7SuBpRHdg/xA.KN/zYvx0HmaxasTXmzWIiWcLPlhfWH2'); | ||
insert into doom_user (first_name, last_name, email, privacy_settings, password_hash) values ('Loki','Laufeyson','[email protected]', 'Private','$2b$12$rF.modokh7SuBpRHdg/xA.KN/zYvx0HmaxasTXmzWIiWcLPlhfWH2'); | ||
-- User INSERTion | ||
INSERT INTO doom_user (first_name, last_name, email, privacy_settings, password_hash) VALUES ('Vivian','Ng','[email protected]', 'Private','$2b$12$rF.modokh7SuBpRHdg/xA.KN/zYvx0HmaxasTXmzWIiWcLPlhfWH2'); | ||
INSERT INTO doom_user (first_name, last_name, email, privacy_settings, password_hash) VALUES ('Bhavanthy','Mod','[email protected]', 'Public','$2b$12$rF.modokh7SuBpRHdg/xA.KN/zYvx0HmaxasTXmzWIiWcLPlhfWH2'); | ||
INSERT INTO doom_user (first_name, last_name, email, privacy_settings, password_hash) VALUES ('Alliyya','Mo','[email protected]', 'Public','$2b$12$rF.modokh7SuBpRHdg/xA.KN/zYvx0HmaxasTXmzWIiWcLPlhfWH2'); | ||
INSERT INTO doom_user (first_name, last_name, email, privacy_settings, password_hash) VALUES ('Tamara','Charchoghlyan','[email protected]', 'Private','$2b$12$rF.modokh7SuBpRHdg/xA.KN/zYvx0HmaxasTXmzWIiWcLPlhfWH2'); | ||
INSERT INTO doom_user (first_name, last_name, email, privacy_settings, password_hash) VALUES ('Denis','Nikitenko','[email protected]', 'Public','$2b$12$rF.modokh7SuBpRHdg/xA.KN/zYvx0HmaxasTXmzWIiWcLPlhfWH2'); | ||
INSERT INTO doom_user (first_name, last_name, email, privacy_settings, password_hash) VALUES ('Tom','Riddle','[email protected]', 'Private','$2b$12$rF.modokh7SuBpRHdg/xA.KN/zYvx0HmaxasTXmzWIiWcLPlhfWH2'); | ||
INSERT INTO doom_user (first_name, last_name, email, privacy_settings, password_hash) VALUES ('Tony','Stark','[email protected]', 'Public','$2b$12$rF.modokh7SuBpRHdg/xA.KN/zYvx0HmaxasTXmzWIiWcLPlhfWH2'); | ||
INSERT INTO doom_user (first_name, last_name, email, privacy_settings, password_hash) VALUES ('Steve','Rogers','[email protected]', 'Private','$2b$12$rF.modokh7SuBpRHdg/xA.KN/zYvx0HmaxasTXmzWIiWcLPlhfWH2'); | ||
INSERT INTO doom_user (first_name, last_name, email, privacy_settings, password_hash) VALUES ('Bucky','Barnes','[email protected]', 'Private','$2b$12$rF.modokh7SuBpRHdg/xA.KN/zYvx0HmaxasTXmzWIiWcLPlhfWH2'); | ||
INSERT INTO doom_user (first_name, last_name, email, privacy_settings, password_hash) VALUES ('Thor','Odinson','[email protected]', 'Private','$2b$12$rF.modokh7SuBpRHdg/xA.KN/zYvx0HmaxasTXmzWIiWcLPlhfWH2'); | ||
INSERT INTO doom_user (first_name, last_name, email, privacy_settings, password_hash) VALUES ('Loki','Laufeyson','[email protected]', 'Private','$2b$12$rF.modokh7SuBpRHdg/xA.KN/zYvx0HmaxasTXmzWIiWcLPlhfWH2'); | ||
|
||
|
||
-- 3 events | ||
insert into Event (creator_id, name, start_time, end_time, capacity_type, max_capacity, current_capacity, website, location_link) values (3,'CUSEC',TIMESTAMP '2019-10-23 8:30:00+02', TIMESTAMP '2019-11-27 10:30:00+02', 'FCFS_E',6,0,'http://2018.cusec.net/','https://goo.gl/maps/w38KNq2BNLB2'); | ||
insert into Event (creator_id, name, start_time, end_time, capacity_type, max_capacity, current_capacity) values (2,'Animefest',TIMESTAMP '2019-10-21 12:30:00+02', TIMESTAMP '2019-11-29 10:30:00+02', 'FCFS_P',3,2); | ||
insert into Event (creator_id, name, start_time, end_time, capacity_type) values (1,'Doomsday convention',TIMESTAMP '2018-10-30 1:00:00', TIMESTAMP '2018-11-02 10:30:00', 'FFA'); | ||
insert into Event (creator_id, name, start_time, end_time, capacity_type,max_capacity, current_capacity) values (6,'Avenger Meetup',TIMESTAMP '2019-05-03 10:30:00', TIMESTAMP '2019-11-24 10:30:00', 'FCFS_E',5,0); | ||
insert into Event (creator_id, name, start_time, end_time, capacity_type,max_capacity, current_capacity) values (5,'Wizarding War',TIMESTAMP '2018-11-03 10:30:00', TIMESTAMP '2019-12-24 10:30:00', 'FCFS_P',10,0); | ||
INSERT INTO Event (creator_id, name, start_time, end_time, capacity_type, max_capacity) VALUES (2,'Animefest',TIMESTAMP '2019-10-21 12:30:00+02', TIMESTAMP '2019-11-29 10:30:00+02', 'FCFS_P',3); | ||
INSERT INTO Event (creator_id, name, start_time, end_time, capacity_type) VALUES (1,'Doomsday convention',TIMESTAMP '2018-10-30 1:00:00', TIMESTAMP '2018-11-02 10:30:00', 'FFA'); | ||
INSERT INTO Event (creator_id, name, start_time, end_time, capacity_type,max_capacity) VALUES (6,'Avenger Meetup',TIMESTAMP '2019-05-03 10:30:00', TIMESTAMP '2019-11-24 10:30:00', 'FCFS_E',5); | ||
INSERT INTO Event (creator_id, name, start_time, end_time, capacity_type,max_capacity) VALUES (5,'Wizarding War',TIMESTAMP '2018-11-03 10:30:00', TIMESTAMP '2019-12-24 10:30:00', 'FCFS_P',10); | ||
|
||
|
||
insert into Event_Organizer (user_id, event_id) values (3,1); | ||
|
@@ -29,44 +30,93 @@ insert into Event_Organizer (user_id, event_id) values (3,4); | |
insert into Event_Organizer (user_id, event_id) values (5,5); | ||
|
||
|
||
-- 3 Seminars | ||
insert into Seminar (event_id, name, start_time, end_time, capacity_type,website,location_link) values (3,'Preparing for your doom',TIMESTAMP '2019-10-20 10:30:00+02', TIMESTAMP '2019-11-20 12:30:00+02', 'FFA','https://en.wikipedia.org/wiki/Doctor_Doom','https://goo.gl/maps/kN7Z9ziagyC2'); | ||
insert into Seminar (event_id, name, start_time, end_time, capacity_type, max_capacity, current_capacity) values (2,'How to Weeb',TIMESTAMP '2019-10-22 12:30:00+02', TIMESTAMP '2019-11-22 13:30:00+02', 'FCFS_E',2,2); | ||
insert into Seminar (event_id, name, start_time, end_time, capacity_type, max_capacity, current_capacity) values (1,'Hackathon',TIMESTAMP '2019-10-24 8:30:00+02', TIMESTAMP '2019-11-24 10:30:00+02', 'FCFS_P',6,0); | ||
insert into Seminar (event_id, name, start_time, end_time, capacity_type, max_capacity, current_capacity) values (3,'Alpha Demo',TIMESTAMP '2018-10-31 14:50:00', TIMESTAMP '2018-10-31 15:00:00', 'FCFS_P',5,0); | ||
|
||
insert into Seminar_Organizer (user_id, seminar_id) values (2,2); | ||
insert into Seminar_Organizer (user_id, seminar_id) values (3,1); | ||
insert into Seminar_Organizer (user_id, seminar_id) values (4,3); | ||
INSERT INTO Seminar (event_id, name, start_time, end_time, capacity_type) VALUES (3,'Preparing for your doom',TIMESTAMP '2019-10-20 10:30:00+02', TIMESTAMP '2019-11-20 12:30:00+02', 'FFA'); | ||
INSERT INTO Seminar (event_id, name, start_time, end_time, capacity_type, max_capacity) VALUES (2,'How to Weeb',TIMESTAMP '2019-10-22 12:30:00+02', TIMESTAMP '2019-11-22 13:30:00+02', 'FCFS_E',2); | ||
INSERT INTO Seminar (event_id, name, start_time, end_time, capacity_type, max_capacity) VALUES (1,'Hackathon',TIMESTAMP '2019-10-24 8:30:00+02', TIMESTAMP '2019-11-24 10:30:00+02', 'FCFS_P',6); | ||
INSERT INTO Seminar (event_id, name, start_time, end_time, capacity_type, max_capacity) VALUES (3,'Alpha Demo',TIMESTAMP '2018-10-31 14:50:00', TIMESTAMP '2018-10-31 15:00:00', 'FCFS_P',5); | ||
INSERT INTO Seminar (event_id, name, start_time, end_time, capacity_type, max_capacity) VALUES (3,'RC Demo',TIMESTAMP '2018-11-28 14:50:00', TIMESTAMP '2018-11-28 15:00:00', 'FCFS_P',5); | ||
|
||
INSERT INTO Seminar_Organizer (user_id, seminar_id) VALUES (3,1); | ||
INSERT INTO Seminar_Organizer (user_id, seminar_id) VALUES (2,2); | ||
INSERT INTO Seminar_Organizer (user_id, seminar_id) VALUES (4,3); | ||
INSERT INTO Seminar_Organizer (user_id, seminar_id) VALUES (5,4); | ||
INSERT INTO Seminar_Organizer (user_id, seminar_id) VALUES (5,5); | ||
|
||
-- Adding users to events | ||
insert into Event_Participation (user_id, event_id, attending) values (10,1,True); | ||
insert into Event_Participation (user_id, event_id, attending) values (2,2,True); | ||
insert into Event_Participation (user_id, event_id, attending) values (5,2,True); | ||
insert into Event_Participation (user_id, event_id, attending) values (3,2,True); | ||
insert into Event_Participation (user_id, event_id, attending) values (3,3,True); | ||
insert into Event_Participation (user_id, event_id, attending) values (10,3,True); | ||
|
||
insert into Event_Participation (user_id, event_id, attending) values (3,4,True); | ||
insert into Event_Participation (user_id, event_id, attending) values (7,4,True); | ||
insert into Event_Participation (user_id, event_id, attending) values (8,4,True); | ||
insert into Event_Participation (user_id, event_id, attending) values (9,4,True); | ||
insert into Event_Participation (user_id, event_id, following) values (10,4,True); | ||
INSERT INTO Event_Participation (user_id, event_id, attending) VALUES (1,2,True); | ||
INSERT INTO Event_Participation (user_id, event_id, attending) VALUES (3,2,True); | ||
INSERT INTO Event_Participation (user_id, event_id, attending) VALUES (5,2,True); | ||
|
||
INSERT INTO Event_Participation (user_id, event_id, attending) VALUES (10,3,True); | ||
INSERT INTO Event_Participation (user_id, Event_id, attending) VALUES (1,3,True); | ||
INSERT INTO Event_Participation (user_id, Event_id, attending) VALUES (2,3,True); | ||
INSERT INTO Event_Participation (user_id, Event_id, attending) VALUES (3,3,True); | ||
INSERT INTO Event_Participation (user_id, Event_id, attending) VALUES (4,3,True); | ||
INSERT INTO Event_Participation (user_id, Event_id, attending) VALUES (5,3,True); | ||
|
||
INSERT INTO Event_Participation (user_id, event_id, attending) VALUES (3,4,True); | ||
INSERT INTO Event_Participation (user_id, event_id, attending) VALUES (7,4,True); | ||
INSERT INTO Event_Participation (user_id, event_id, attending) VALUES (8,4,True); | ||
INSERT INTO Event_Participation (user_id, event_id, attending) VALUES (9,4,True); | ||
INSERT INTO Event_Participation (user_id, event_id, following) VALUES (10,4,True); | ||
|
||
-- Adding users to seminars | ||
INSERT INTO Seminar_Participation (user_id, seminar_id, attending) VALUES (2,2,True); | ||
INSERT INTO Seminar_Participation (user_id, seminar_id, following) VALUES (3,2,True); | ||
INSERT INTO Seminar_Participation (user_id, seminar_id, attending) VALUES (5,2,True); | ||
|
||
insert into Seminar_Participation (user_id, seminar_id, attending) values (10,1,True); | ||
insert into Seminar_Participation (user_id, seminar_id, attending) values (2,2,True); | ||
insert into Seminar_Participation (user_id, seminar_id, attending) values (5,2,True); | ||
insert into Seminar_Participation (user_id, seminar_id, following) values (3,2,True); | ||
insert into Seminar_Participation (user_id, seminar_id, following) values (3,4,True); | ||
insert into Seminar_Wait_list (user_id, seminar_id,date_added) values (3,2, TIMESTAMP '2019-10-23 8:30:00+02'); | ||
INSERT INTO Seminar_Participation (user_id, seminar_id, following) VALUES (3,4,True); | ||
|
||
INSERT INTO Seminar_Participation (user_id, seminar_id, attending) VALUES (1,5,True); | ||
INSERT INTO Seminar_Participation (user_id, seminar_id, attending) VALUES (2,5,True); | ||
INSERT INTO Seminar_Participation (user_id, seminar_id, attending) VALUES (3,5,True); | ||
INSERT INTO Seminar_Participation (user_id, seminar_id, attending) VALUES (4,5,True); | ||
INSERT INTO Seminar_Participation (user_id, seminar_id, attending) VALUES (5,5,True); | ||
|
||
INSERT INTO Seminar_Wait_list (user_id, seminar_id,date_added) VALUES (3,2, TIMESTAMP '2019-10-23 8:30:00+02'); | ||
INSERT INTO Event_Wait_list (user_id, event_id,date_added) VALUES (10,2, TIMESTAMP '2019-10-29 8:30:00+02'); | ||
|
||
|
||
-- 2 Annoucements | ||
insert into Event_Announcement (event_id, message, date_created, date_modified) values (3,'The end is nigh, remember your wallet',TIMESTAMP '2018-10-31 8:30:00', TIMESTAMP '2018-10-31 19:00:00'); | ||
insert into Event_Announcement (event_id, message, date_created, date_modified) values (3,'Remember your doom',TIMESTAMP '2018-10-31 8:30:00', TIMESTAMP '2018-11-01 8:45:00'); | ||
insert into Seminar_Announcement (seminar_id, message, date_created, date_modified) values (4,'Bug Fixing Party',TIMESTAMP '2018-10-31 8:30:00', TIMESTAMP '2018-10-13 8:30:00'); | ||
insert into Seminar_Announcement (seminar_id, message, date_created, date_modified) values (3,'Reminder to participants to bring laptops',TIMESTAMP '2018-10-23 8:30:00+02', TIMESTAMP '2018-10-23 8:30:00+02'); | ||
INSERT INTO Event_Announcement (event_id, message, date_created, date_modified) VALUES (3,'The end is nigh, remember your wallet',TIMESTAMP '2018-10-31 8:30:00', TIMESTAMP '2018-10-31 19:00:00'); | ||
INSERT INTO Event_Announcement (event_id, message, date_created, date_modified) VALUES (3,'Remember your doom',TIMESTAMP '2018-10-31 8:30:00', TIMESTAMP '2018-11-01 8:45:00'); | ||
INSERT INTO Seminar_Announcement (seminar_id, message, date_created, date_modified) VALUES (4,'Bug Fixing Party',TIMESTAMP '2018-10-31 8:30:00', TIMESTAMP '2018-10-13 8:30:00'); | ||
INSERT INTO Seminar_Announcement (seminar_id, message, date_created, date_modified) VALUES (3,'Reminder to participants to bring laptops',TIMESTAMP '2018-10-23 8:30:00+02', TIMESTAMP '2018-10-23 8:30:00+02'); | ||
|
||
|
||
-- One user following | ||
insert into User_Following (user_id, following_user_id) values (4,1); | ||
INSERT INTO User_Following (user_id, following_user_id) VALUES (4,1); | ||
|
||
-- Updating current capacity of the events in the DB | ||
DO | ||
$do$ | ||
BEGIN | ||
FOR i IN 1..5 LOOP | ||
|
||
|
||
UPDATE "event" | ||
SET current_capacity =subquery.count | ||
FROM | ||
(SELECT count(*) | ||
FROM event_participation | ||
WHERE event_id = i AND attending = true) AS subquery | ||
WHERE event.id=i; | ||
|
||
UPDATE "seminar" | ||
SET current_capacity =subquery.count | ||
FROM | ||
(SELECT count(*) | ||
FROM seminar_participation | ||
WHERE seminar_id = i AND attending = true) AS subquery | ||
WHERE seminar.id=i; | ||
|
||
|
||
|
||
END LOOP; | ||
END | ||
$do$; | ||
|
||
|
Oops, something went wrong.