Skip to content

Commit

Permalink
Changed join code to work with course instead of course instance
Browse files Browse the repository at this point in the history
  • Loading branch information
Maija Y committed Oct 7, 2024
1 parent 4d44af7 commit 30a71ab
Show file tree
Hide file tree
Showing 58 changed files with 644 additions and 442 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
DROP TABLE join_code_uses;
ALTER TABLE courses DROP COLUMN is_joinable_by_code_only;
ALTER TABLE courses DROP COLUMN join_code;
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
CREATE TABLE join_code_uses (
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY,
course_instance_id UUID NOT NULL REFERENCES course_instances(id),
course_id UUID NOT NULL REFERENCES courses(id),
user_id UUID NOT NULL REFERENCES users(id),
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
deleted_at TIMESTAMP WITH TIME ZONE
);


CREATE TRIGGER set_timestamp BEFORE
UPDATE ON join_code_uses FOR EACH ROW EXECUTE PROCEDURE trigger_set_timestamp();
COMMENT ON TABLE join_code_uses IS 'This table is used to check if user has access to a course that is only joinable by a join code. The join code is located in course_instances table';
COMMENT ON TABLE join_code_uses IS 'This table is used to check if user has access to a course that is only joinable by a join code. The join code is located in courses table';
COMMENT ON COLUMN join_code_uses.id IS 'A unique, stable identifier for the record.';
COMMENT ON COLUMN join_code_uses.course_instance_id IS 'Course instance that the user has access to.';
COMMENT ON COLUMN join_code_uses.course_id IS 'Course that the user has access to.';
COMMENT ON COLUMN join_code_uses.user_id IS 'User who has the access to the course.';
COMMENT ON COLUMN join_code_uses.created_at IS 'Timestamp of when the record was created';
COMMENT ON COLUMN join_code_uses.updated_at IS 'Timestamp when the record was last updated. The field is updated automatically by the set_timestamp trigger.';
COMMENT ON COLUMN join_code_uses.deleted_at IS 'Timestamp when the record was deleted. If null, the record is not deleted.';

ALTER TABLE courses
ADD COLUMN join_code varchar(1024),
ADD COLUMN is_joinable_by_code_only BOOLEAN NOT NULL DEFAULT FALSE;
COMMENT ON COLUMN courses.join_code IS 'Regeneratable code that is used to join the course. If a user uses the code they will be added to join_code_uses -table to get access to the course';
COMMENT ON COLUMN courses.is_joinable_by_code_only IS 'Whether this course is only joinable by a join code that can be generated for a course instance'

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 30a71ab

Please sign in to comment.