Skip to content

Conversation

@polypixeldev
Copy link
Member

@polypixeldev polypixeldev commented Nov 12, 2025

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.
  • A type column instead of a purpose column. The purpose column was added in the original implementation of OrganizerPosition::Contract, but it is not currently being used. This PR adds this back as STI, and a future PR will implement better automation for 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
Copy link
Member

@sampoder sampoder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! minus comment on type of contract

Copy link
Member

@garyhtou garyhtou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good schema!

@garyhtou garyhtou enabled auto-merge November 25, 2025 20:28
@garyhtou garyhtou added this pull request to the merge queue Nov 25, 2025
Merged via the queue into main with commit 7931e0a Nov 25, 2025
14 checks passed
@garyhtou garyhtou deleted the polypixeldev/new-contract-model branch November 25, 2025 20:36
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.

4 participants