Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ Metrics/AbcSize:
Exclude:
- db/migrate/**/*.rb

Metrics/ClassLength:
Enabled: false

Metrics/BlockLength:
Enabled: false

Metrics/MethodLength:
CountAsOne: ['array', 'heredoc']
Max: 20 # default is 10
Expand Down
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Intercode is a convention management system built with:

- **TypeScript**: Run `yarn run tsc --noEmit` after making changes
- **Ruby**: Run the relevant test suite before committing
- **GraphQL schema**: Whenever a change touches `app/graphql` (types, mutations, sources, etc.) in a way that changes the schema — new/changed/removed fields, arguments, or descriptions — run `bin/rails graphql:update` and commit the resulting changes to `schema.graphql`, `schema.json`, and the generated frontend files (`app/javascript/graphqlTypes.generated.ts`, `*.generated.ts` files, `app/graphql/graphql_operations_generated.json`, `app/javascript/possibleTypes.json`, `app/javascript/enumTypes.json`). These are checked-in generated files, not build artifacts — a PR that changes the schema without regenerating them leaves them stale for whoever touches the schema next.

## Deployment Model

Expand Down
52 changes: 33 additions & 19 deletions app/graphql/types/event_proposal_type.rb
Original file line number Diff line number Diff line change
@@ -1,32 +1,46 @@
# frozen_string_literal: true
class Types::EventProposalType < Types::BaseObject
description "A proposal for a new event, submitted by a convention attendee for review"

include FormResponseAttrsFields

authorize_record

field :id, ID, null: false
field :id, ID, null: false, description: "The ID of this event proposal"

field :form, Types::FormType, null: true
field :form, Types::FormType, null: true, description: "The form used for this event proposal"

field :admin_notes, String, null: true do
field :admin_notes, String, null: true, description: "Admin-only notes about this event proposal" do
authorize_action :read_admin_notes
end
field :convention, Types::ConventionType, null: false
field :created_at, Types::DateType, null: false
field :length_seconds, Integer, null: true
field :registration_policy, Types::RegistrationPolicyType, null: true
field :status, String, null: false
field :submitted_at, Types::DateType, null: true
field :title, String, null: true
field :updated_at, Types::DateType, null: false

field :event, Types::EventType, null: true
field :event_category, Types::EventCategoryType, null: false
field :form_response_changes, [Types::FormResponseChangeType], null: false
field :images, [Types::ActiveStorageAttachmentType], null: false
field :owner, Types::UserConProfileType, null: false

association_loaders EventProposal, :convention, :owner, :event, :event_category
field :convention, Types::ConventionType, null: false, description: "The convention this event proposal belongs to"
field :created_at, Types::DateType, null: false, description: "When this event proposal was created"
field :length_seconds, Integer, null: true, description: "The proposed length of the event in seconds"
field :registration_policy,
Types::RegistrationPolicyType,
null: true,
description: "The proposed registration policy for this event"
field :status, String, null: false, description: "The status of this event proposal (draft, submitted, etc.)"
field :submitted_at, Types::DateType, null: true, description: "When this event proposal was submitted for review"
field :title, String, null: true, description: "The proposed title of the event"
field :updated_at, Types::DateType, null: false, description: "When this event proposal was last updated"

field :event, Types::EventType, null: true, description: "The event created from this proposal, if it was accepted"
field :event_category, Types::EventCategoryType, null: false, description: "The category of this event proposal"
field :form_response_changes,
[Types::FormResponseChangeType],
null: false,
description: "The history of changes to this event proposal's form response"
field :images,
[Types::ActiveStorageAttachmentType],
null: false,
description: "Images attached to this event proposal"
field :owner,
Types::UserConProfileType,
null: false,
description: "The convention attendee who submitted this proposal"

association_loaders EventProposal, :convention, :owner, :event, :event_category, :registration_policy

def form
event_category = dataloader.with(Sources::ActiveRecordAssociation, EventProposal, :event_category).load(object)
Expand Down
10 changes: 7 additions & 3 deletions app/graphql/types/event_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class Types::EventType < Types::BaseObject

field :event_category, Types::EventCategoryType, null: false, description: "The category of this event"

association_loaders Event, :event_category, :team_members, :ticket_types, :convention
association_loaders Event, :event_category, :team_members, :ticket_types, :convention, :registration_policy

def form
event_category = dataloader.with(Sources::ActiveRecordAssociation, Event, :event_category).load(object)
Expand Down Expand Up @@ -139,12 +139,16 @@ def maximum_event_provided_tickets_overrides

# rubocop:disable Naming/PredicateMethod
def slots_limited
object.registration_policy.slots_limited?
policy = registration_policy
dataloader.with(Sources::ActiveRecordAssociation, RegistrationPolicy, :buckets).load(policy)
policy.slots_limited?
end
# rubocop:enable Naming/PredicateMethod

def total_slots
object.registration_policy.total_slots
policy = registration_policy
dataloader.with(Sources::ActiveRecordAssociation, RegistrationPolicy, :buckets).load(policy)
policy.total_slots
end

def short_blurb_html
Expand Down
42 changes: 42 additions & 0 deletions app/graphql/types/registration_policy_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,46 @@ class Types::RegistrationPolicyType < Types::BaseObject
field :total_slots_including_not_counted, Integer, null: true do # rubocop:disable GraphQL/ExtractType
description "The sum of total slots across all buckets, including not-counted buckets."
end

association_loaders RegistrationPolicy, :buckets

def minimum_slots
buckets
object.minimum_slots
end

def minimum_slots_including_not_counted
buckets
object.minimum_slots_including_not_counted
end

def only_uncounted # rubocop:disable Naming/PredicateMethod
buckets
object.only_uncounted?
end

def preferred_slots
buckets
object.preferred_slots
end

def preferred_slots_including_not_counted
buckets
object.preferred_slots_including_not_counted
end

def slots_limited # rubocop:disable Naming/PredicateMethod
buckets
object.slots_limited?
end

def total_slots
buckets
object.total_slots
end

def total_slots_including_not_counted
buckets
object.total_slots_including_not_counted
end
end
5 changes: 5 additions & 0 deletions app/javascript/EventAdmin/mutations.generated.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions app/javascript/EventProposals/mutations.generated.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions app/javascript/graphqlTypes.generated.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading