Skip to content

Commit

Permalink
Adding website for seminar #59
Browse files Browse the repository at this point in the history
  • Loading branch information
alliyya committed Nov 12, 2018
1 parent 92ec351 commit 1da4715
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
3 changes: 2 additions & 1 deletion api/src/migrations/002_create_sample_data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ 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) 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,website) 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');
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);
Expand All @@ -51,6 +51,7 @@ 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 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);
Expand Down
14 changes: 9 additions & 5 deletions api/src/mutations/seminar.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ async function insertNewSeminar(seminarInput) {
max_capacity,
location,
picture_path,
organizer_ids
organizer_ids,
website
} = seminarInput;

if (capacity_type === "FFA") {
Expand All @@ -29,15 +30,16 @@ async function insertNewSeminar(seminarInput) {
current_capacity = 0;
max_capacity = max_capacity || null;
location = location || null;
website = website || null;
description = description || null;
picture_path = picture_path || null;

organizer_ids = organizer_ids || [];

const queryString = `INSERT INTO Seminar
(event_id, name, description, start_time, end_time, capacity_type,
max_capacity, location, picture_path,current_capacity)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING id;`;
max_capacity, location, picture_path,current_capacity,website)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?) RETURNING id;`;

const vals = [
event_id,
Expand All @@ -49,7 +51,8 @@ async function insertNewSeminar(seminarInput) {
max_capacity,
location,
picture_path,
current_capacity
current_capacity,
website
];

const res = await db.raw(`${queryString}`, vals);
Expand All @@ -72,7 +75,8 @@ async function insertNewSeminar(seminarInput) {
location,
picture_path,
current_capacity,
id
id,
website
};
}

Expand Down
10 changes: 5 additions & 5 deletions api/src/types/Seminar.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ type Seminar {
current_capacity: Int
location: Int
picture_path: Int
#Testing attaching announcements to an seminar
announcements: [Announcement!]
organizers: [User!]
website: String
announcements: [Announcement!]
organizers: [User!]
}
input SeminarInput {
Expand All @@ -32,6 +31,7 @@ input SeminarInput {
organizer_ids: [Int!]
location: String
picture_path: String
website: String
}
input SeminarParticipationInput {
Expand Down

0 comments on commit 1da4715

Please sign in to comment.