File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -32,6 +32,9 @@ gem 'tzinfo-data', platforms: %i[windows jruby]
3232# Reduces boot times through caching; required in config/boot.rb
3333gem 'bootsnap' , require : false
3434
35+ # Loads environment variables from .env (local dev/test only, not Heroku)
36+ gem 'dotenv-rails' , groups : [ :development , :test ]
37+
3538# Alternative Canvas API. We probably don't need this.
3639# Verify instances of `LMS::Canvas`
3740gem 'lms-api'
@@ -73,6 +76,7 @@ gem 'dotenv-rails', require: 'dotenv/load'
7376#
7477gem 'blazer'
7578gem 'hypershield'
79+ gem 'good_job' , '~> 4.0'
7680
7781#### Frontend related tools
7882# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
Original file line number Diff line number Diff line change 193193 dumb_delegator (1.1.0 )
194194 erb (6.0.2 )
195195 erubi (1.13.1 )
196+ et-orbi (1.4.0 )
197+ tzinfo
196198 factory_bot (6.5.6 )
197199 activesupport (>= 6.1.0 )
198200 factory_bot_rails (6.5.1 )
219221 sassc (~> 2.0 )
220222 formatador (1.2.3 )
221223 reline
224+ fugit (1.12.1 )
225+ et-orbi (~> 1.4 )
226+ raabro (~> 1.4 )
222227 globalid (1.3.0 )
223228 activesupport (>= 6.1 )
229+ good_job (4.14.2 )
230+ activejob (>= 6.1.0 )
231+ activerecord (>= 6.1.0 )
232+ concurrent-ruby (>= 1.3.1 )
233+ fugit (>= 1.11.0 )
234+ railties (>= 6.1.0 )
235+ thor (>= 1.0.0 )
224236 guard (2.20.1 )
225237 formatador (>= 0.2.4 )
226238 listen (>= 2.7 , < 4.0 )
386398 public_suffix (7.0.5 )
387399 puma (7.2.0 )
388400 nio4r (~> 2.0 )
401+ raabro (1.4.0 )
389402 racc (1.8.1 )
390403 rack (3.2.6 )
391404 rack-protection (4.2.1 )
@@ -633,6 +646,7 @@ DEPENDENCIES
633646 faraday
634647 faraday-cookie_jar
635648 font-awesome-sass
649+ good_job (~> 4.0 )
636650 guard-rspec
637651 hypershield
638652 importmap-rails
Original file line number Diff line number Diff line change @@ -139,7 +139,7 @@ def update_user_credential(user, token)
139139 )
140140 else
141141 user . lms_credentials . create! (
142- lms_id : 1 ,
142+ lms_name : 'canvas' ,
143143 token : token . token ,
144144 refresh_token : token . refresh_token ,
145145 expire_time : Time . zone . at ( token . expires_at )
Original file line number Diff line number Diff line change 2626class LmsCredential < ApplicationRecord
2727 # Belongs to a User
2828 belongs_to :user
29- belongs_to :lms , optional : true
3029
3130 # Encryption for tokens
3231 encrypts :token , :refresh_token
3332
3433 # LMS must exist
35- validates :lms_id , presence : true
34+ validates :lms_name , presence : true
3635end
Original file line number Diff line number Diff line change 163163
164164 create_table "lms_credentials" , force : :cascade do |t |
165165 t . bigint "user_id"
166+ t . string "lms_name"
166167 t . string "username"
167168 t . string "password"
168169 t . string "token"
171172 t . datetime "updated_at" , null : false
172173 t . string "external_user_id"
173174 t . datetime "expire_time"
174- t . bigint "lms_id"
175175 t . index [ "user_id" ] , name : "index_lms_credentials_on_user_id"
176176 end
177177
213213 t . datetime "updated_at" , null : false
214214 t . boolean "removed" , default : false , null : false
215215 t . boolean "allow_extended_requests" , default : false , null : false
216- t . text "notes"
217216 t . index [ "course_id" ] , name : "index_user_to_courses_on_course_id"
218217 t . index [ "user_id" ] , name : "index_user_to_courses_on_user_id"
219218 end
237236 add_foreign_key "extensions" , "assignments"
238237 add_foreign_key "extensions" , "users" , column : "last_processed_by_id"
239238 add_foreign_key "form_settings" , "courses"
240- add_foreign_key "lms_credentials" , "lmss"
241239 add_foreign_key "lms_credentials" , "users"
242240 add_foreign_key "requests" , "assignments"
243241 add_foreign_key "requests" , "courses"
Original file line number Diff line number Diff line change 4242 course = described_class . create! ( canvas_id : 'canvas_123' , course_name : 'Test' , course_code : 'TEST101' )
4343 user = User . create! ( email : 'test@example.com' , canvas_uid : '123' )
4444 user . lms_credentials . create! (
45- lms_id : 1 ,
45+ lms_name : 'canvas' ,
4646 token : 'valid_token' ,
4747 refresh_token : 'refresh_token' ,
4848 expire_time : 1 . hour . from_now
You can’t perform that action at this time.
0 commit comments