-
Notifications
You must be signed in to change notification settings - Fork 56
Multitenant backend #775
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
Merged
Merged
Multitenant backend #775
Changes from all commits
Commits
Show all changes
194 commits
Select commit
Hold shift + click to select a range
c929672
update test.exs to include optional test setting
YaleChen299 a819cb9
Merge branch 'dev/multitenent' of https://github.com/source-academy/c…
YaleChen299 4398684
initial schema change to account
YaleChen299 de88eb1
added schema for course_registration
YaleChen299 e4c3121
updated accounts query
YaleChen299 a1d3caf
Removed settings context and shifted sublanguages to courses context
chownces f4f2aab
Added initial tests for courses context and shifted settings tests over
chownces 37d70d3
Added initial tests for courses context controllers
chownces 92ed28e
Added course table changeset tests
chownces 8091770
updated course_registration context function/getters
YaleChen299 34f972e
Updated course config functions and tests
chownces 064ea99
Fix filename typo
chownces e9677d0
Updated endpoint url for course config update to prevent clash with a…
chownces eaa84ee
Added assesment config routing, functions and tests
chownces 07c27d4
Temporarily fix references to Courses context in miscellaneous files
chownces 9cabbaf
Added context functions and tests for assessment types
chownces 3609fa7
adding course_registration test set
YaleChen299 d2e607e
Merge branch 'courses-context' into yanyu
YaleChen299 d0d733e
Updated courses context tests
chownces 5b7ae63
Added update assessment types routing and routing tests
chownces 8bdb5e3
updated course_registration test
YaleChen299 2249d6a
Updated get course config tests to include assessment types for the s…
chownces e2935d9
added pipeline for course_registration to assign course_reg in conn
YaleChen299 1b47d10
Merge remote-tracking branch 'upstream/yanyu' into courses-context
chownces 598c513
Temporary edits to make tests compilable
chownces 31324fb
Merge remote-tracking branch 'upstream/courses-context' into yanyu
chownces 9032a06
Updated admin courses controller routes and test urls
chownces 053bf63
Updated courses controller routes and test urls
chownces 90ed3c9
Update admin courses controller tests
chownces ed1f1a6
Updated courses context tests
chownces b81306e
Updated course_registrations function
chownces 7d59959
Follow up on router assign_course
chownces 90ef463
Merge branch 'yanyu' into courses-context
chownces 52119bd
addded course_registration test for changeset
YaleChen299 185be5b
fix group factory, partial fix for the ecto.setup flow
YaleChen299 cda1cf3
updated course_registration context function test getters
YaleChen299 eec0983
Updated sourcecast context functions and tests
chownces 7e29acf
updated test for course_registration insert and update
YaleChen299 7f2f6ef
updated course_registration test
YaleChen299 c653241
updated course_registration test
YaleChen299 8ba9164
Merge branch 'yanyu' of https://github.com/source-academy/cadet into …
YaleChen299 268ae42
Updated sourcecast tests
chownces a7ab261
Updated assessment types tests
chownces 72aa8fb
Merge branch 'courses-context' into yanyu
YaleChen299 9c09f16
fix course_registration_test.exs
YaleChen299 c408f85
Updated sourcecast changeset
chownces f991d77
Updated stories schema and tests
chownces e119fb3
upadted assessment schema and relevant test
YaleChen299 a6cc1f7
Merge branch 'courses-context' into yanyu
YaleChen299 58ee16d
update assessment factory
YaleChen299 3370def
updated submissions schema with test, and added db migration
YaleChen299 40f8eae
added latest_viewed_course in user and course fk to group
YaleChen299 fecbea4
fix snake case
YaleChen299 dd1b520
updated accounts context function and adminUserController with test
YaleChen299 2026d6a
update accounts_test with get_users_by and fix queries with no groups
YaleChen299 6f32c37
update userController with test(except for stories)
YaleChen299 28e9972
fix accounts test
YaleChen299 ce185b3
added latest_viewed context functions with test
YaleChen299 215cd39
fix snake_case issue
YaleChen299 cef47b7
update seed.exs for initial test with frontend
YaleChen299 1b8760e
updated seed with latest_viewed
YaleChen299 aa02582
fix user view snake_case issue
YaleChen299 3e06aeb
refactor assessment_config to belong to assessment type with test and…
YaleChen299 703223c
update_assessment_config: move order from url param to json boday
YaleChen299 951e2e7
upadte courseName and courseShortName
YaleChen299 840b20f
update assessment_type test in user controller
YaleChen299 9f2e174
update seed
YaleChen299 3173dd1
update admin controller test to test updated result and fix course fi…
YaleChen299 8c9a8d0
refactor admin_course_controller test
YaleChen299 fddac6c
fix change of field name in course in user view
YaleChen299 08c1906
remove grade/max_grade/adjustment in assessments context
YaleChen299 fb5ee7d
fix assessments show & update submission_votes voter
YaleChen299 ea7fb6e
fix assessment submit and query avenger_of? with test
YaleChen299 aa6105b
updated bonus_xp logit with assessment config
YaleChen299 b2e89ca
update formatting and seed
YaleChen299 897504b
Updated google claim extractor
chownces 1caa711
Added github auth provider
chownces 44978d9
Namespacing for different auth providers
chownces dcc506f
Updated dev.secrets.exs.example
chownces 0554b04
Updated seed
chownces c170b65
Update github auth config
chownces 1b2d92b
Merge branch 'auth' into yanyu
chownces 8886589
Update user seeds
chownces ded4536
added get assessment config
YaleChen299 f8f496b
updated config route, combine assessment config table
YaleChen299 3fed686
debuging for working with frontend
YaleChen299 980042e
remove decay rate and update assessment config reorder logit with test
YaleChen299 d742348
Updated sign_in flow and user table to allow for NULL name
chownces 80aa571
refactor reorder logit with test
YaleChen299 62da75d
Added update_role and delete_user endpoints (#781)
chownces b11f5a2
tested reorder and mass_upsert_reorder
YaleChen299 cab3cdb
Merge branch 'yanyu' of https://github.com/source-academy/cadet into …
YaleChen299 c904718
Refactor update_role and delete_course_registration
chownces a11997a
Merge remote-tracking branch 'upstream/yanyu' into yanyu
chownces 50ed06f
Merge branch 'yanyu' into onboarding
chownces f9e313a
update test cases and fix some credo issues
YaleChen299 8c6f854
updated bonus_xp logic
YaleChen299 eb78555
update notifications with test
YaleChen299 09bb647
Added add_users endpoint and tests
chownces 1c62478
Merge branch 'yanyu' of https://github.com/source-academy/backend int…
chownces 8a76ce6
Format
chownces d3ec484
Added create course endpoint and tests
chownces 2d4aeb6
updated notification controller with test
YaleChen299 3fd8e74
updated assessments context functions with test(skipping contest)
YaleChen299 b4b7c7e
Merge branch 'yanyu' of https://github.com/source-academy/backend int…
chownces 0dda3c7
updated answer controller with test
YaleChen299 837cf01
Merge branch 'yanyu' of https://github.com/source-academy/cadet into …
YaleChen299 bbbd909
added delete assessment_config route with test
YaleChen299 434a3d7
Updated provider tests
chownces 809f06d
Merge branch 'auth' into yanyu
chownces 9bf0cbf
Format
chownces d2013cf
Temp updates to migration file
chownces b980e65
Complete migration file
chownces f36cf1b
remove required in notification
YaleChen299 8e544a0
fixing test seed and update with migration
YaleChen299 a33fd00
update assessment controller with test + alter assessment config table
YaleChen299 58486ac
finalise assessment controller with test
YaleChen299 d810fc2
Updated assessment config json to proper camelCase
chownces a20db49
Remove capitalisation of assessment types inside assessment_config ch…
chownces 2543309
update /user call
YaleChen299 abb8c85
update xml parser for assessment with test
YaleChen299 a5474b8
updated assessment config booleans
YaleChen299 9336746
rename /user view field
YaleChen299 9da4ae9
updated /user endpoint with skippable sent
YaleChen299 417b4ac
updated admin assessment controller with test
YaleChen299 aa81d40
update /user call and remove settings test
YaleChen299 57b89c9
finalised /user call
YaleChen299 10360bb
fix auth_controller_test
YaleChen299 2951c77
updated contest test
YaleChen299 55ae3fc
remove mentor from group
YaleChen299 14a4466
setting up admin grading controller test
YaleChen299 6d9d394
Updated admin PUT /users endpoint
chownces 4828abd
Namespace existing usernames in migration file
chownces 9b3cb80
Updated migration file assessment type configs
chownces 35d0156
Updated add users logic
chownces 2dba878
updated admin grading controller with test(less grading summary)
YaleChen299 9b13366
Merge branch 'yanyu' of https://github.com/source-academy/cadet into …
YaleChen299 1b91e64
merging
YaleChen299 15cdaed
Updated devices
chownces af49aff
refactor assessment config booleans to question
YaleChen299 c578c2c
Merge branch 'yanyu' of https://github.com/source-academy/cadet into …
YaleChen299 351ebf5
code formatting
YaleChen299 3ff0751
Fix migration file
chownces 0def541
Fix errors when testing with frontend
chownces 75388d5
added isManuallyGraded field to admin grading endpoint
YaleChen299 3f651fd
fix testcases
YaleChen299 fb2f35d
delete assessment config deletes relations + tested
YaleChen299 e4299fc
fix assessment grading view
YaleChen299 db6f7f8
fix format and credo issues
YaleChen299 45db4ef
Update migration file
chownces 6ae5609
added unique constaints for assessment number and course_id
YaleChen299 dbc0e69
Merge branch 'yanyu' of https://github.com/source-academy/cadet into …
YaleChen299 250dcbd
rename user view crId to courseRegId
chownces af51543
updated jobs and autograder with test
chownces 6866be5
update assessments controller test
chownces ab2f58c
updated grading summary with test
chownces 9a48889
fix spec and rename field
chownces 23b3975
reorder grading summary
chownces a4afef6
fix grader_id in migration
YaleChen299 0f22c01
grading index filter by course
YaleChen299 68beb23
read all notifications in the previous course
YaleChen299 1accd29
prepare for multitenant deploy
YaleChen299 b242322
prepare for multitenant deploy
YaleChen299 2219382
Debug workflow
angelsl e4da6d1
Specify --overwrite
angelsl d5b2b2f
update init.sh url
YaleChen299 9a87783
add role in /user call course array
YaleChen299 62da24f
add role in /user call course array
YaleChen299 bcccb16
Rebase branch "yanyu" to branch multitenant-deploy
YaleChen299 fbde058
clean up unused code
YaleChen299 57dbadd
set latest_viewed_id to nil in users for non-viewable course
YaleChen299 aad9ed6
update question testcases format
YaleChen299 54ce4cd
add migration for update testcase format
YaleChen299 7b00834
update migration
YaleChen299 6645ebf
Increase upsert users and groups transaction timeout to handle large …
chownces 3c92f55
update admin assets controller test
YaleChen299 783b1d7
update achievement for multitenant upgrade
YaleChen299 99df996
fix formatting
YaleChen299 4979a56
renaming and cleaning up code
YaleChen299 58c9b6a
rename latest viewed course
YaleChen299 f99bbe7
add course_reg_id to admin user routes
YaleChen299 b05b799
update migration
YaleChen299 bd8c83e
update migration
YaleChen299 b96e632
update migration
YaleChen299 069a856
update achievement migration
YaleChen299 c9afc2d
update contest leaderboard
YaleChen299 47ddd96
update contest test
YaleChen299 cbd4ce7
fix assessment config update
YaleChen299 60b6988
fix source chapter and variant changeset condition
YaleChen299 e8f119a
fix course changeset and validation
YaleChen299 20cdee2
simplify function
YaleChen299 a0fdd71
update delete route
YaleChen299 5dbc08a
fix issues
YaleChen299 fd56057
fix migration
YaleChen299 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
defmodule Cadet.Accounts.CourseRegistration do | ||
YaleChen299 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@moduledoc """ | ||
The mapping table representing the registration of a user to a course. | ||
""" | ||
use Cadet, :model | ||
|
||
alias Cadet.Accounts.{Role, User} | ||
alias Cadet.Courses.{Course, Group} | ||
|
||
schema "course_registrations" do | ||
field(:role, Role) | ||
field(:game_states, :map) | ||
|
||
belongs_to(:group, Group) | ||
belongs_to(:user, User) | ||
belongs_to(:course, Course) | ||
|
||
timestamps() | ||
end | ||
|
||
@required_fields ~w(user_id course_id role)a | ||
@optional_fields ~w(game_states group_id)a | ||
|
||
def changeset(course_registration, params \\ %{}) do | ||
course_registration | ||
|> cast(params, @optional_fields ++ @required_fields) | ||
|> add_belongs_to_id_from_model([:user, :group, :course], params) | ||
|> validate_required(@required_fields) | ||
|> unique_constraint(:user_id, name: :course_registrations_user_id_course_id_index) | ||
end | ||
end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.