# frozen_string_literal: true require 'rom-repository' module EuchreCamp module Repositories class Events < ::EuchreCamp::Repository[:events] commands :create, update: :by_pk, delete: :by_pk def all events.to_a end def by_id(id) events.by_pk(id).one! end def upcoming events.where(status: ['planned', 'active']).order(:event_date).to_a end def completed events.where(status: 'completed').order(Sequel.desc(:event_date)).to_a end end end end