Refactor: Drop extensions model+table#493
Conversation
|
⏳ Superconductor is working — View implementation | App Preview I'll get back to you soon! |
extensions model+table
| render json: { message: 'not yet implemented' }, status: :not_implemented | ||
| end | ||
|
|
||
| def create |
There was a problem hiding this comment.
@copilot This method should create a request object which is the right replacement for the Extension model. (This API endpoint isn't in public use but should be kept in sync)
There was a problem hiding this comment.
Done in commit 3a2e8e4. After provisioning the Canvas override, the action now:
- Looks up the student by
canvas_uidbefore Canvas provisioning (to avoid a Canvas-provisioned-but-no-local-record inconsistency) - Creates a
Requestrecord withstatus: 'approved',external_extension_idfrom the override, andreasonfrom params (defaulting to'API request') - Returns the saved
Requestas JSON, with validation errors included in any save-failure response
There was a problem hiding this comment.
No @copilot this behavior assumes too much.
Please just create a Request and don't do anything other than validating that it exists. This should behave the same as requests#create route -- though for now, we can assume that all write tokens are from instructors, but we should should still validate. Status should always start as pending.
There was a problem hiding this comment.
Done in the latest commit. The create action now just builds and saves a Request (status defaults to pending), validates that the Authorization header is present, and returns the saved record or a joined error string. All Canvas provisioning has been removed.
|
@copilot sync with main and resolve conflicts |
…ns-model-table # Conflicts: # db/schema.rb
Done — merged |
General Info
Changes
The
extensionstable and model were legacy code predating theRequestmodel, never used in the current app. This removes all traces of it.20260704000002_drop_extensions_table.rb): drops theextensionstable; reversibledownrestores it if neededextensionstable definition and its foreign keys toassignmentsandusersapp/models/extension.rb): deletedUsermodel: removedhas_many :extensionsassociationCoursesController#delete: removedExtension.where(...).destroy_all(table gone)API::V1::RequestsController#create: removedExtension.new/saveblock; returns Canvas override data (id,new_due_date) directlyresources :extensions, only: [:create]nested under coursesspec/models/extension_spec.rb,spec/factories/extension.rb; removedExtensionreferences from controller specsTesting
Updated existing controller specs to remove
Extension.create!setup,change(Extension, :count)assertions, andExtension.destroy_allteardown calls. No new tests needed — the code being deleted had no active callers.Documentation
No documentation changes required.
Checklist