-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
10a83de
commit 68d202e
Showing
17 changed files
with
285 additions
and
19 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# frozen_string_literal: true | ||
|
||
module DiscourseEvents | ||
class EventRegistration < ActiveRecord::Base | ||
self.table_name = "discourse_events_event_registrations" | ||
|
||
belongs_to :user | ||
belongs_to :event | ||
|
||
enum status: { confirmed: 0, declined: 1, tentative: 2 } | ||
end | ||
end | ||
|
||
# == Schema Information | ||
# | ||
# Table name: discourse_events_event_registrations | ||
# | ||
# id :bigint not null, primary key | ||
# event_id :bigint not null | ||
# user_id :bigint | ||
# email :string not null | ||
# uid :string | ||
# name :string | ||
# status :integer | ||
# created_at :datetime not null | ||
# updated_at :datetime not null | ||
# | ||
# Indexes | ||
# | ||
# idx_events_event_registration_emails (email) UNIQUE | ||
# index_discourse_events_event_registrations_on_event_id (event_id) | ||
# index_discourse_events_event_registrations_on_user_id (user_id) | ||
# | ||
# Foreign Keys | ||
# | ||
# fk_rails_... (event_id => discourse_events_events.id) | ||
# |
This file contains 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
20 changes: 20 additions & 0 deletions
20
db/migrate/20241004091816_create_discourse_events_event_registrations.rb
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# frozen_string_literal: true | ||
class CreateDiscourseEventsEventRegistrations < ActiveRecord::Migration[7.1] | ||
def change | ||
create_table :discourse_events_event_registrations do |t| | ||
t.references :event, index: true, foreign_key: { to_table: :discourse_events_events }, null: false | ||
t.references :user | ||
t.string :email, null: false | ||
t.string :uid | ||
t.string :name | ||
t.integer :status | ||
|
||
t.timestamps | ||
end | ||
|
||
add_index :discourse_events_event_registrations, | ||
%i[email], | ||
unique: true, | ||
name: :idx_events_event_registration_emails | ||
end | ||
end |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
6 changes: 6 additions & 0 deletions
6
spec/fabricators/discourse_events_event_registration_fabricator.rb
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# frozen_string_literal: true | ||
|
||
Fabricator(:discourse_events_event_registration, from: "DiscourseEvents::EventRegistration") do | ||
event { Fabricate(:discourse_events_event) } | ||
email { sequence(:email) { |i| "angus#{i}@email.com" } } | ||
end |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.