-
Notifications
You must be signed in to change notification settings - Fork 6
Domain Model
User - central model. Key fields:
-
roleenum:basic,moderator,admin -
is_frozen+unfreeze_at- manual freeze with optional auto-expiry -
email_confirmed- must betruebefore the user can do anything -
provider+uid- OAuth fields;oauth_user?returnsprovider.present? -
visibility,theme,link_username- profile settings
Session - one record per device, stores (user_id, ip, browser) + remember token.
Auth concerns in app/models/concerns/:
-
Rememberable- remember-me cookie logic -
Confirmable- email confirmation token -
Recoverable- password reset token
Jam - the main event model:
-
author_id- who created it - Schedule:
start_date,deadline,end_date - Key methods:
can_manage?,can_configure?,judge?,voting_open?,submission_open?
JamContributor - roles on a jam: host, admin, judge. Status: pending or accepted.
JamRatingSetting - per-jam voting config: jury_enabled, audience_enabled, locked.
JamCriterion - a voting axis for a jam:
-
kindenum:voted_on(star rating) ormanually_ranked(one pick per user) -
archived?,positionfor ordering
JamCriterionPick - a "1 vote for this game" record for manually_ranked criteria. One per user per criterion.
JamSubmission - links a user to a jam. game_id can be nil if a participant hasn't submitted a game yet.
JamNomination - a named award (title) with a winner_game_id.
Review - a single vote:
-
vote_typeenum:audience(0) orjury(1) - Unique per
(user, game, jam, criterion, vote_type)
Rating - cached average. Updated via after_save / after_destroy callbacks on Review through update_average_rating(game, jam_id).
Game#jam_rating(jam_id, vote_type:) and Game#overall_rating are the public interface for reading scores.
Game - a published game:
author_id-
statusenum:0= under moderation,1= accepted,2= rejected -
reason- moderation rejection reason
Games have many Tags (HABTM, max 10 per game).
Friendship - a connection between two users. Statuses: pending, accepted. The model has two associations: friendships and inverse_friendships to cover both directions.
Notification - activity feed:
-
recipient_id,actor_id -
actionstring - must match a key inconfig/locales/*/notifications.actions.* -
notifiablepolymorphic association
Report - a content complaint:
-
reportablepolymorphic -
reason,comment,status - Creating a report sends a notification to every admin and moderator.
AdministrationTracking - audit log for admin/mod actions:
-
admin_id,structure_type,structure_id -
changed_fields(JSON),actionstring
StatisticForDay - daily snapshot of is_online_today. Written by DailyActivityJob.
User
├── has_many :sessions
├── has_many :games (as author)
├── has_many :jam_submissions
├── has_many :jams (through submissions)
├── has_many :jam_contributors
├── has_many :reviews
├── has_many :friendships + inverse_friendships
└── has_many :notifications (as recipient)
Jam
├── belongs_to :author (User)
├── has_one :jam_rating_setting
├── has_many :jam_contributors
├── has_many :jam_criteria
├── has_many :jam_submissions
└── has_many :jam_nominations
Game
├── belongs_to :author (User)
├── has_many :reviews
├── has_many :ratings
└── has_and_belongs_to_many :tags