sausage-sandwich/ruby_sandwich

View on GitHub
lib/sandwich/repositories/user_repository.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

class UserRepository < Hanami::Repository
  def find_by_email(email)
    users.where(email: email).map_to(User).one
  end

  def by_created_at(page: 1, per_page: 50)
    users.order(Sequel.desc(:created_at)).limit(per_page).offset(per_page * (page - 1))
  end
end