-
Notifications
You must be signed in to change notification settings - Fork 71
Move contracts to a new Contract model
#12094
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
Open
polypixeldev
wants to merge
27
commits into
main
Choose a base branch
from
polypixeldev/new-contract-model
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
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
garyhtou
reviewed
Nov 17, 2025
Comment on lines
+220
to
+226
| def contract_user | ||
| user | ||
| end | ||
|
|
||
| def contract_event | ||
| event | ||
| end |
Member
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it's more performant to make this an association that shares the same FK as the existing user/event association.
maybe:
belongs_to :contract_user, foreign_key: :user_id, class_name: "User"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary of the problem
Currently, contracts are in an
OrganizerPosition::Contractmodel and tightly coupled toOrganizerPositionInvite. With the new application flow I'm working on, we'll need contracts to be abstracted more to support a source from either anEvent::ApplicationorOrganizerPositionInvite, sinceOrganizerPositionInvitewill not exist yet when the applicant is signing the contract during the application flow.Describe your changes
Primarily, this PR adds a new
Contractmodel that is mostly the same asOrganizerPosition::Contract, with a couple differences:Contractableinstead of a relationship directly toOrganizerPositionInvite. OnlyOrganizerPositionInviteimplements this right now, but in the applications PREvent::Applicationwill also implement it.purposecolumn. This was added in the original implementation ofOrganizerPosition::Contract, but it is not currently being used. A future PR will likely add this back, either as the enum or atypecolumn for STI to automate termination contracts.All code that references
OrganizerPosition::Contracthas been changed to referenceContractinstead, including the relations onUserandEvent. A future PR will drop theOrganizerPosition::Contractmodel and associated table.In the database migration that creates this new table, steps have been added that copy over current data from the
organizer_position_contractstable and renames item types for versions stored in the PaperTrailversionstable.I've tested this PR using my own DocuSeal account in test mode, but it should be tested with our production DocuSeal account and a real contract before merging into production.