Skip to content

Conversation

@polypixeldev
Copy link
Member

Summary of the problem

Currently, contracts are in an OrganizerPosition::Contract model and tightly coupled to OrganizerPositionInvite. With the new application flow I'm working on, we'll need contracts to be abstracted more to support a source from either an Event::Application or OrganizerPositionInvite, since OrganizerPositionInvite will not exist yet when the applicant is signing the contract during the application flow.

Describe your changes

Primarily, this PR adds a new Contract model that is mostly the same as OrganizerPosition::Contract, with a couple differences:

  • Has a polymorphic relationship Contractable instead of a relationship directly to OrganizerPositionInvite. Only OrganizerPositionInvite implements this right now, but in the applications PR Event::Application will also implement it.
  • No purpose column. This was added in the original implementation of OrganizerPosition::Contract, but it is not currently being used. A future PR will likely add this back, either as the enum or a type column for STI to automate termination contracts.

All code that references OrganizerPosition::Contract has been changed to reference Contract instead, including the relations on User and Event. A future PR will drop the OrganizerPosition::Contract model 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_contracts table and renames item types for versions stored in the PaperTrail versions table.

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.

@polypixeldev polypixeldev requested review from a team as code owners November 12, 2025 02:55
Comment on lines +220 to +226
def contract_user
user
end

def contract_event
event
end
Copy link
Member

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants