Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow fetching of articles that a group has published #377

Merged
merged 10 commits into from
Jan 19, 2025
1 change: 1 addition & 0 deletions app/models/group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class Group < ApplicationRecord
has_many :groups_permissions, class_name: 'GroupsPermissions', dependent: :destroy
has_many :permissions, through: :groups_permissions
has_many :mail_aliases
has_many :articles

scope :active, (lambda {
joins(:memberships).merge(Membership.active).distinct
Expand Down
1 change: 1 addition & 0 deletions app/resources/v1/group_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def description_camofied
has_many :memberships
has_many :mail_aliases
has_many :permissions
has_many :articles

filter :active, apply: ->(records, _value, _options) { records.active }
filter :kind
Expand Down
1 change: 0 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
# migrations use external dependencies or application code.
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.0].define(version: 2024_11_13_091607) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down
4 changes: 2 additions & 2 deletions spec/resources/v1/group_resource_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

describe '#fetchable_fields' do
let(:basic_fields) do
%i[id name avatar_url avatar_thumb_url created_at updated_at mail_aliases memberships users
permissions]
%i[id name articles avatar_url avatar_thumb_url created_at updated_at mail_aliases
memberships users permissions]
end
let(:authenticated_fields) do
%i[description description_camofied kind recognized_at_gma rejected_at_gma administrative]
Expand Down
Loading