-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from interflux-electronics/feature/event-regis…
…trations Event registrations
- Loading branch information
Showing
18 changed files
with
304 additions
and
39 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,35 @@ | ||
module V1 | ||
module Admin | ||
class EventAttendeesController < ApplicationController | ||
def index | ||
allow_index | ||
end | ||
|
||
def show | ||
allow_show | ||
end | ||
|
||
def create | ||
forbidden | ||
end | ||
|
||
def update | ||
forbidden | ||
end | ||
|
||
def destroy | ||
forbidden | ||
end | ||
|
||
private | ||
|
||
def model_class | ||
EventAttendee | ||
end | ||
|
||
def serializer_class | ||
V1::Admin::EventAttendeeSerializer | ||
end | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
module V1 | ||
module Public | ||
class EventAttendeesController < ApplicationController | ||
def index | ||
forbidden | ||
end | ||
|
||
def show | ||
forbidden | ||
end | ||
|
||
def create | ||
allow_create | ||
end | ||
|
||
def update | ||
allow_update | ||
end | ||
|
||
def destroy | ||
forbidden | ||
end | ||
|
||
private | ||
|
||
def model_class | ||
EventAttendee | ||
end | ||
|
||
def serializer_class | ||
V1::Public::EventAttendeeSerializer | ||
end | ||
|
||
def creatable_attributes | ||
%i[ | ||
first_name | ||
last_name | ||
role | ||
company | ||
] | ||
end | ||
|
||
def creatable_relationships | ||
%i[ | ||
event | ||
] | ||
end | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,17 +2,30 @@ | |
# | ||
# Table name: events | ||
# | ||
# id :uuid not null, primary key | ||
# city :string | ||
# dates :string | ||
# description :string | ||
# end_date :string | ||
# name :string | ||
# start_date :string | ||
# created_at :datetime not null | ||
# updated_at :datetime not null | ||
# country_id :string | ||
# id :uuid not null, primary key | ||
# ask_company :boolean | ||
# ask_first_name :boolean | ||
# ask_last_name :boolean | ||
# ask_role :boolean | ||
# city :string | ||
# confirmation_email_bcc :string default("[email protected], [email protected]") | ||
# confirmation_email_body :string default("Hello {first_name} {last_name}, We look forward seeing you at {event_name} on {event_date} in {event_location}. Best regards, The Interflux Electronics team") | ||
# confirmation_email_subject :string default("See you soon at {event_name}!") | ||
# dates :string | ||
# description :string | ||
# end_date :string | ||
# has_registration_form :boolean | ||
# name :string | ||
# start_date :string | ||
# created_at :datetime not null | ||
# updated_at :datetime not null | ||
# country_id :string | ||
# | ||
class Event < ApplicationRecord | ||
belongs_to :country | ||
|
||
has_many :permalinks | ||
has_many :event_attendees | ||
|
||
alias_attribute :attendees, :event_attendees | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# == Schema Information | ||
# | ||
# Table name: event_attendees | ||
# | ||
# id :uuid not null, primary key | ||
# company :string | ||
# email :string | ||
# first_name :string | ||
# last_name :string | ||
# role :string | ||
# created_at :datetime not null | ||
# updated_at :datetime not null | ||
# event_id :uuid | ||
# person_id :uuid | ||
# | ||
class EventAttendee < ApplicationRecord | ||
belongs_to :event | ||
belongs_to :person, optional: true | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module V1 | ||
module Admin | ||
class EventAttendeeSerializer < ApplicationSerializer | ||
attributes :first_name, | ||
:last_name, | ||
:role, | ||
:company, | ||
|
||
belongs_to :event | ||
belongs_to :person | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module V1 | ||
module Public | ||
class EventAttendeeSerializer < ApplicationSerializer | ||
attributes :first_name, | ||
:last_name, | ||
:role, | ||
:company, | ||
|
||
belongs_to :event | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
class CreateEventAttendees < ActiveRecord::Migration[6.1] | ||
def change | ||
change_table :events, bulk: true do |t| | ||
t.column :has_registration_form, :boolean | ||
|
||
t.column :ask_first_name, :boolean | ||
t.column :ask_last_name, :boolean | ||
t.column :ask_role, :boolean | ||
t.column :ask_company, :boolean | ||
|
||
t.column :confirmation_email_subject, :string, default: 'See you soon at {event_name}!' | ||
t.column :confirmation_email_body, :string, default: 'Hello {first_name} {last_name}, We look forward seeing you at {event_name} on {event_date} in {event_location}. Best regards, The Interflux Electronics team' | ||
t.column :confirmation_email_bcc, :string, default: '[email protected], [email protected]' | ||
end | ||
|
||
change_table :permalinks, bulk: true do |t| | ||
t.column :event_id, :uuid | ||
end | ||
|
||
create_table :event_attendees, id: :uuid do |t| | ||
t.uuid :event_id | ||
t.uuid :person_id | ||
|
||
t.string :first_name | ||
t.string :last_name | ||
t.string :role | ||
t.string :company | ||
t.string :email | ||
|
||
t.timestamps | ||
end | ||
end | ||
end |
5 changes: 5 additions & 0 deletions
5
db/migrate/20240407010227_add_unique_constraints_to_permalinks.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,5 @@ | ||
class AddUniqueConstraintsToPermalinks < ActiveRecord::Migration[6.1] | ||
def change | ||
add_index :permalinks, :slug, unique: true | ||
end | ||
end |
Oops, something went wrong.