Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make CRUD SQL queries for Published Schedule Table #17

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions server/queries/published_schedule.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*GET - Returns all data from the published_schedule table*/
SELECT * FROM published_schedule;

/*GET/:id - returns the rows that match the given id*/
SELECT * FROM published_schedule WHERE id = ?;

/*POST - Adds a new row to the published_schedule table
Note: Confirmed should be defaulted to true*/
INSERT INTO published_schedule (id, event_id, confirmed, confirmed_on, start_time, end_time, cohort, notes)
VALUES (?, ?, true, ?, ?, ?, ?, ?);

/*PUT - Updates an existing row given an id
Notes: All fields are optional*/
UPDATE published_schedule
SET
event_id = COALESCE(?, event_id),
confirmed = COALESCE(?, confirmed),
confirmed_on = COALESCE(?, confirmed_on),
start_time = COALESCE(?, start_time),
end_time = COALESCE(?, end_time),
cohort = COALESCE(?, cohort),
notes = COALESCE(?, notes)
WHERE id = ?;

/*DELETE - deletes an existing row given an id*/
DELETE FROM published_schedule WHERE id = ?;
Loading